diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eeedf00..84a73e1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,7 @@ on: workflow_dispatch: jobs: - build-max2max: + build-mc2mc: runs-on: ubuntu-latest steps: - name: Checkout @@ -21,7 +21,7 @@ jobs: # Build the Go binary - name: Build run: | - cd max2max + cd mc2mc mkdir build go get . - env GOOS=linux GOARCH=amd64 go build -o ./build/max2max . + env GOOS=linux GOARCH=amd64 go build -o ./build/mc2mc . diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6533a88..45aded2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,7 +4,7 @@ on: push: tags: - 'bq2bq/v*' - - 'max2max/v*' + - 'mc2mc/v*' jobs: bq2bq: @@ -42,8 +42,8 @@ jobs: docker.io/gotocompany/optimus-task-bq2bq-executor:${{ steps.vars.outputs.tag }} - name: Log out from Docker Hub run: docker logout - max2max: - if: startsWith(github.ref, 'refs/tags/max2max/v') + mc2mc: + if: startsWith(github.ref, 'refs/tags/mc2mc/v') runs-on: ubuntu-latest steps: - name: Checkout @@ -57,10 +57,10 @@ jobs: # Build the Go binary - name: Build run: | - cd max2max + cd mc2mc mkdir build go get . - env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./build/max2max . + env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./build/mc2mc . - name: Login to DockerHub uses: docker/login-action@v1 with: @@ -71,8 +71,8 @@ jobs: - name: Extract tag version id: vars run: | - # Extract the tag name from GITHUB_REF, remove 'refs/tags/max2max/v' prefix - TAG="${GITHUB_REF#refs/tags/max2max/}" + # Extract the tag name from GITHUB_REF, remove 'refs/tags/mc2mc/v' prefix + TAG="${GITHUB_REF#refs/tags/mc2mc/}" TAG="${TAG#v}" echo "Tag name: $TAG" echo "::set-output name=tag::$TAG" @@ -80,11 +80,11 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v5 with: - context: ./max2max + context: ./mc2mc platforms: linux/amd64 # Specify the target platforms push: true tags: | - docker.io/gotocompany/max2max:latest - docker.io/gotocompany/max2max:${{ steps.vars.outputs.tag }} + docker.io/gotocompany/mc2mc:latest + docker.io/gotocompany/mc2mc:${{ steps.vars.outputs.tag }} - name: Log out from Docker Hub run: docker logout diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 270e598..c3c3d0d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,7 +24,7 @@ jobs: cd ./bq2bq chmod +x ./run_coverage.sh ./run_coverage.sh - max2max: + mc2mc: runs-on: ubuntu-latest steps: - name: Checkout @@ -38,6 +38,6 @@ jobs: # Build the Go binary - name: Build run: | - cd max2max + cd mc2mc go get . go test ./... diff --git a/max2max/Dockerfile b/max2max/Dockerfile deleted file mode 100644 index c54b4c9..0000000 --- a/max2max/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM alpine:3 - -RUN apk --no-cache add tzdata -COPY ./build/max2max /usr/local/bin/max2max - -ENTRYPOINT ["/usr/local/bin/max2max"] diff --git a/max2max/.gitignore b/mc2mc/.gitignore similarity index 100% rename from max2max/.gitignore rename to mc2mc/.gitignore diff --git a/mc2mc/Dockerfile b/mc2mc/Dockerfile new file mode 100644 index 0000000..903552d --- /dev/null +++ b/mc2mc/Dockerfile @@ -0,0 +1,6 @@ +FROM alpine:3 + +RUN apk --no-cache add tzdata +COPY ./build/mc2mc /usr/local/bin/mc2mc + +ENTRYPOINT ["/usr/local/bin/mc2mc"] diff --git a/max2max/go.mod b/mc2mc/go.mod similarity index 97% rename from max2max/go.mod rename to mc2mc/go.mod index b4d4b7e..2653635 100644 --- a/max2max/go.mod +++ b/mc2mc/go.mod @@ -1,4 +1,4 @@ -module github.com/goto/transformers/max2max +module github.com/goto/transformers/mc2mc go 1.22.3 diff --git a/max2max/go.sum b/mc2mc/go.sum similarity index 100% rename from max2max/go.sum rename to mc2mc/go.sum diff --git a/max2max/internal/client/client.go b/mc2mc/internal/client/client.go similarity index 100% rename from max2max/internal/client/client.go rename to mc2mc/internal/client/client.go diff --git a/max2max/internal/client/client_test.go b/mc2mc/internal/client/client_test.go similarity index 98% rename from max2max/internal/client/client_test.go rename to mc2mc/internal/client/client_test.go index 8b96569..d84083b 100644 --- a/max2max/internal/client/client_test.go +++ b/mc2mc/internal/client/client_test.go @@ -6,7 +6,7 @@ import ( "os" "testing" - "github.com/goto/transformers/max2max/internal/client" + "github.com/goto/transformers/mc2mc/internal/client" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/max2max/internal/client/odps.go b/mc2mc/internal/client/odps.go similarity index 100% rename from max2max/internal/client/odps.go rename to mc2mc/internal/client/odps.go diff --git a/max2max/internal/client/opentelemetry.go b/mc2mc/internal/client/opentelemetry.go similarity index 95% rename from max2max/internal/client/opentelemetry.go rename to mc2mc/internal/client/opentelemetry.go index cccf4b0..7dfabb7 100644 --- a/max2max/internal/client/opentelemetry.go +++ b/mc2mc/internal/client/opentelemetry.go @@ -24,7 +24,7 @@ func setupOTelSDK(ctx context.Context, collectorGRPCEndpoint string, jobName, sc meterProvider := metric.NewMeterProvider( metric.WithResource(resource.NewWithAttributes( resource.Default().SchemaURL(), - attribute.String("plugin.name", "max2max"), + attribute.String("plugin.name", "mc2mc"), attribute.String("job.name", jobName), attribute.String("job.scheduled_time", scheduledTime), )), diff --git a/max2max/internal/client/setup.go b/mc2mc/internal/client/setup.go similarity index 90% rename from max2max/internal/client/setup.go rename to mc2mc/internal/client/setup.go index 5507f25..8d2120d 100644 --- a/max2max/internal/client/setup.go +++ b/mc2mc/internal/client/setup.go @@ -2,8 +2,8 @@ package client import ( "github.com/aliyun/aliyun-odps-go-sdk/odps" - "github.com/goto/transformers/max2max/internal/loader" - "github.com/goto/transformers/max2max/internal/logger" + "github.com/goto/transformers/mc2mc/internal/loader" + "github.com/goto/transformers/mc2mc/internal/logger" "github.com/pkg/errors" ) diff --git a/max2max/internal/config/config.go b/mc2mc/internal/config/config.go similarity index 98% rename from max2max/internal/config/config.go rename to mc2mc/internal/config/config.go index 06c98ad..d709b69 100644 --- a/max2max/internal/config/config.go +++ b/mc2mc/internal/config/config.go @@ -28,7 +28,7 @@ type maxComputeCredentials struct { func NewConfig() (*Config, error) { cfg := &Config{ Config: odps.NewConfig(), - // max2max related config + // mc2mc related config LogLevel: getEnv("LOG_LEVEL", "INFO"), LoadMethod: getEnv("LOAD_METHOD", "APPEND"), QueryFilePath: getEnv("QUERY_FILE_PATH", "/data/in/query.sql"), diff --git a/max2max/internal/config/util.go b/mc2mc/internal/config/util.go similarity index 100% rename from max2max/internal/config/util.go rename to mc2mc/internal/config/util.go diff --git a/max2max/internal/loader/append.go b/mc2mc/internal/loader/append.go similarity index 100% rename from max2max/internal/loader/append.go rename to mc2mc/internal/loader/append.go diff --git a/max2max/internal/loader/const.go b/mc2mc/internal/loader/const.go similarity index 100% rename from max2max/internal/loader/const.go rename to mc2mc/internal/loader/const.go diff --git a/max2max/internal/loader/factory.go b/mc2mc/internal/loader/factory.go similarity index 100% rename from max2max/internal/loader/factory.go rename to mc2mc/internal/loader/factory.go diff --git a/max2max/internal/loader/merge.go b/mc2mc/internal/loader/merge.go similarity index 100% rename from max2max/internal/loader/merge.go rename to mc2mc/internal/loader/merge.go diff --git a/max2max/internal/loader/replace.go b/mc2mc/internal/loader/replace.go similarity index 100% rename from max2max/internal/loader/replace.go rename to mc2mc/internal/loader/replace.go diff --git a/max2max/internal/logger/logger.go b/mc2mc/internal/logger/logger.go similarity index 100% rename from max2max/internal/logger/logger.go rename to mc2mc/internal/logger/logger.go diff --git a/max2max/main.go b/mc2mc/main.go similarity index 75% rename from max2max/main.go rename to mc2mc/main.go index 5777711..83962aa 100644 --- a/max2max/main.go +++ b/mc2mc/main.go @@ -8,11 +8,11 @@ import ( ) func main() { - // max2max is the main function to execute the max2max transformation + // mc2mc is the main function to execute the mc2mc transformation // which reads the configuration, sets up the client and executes the query. // It also handles graceful shutdown by listening to os signals. // It returns error if any. - if err := max2max(); err != nil { + if err := mc2mc(); err != nil { fmt.Printf("error: %+v\n", err) os.Exit(1) } diff --git a/max2max/max2max.go b/mc2mc/mc2mc.go similarity index 85% rename from max2max/max2max.go rename to mc2mc/mc2mc.go index 98dc4ba..42f4084 100644 --- a/max2max/max2max.go +++ b/mc2mc/mc2mc.go @@ -6,12 +6,12 @@ import ( "os/signal" "syscall" - "github.com/goto/transformers/max2max/internal/client" - "github.com/goto/transformers/max2max/internal/config" + "github.com/goto/transformers/mc2mc/internal/client" + "github.com/goto/transformers/mc2mc/internal/config" "github.com/pkg/errors" ) -func max2max() error { +func mc2mc() error { // load config cfg, err := config.NewConfig() if err != nil {