From 9745d6219488afe95ed082160598174229d26c19 Mon Sep 17 00:00:00 2001 From: Evgeniy Frolov Date: Tue, 25 Mar 2025 13:20:05 +0300 Subject: [PATCH 1/6] chore(release): update release build process Signed-off-by: Evgeniy Frolov chore(taskfile): add clean task update image build task Signed-off-by: Evgeniy Frolov --- Dockerfile | 9 -------- Taskfile.dist.yaml | 46 ++++++++++++++++++++++++++++++++++---- scripts/builder/Dockerfile | 20 +++++++++++++++++ 3 files changed, 62 insertions(+), 13 deletions(-) delete mode 100644 Dockerfile create mode 100644 scripts/builder/Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index c594478..0000000 --- a/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM --platform=linux/amd64 golang:1.23-bookworm@sha256:3149bc5043fa58cf127fd8db1fdd4e533b6aed5a40d663d4f4ae43d20386665f - -RUN apt-get -y update && \ - apt-get -y install file && \ - curl -sSLO https://github.com/go-task/task/releases/download/v3.33.1/task_linux_amd64.deb && \ - apt-get -y install ./task_linux_amd64.deb && \ - rm -rf ./task_linux_amd64.deb /var/cache/apt/* /var/lib/apt/lists/* /var/log/* - -WORKDIR /trx diff --git a/Taskfile.dist.yaml b/Taskfile.dist.yaml index 927accb..5b9e762 100644 --- a/Taskfile.dist.yaml +++ b/Taskfile.dist.yaml @@ -2,6 +2,10 @@ version: "3" silent: true +env: + CGO_ENABLED: "0" + GO111MODULE: "on" + vars: version: '{{.version | default "dev"}}' @@ -190,7 +194,6 @@ tasks: env: GOOS: "{{.targetOS}}" GOARCH: "{{.targetArch}}" - CGO_ENABLED: 0 build: desc: "Build trx dev binary." @@ -203,17 +206,52 @@ tasks: _image:build: cmds: - - docker build {{.CLI_ARGS}} --platform=linux/amd64 -f "{{.dfilePath}}" -t "{{.imageName}}" "{{.context | default "."}}" + - docker build {{.CLI_ARGS}} -f "{{.dfilePath}}" -t "{{.imageName}}" "{{.context | default "."}}" image:build:builder: - desc: 'Build werf builder image. Important vars: "imageName".' + desc: 'Build main builder image. Important vars: "imageName".' cmds: - task: _image:build vars: - dfilePath: Dockerfile + dfilePath: scripts/builder/Dockerfile + imageName: + sh: "echo registry-write.werf.io/trx/builder:$(git rev-parse HEAD)" + + _image:push: + cmds: + - docker push {{.CLI_ARGS}} "{{.imageName}}" + + image:publish:builder: + desc: 'Build and publish main builder image. Important vars: "imageName".' + deps: + - image:build:builder + cmds: + - task: _image:push + vars: imageName: sh: "echo registry-write.werf.io/trx/builder:$(git rev-parse HEAD)" + clean: + desc: "Clean all temporary files and build artifacts." + deps: + - clean:binaries + + clean:binaries: + desc: "Clean all built binaries." + deps: + - clean:binaries:dev + - clean:binaries:dist + + clean:binaries:dev: + desc: "Clean built dev binaries." + cmds: + - rm -rf ./bin + + clean:binaries:dist: + desc: "Clean built release binaries." + cmds: + - rm -rf ./dist + verify:dist:binaries: desc: "Verify that the distributable binaries are built and have correct platform/arch." cmds: diff --git a/scripts/builder/Dockerfile b/scripts/builder/Dockerfile new file mode 100644 index 0000000..8859be7 --- /dev/null +++ b/scripts/builder/Dockerfile @@ -0,0 +1,20 @@ +FROM --platform=linux/amd64 golang:1.23-bookworm@sha256:3149bc5043fa58cf127fd8db1fdd4e533b6aed5a40d663d4f4ae43d20386665f +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get -y update && \ + apt-get -y install apt-utils gcc-aarch64-linux-gnu file && \ + curl -sSLO https://github.com/go-task/task/releases/download/v3.33.1/task_linux_amd64.deb && \ + apt-get -y install ./task_linux_amd64.deb && \ + rm -rf ./task_linux_amd64.deb /var/cache/apt/* /var/lib/apt/lists/* /var/log/* + +ADD cmd /.trx-deps/cmd +ADD internal /.trx-deps/internal +ADD go.mod go.sum Taskfile.dist.yaml /.trx-deps/ +ADD scripts /.trx-deps/scripts + +RUN cd /.trx-deps && \ + task build:dist version=base && \ + task verify:dist:binaries version=base && \ + rm -rf /.trx-deps + +RUN git config --global --add safe.directory /git \ No newline at end of file From 2b5124579be520a0e98e0c4d1cbcc8a7beaab05d Mon Sep 17 00:00:00 2001 From: Evgeniy Frolov Date: Tue, 25 Mar 2025 13:44:37 +0300 Subject: [PATCH 2/6] chore(release): update release builder image Signed-off-by: Evgeniy Frolov --- trdl.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trdl.yaml b/trdl.yaml index 39bcf42..440e711 100644 --- a/trdl.yaml +++ b/trdl.yaml @@ -1,4 +1,4 @@ -docker_image: registry-write.werf.io/trx/builder:29fec0a40d0236b70d9f974a4ffa9feab063525c@sha256:a197644941c7597b6ceddcc7037db52bf8db8a65a9c2207063b5e07815670d66 +docker_image: registry-write.werf.io/trx/builder:9745d6219488afe95ed082160598174229d26c19@sha256:97674cb0ef290edf0cb12808cc0a24b9601538bccc046faaa24f037870365bc9 commands: - task build:dist version={{ .Tag }} - task verify:dist:binaries version={{ .Tag }} From 7816f6a6d07cd789daae63573d98826d23d8d3dd Mon Sep 17 00:00:00 2001 From: Evgeniy Frolov Date: Thu, 27 Mar 2025 14:53:28 +0300 Subject: [PATCH 3/6] chore(release): update docker image name Signed-off-by: Evgeniy Frolov --- trdl.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trdl.yaml b/trdl.yaml index 440e711..88eb37b 100644 --- a/trdl.yaml +++ b/trdl.yaml @@ -1,4 +1,4 @@ -docker_image: registry-write.werf.io/trx/builder:9745d6219488afe95ed082160598174229d26c19@sha256:97674cb0ef290edf0cb12808cc0a24b9601538bccc046faaa24f037870365bc9 +docker_image: registry.werf.io/trx/builder:9745d6219488afe95ed082160598174229d26c19@sha256:97674cb0ef290edf0cb12808cc0a24b9601538bccc046faaa24f037870365bc9 commands: - task build:dist version={{ .Tag }} - task verify:dist:binaries version={{ .Tag }} From 3e6172ae2d08591b9fcab58ed753e51989b4d8c5 Mon Sep 17 00:00:00 2001 From: Evgeniy Frolov Date: Fri, 28 Mar 2025 10:01:18 +0300 Subject: [PATCH 4/6] chore(builder): change registry Signed-off-by: Evgeniy Frolov --- Taskfile.dist.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Taskfile.dist.yaml b/Taskfile.dist.yaml index 5b9e762..218c7ca 100644 --- a/Taskfile.dist.yaml +++ b/Taskfile.dist.yaml @@ -206,7 +206,7 @@ tasks: _image:build: cmds: - - docker build {{.CLI_ARGS}} -f "{{.dfilePath}}" -t "{{.imageName}}" "{{.context | default "."}}" + - docker build {{.CLI_ARGS}} --platform=linux/amd64 -f "{{.dfilePath}}" -t "{{.imageName}}" "{{.context | default "."}}" image:build:builder: desc: 'Build main builder image. Important vars: "imageName".' @@ -215,7 +215,7 @@ tasks: vars: dfilePath: scripts/builder/Dockerfile imageName: - sh: "echo registry-write.werf.io/trx/builder:$(git rev-parse HEAD)" + sh: "echo ghcr.io/flant/trx/builder:$(git rev-parse HEAD)" _image:push: cmds: @@ -229,7 +229,7 @@ tasks: - task: _image:push vars: imageName: - sh: "echo registry-write.werf.io/trx/builder:$(git rev-parse HEAD)" + sh: "echo ghcr.io/flant/trx/builder:$(git rev-parse HEAD)" clean: desc: "Clean all temporary files and build artifacts." From 03ad1cf3a4d658dbb6e284eec25ecb9ee80156a1 Mon Sep 17 00:00:00 2001 From: Evgeniy Frolov Date: Fri, 28 Mar 2025 14:07:36 +0300 Subject: [PATCH 5/6] chore(release): update artifact builder image Signed-off-by: Evgeniy Frolov --- Taskfile.dist.yaml | 2 +- trdl.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Taskfile.dist.yaml b/Taskfile.dist.yaml index 218c7ca..733f78a 100644 --- a/Taskfile.dist.yaml +++ b/Taskfile.dist.yaml @@ -206,7 +206,7 @@ tasks: _image:build: cmds: - - docker build {{.CLI_ARGS}} --platform=linux/amd64 -f "{{.dfilePath}}" -t "{{.imageName}}" "{{.context | default "."}}" + - docker build {{.CLI_ARGS}} -f "{{.dfilePath}}" -t "{{.imageName}}" "{{.context | default "."}}" image:build:builder: desc: 'Build main builder image. Important vars: "imageName".' diff --git a/trdl.yaml b/trdl.yaml index 88eb37b..2d91e6a 100644 --- a/trdl.yaml +++ b/trdl.yaml @@ -1,4 +1,4 @@ -docker_image: registry.werf.io/trx/builder:9745d6219488afe95ed082160598174229d26c19@sha256:97674cb0ef290edf0cb12808cc0a24b9601538bccc046faaa24f037870365bc9 +docker_image: docker pull ghcr.io/flant/trx/builder:53607301c1d0b7f6c75e52a5784382abb53ac8ce@sha256:95071741e79de3c075fb2fd7c3fdddc54150f53d3f8fe7867d26ffb39c2e05c0 commands: - task build:dist version={{ .Tag }} - task verify:dist:binaries version={{ .Tag }} From 5afadab774483d772f4b150a89b33005d97110e0 Mon Sep 17 00:00:00 2001 From: Aleksei Igrychev Date: Wed, 2 Apr 2025 00:26:35 +0100 Subject: [PATCH 6/6] Update trdl.yaml --- trdl.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trdl.yaml b/trdl.yaml index 2d91e6a..c38eeb7 100644 --- a/trdl.yaml +++ b/trdl.yaml @@ -1,4 +1,4 @@ -docker_image: docker pull ghcr.io/flant/trx/builder:53607301c1d0b7f6c75e52a5784382abb53ac8ce@sha256:95071741e79de3c075fb2fd7c3fdddc54150f53d3f8fe7867d26ffb39c2e05c0 +dockerImage: ghcr.io/flant/trx/builder:53607301c1d0b7f6c75e52a5784382abb53ac8ce@sha256:95071741e79de3c075fb2fd7c3fdddc54150f53d3f8fe7867d26ffb39c2e05c0 commands: - task build:dist version={{ .Tag }} - task verify:dist:binaries version={{ .Tag }}