From b8a7f6f84bb5761ca4783765d6bf06cca78f2d63 Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Tue, 21 Mar 2023 16:12:54 +0100 Subject: [PATCH 1/7] Move to gcp agent --- .buildkite/pipeline.yml | 4 +--- .buildkite/scripts/release.sh | 7 +++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 91f1c8a3bd..8d96844b35 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -62,6 +62,4 @@ steps: build.tag =~ /^v[0-9]+[.][0-9]+[.][0-9]+$$/ command: ".buildkite/scripts/release.sh" agents: - image: "golang:1.19.5" - cpu: "4" - memory: "16G" + provider: "gcp" diff --git a/.buildkite/scripts/release.sh b/.buildkite/scripts/release.sh index afb3d18f48..7ae9441c68 100755 --- a/.buildkite/scripts/release.sh +++ b/.buildkite/scripts/release.sh @@ -2,6 +2,13 @@ set -euo pipefail +WORKSPACE="$(pwd)" +source .buildkite/scripts/install_deps.sh +source .buildkite/scripts/tooling.sh + +add_bin_path +with_go + echo "--- fetching tags" # Ensure that tags are present so goreleaser can build the changelog from the last release. git rev-parse --is-shallow-repository From c77892e552400fc2da99ec30b4a01dceae85d634 Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Tue, 21 Mar 2023 16:18:12 +0100 Subject: [PATCH 2/7] Test in gcp agent --- .buildkite/pipeline.yml | 4 ++-- .buildkite/scripts/release.sh | 36 ++++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 8d96844b35..4fa07b45cb 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -58,8 +58,8 @@ steps: - label: ":github: Release" key: "release" # build.tag != null && build.branch == "main" - if: | - build.tag =~ /^v[0-9]+[.][0-9]+[.][0-9]+$$/ + #if: | + # build.tag =~ /^v[0-9]+[.][0-9]+[.][0-9]+$$/ command: ".buildkite/scripts/release.sh" agents: provider: "gcp" diff --git a/.buildkite/scripts/release.sh b/.buildkite/scripts/release.sh index 7ae9441c68..6c9448705a 100755 --- a/.buildkite/scripts/release.sh +++ b/.buildkite/scripts/release.sh @@ -16,5 +16,39 @@ git fetch origin --tags echo "--- running goreleaser" # Run latest version of goreleaser -curl -sL https://git.io/goreleaser | bash +# curl -sL https://git.io/goreleaser | bash +TAR_FILE="/tmp/goreleaser.tar.gz" +RELEASES_URL="https://github.com/goreleaser/goreleaser/releases" +# test -z "$TMPDIR" && TMPDIR="$(mktemp -d)" +TARGET_DIR="${WORKSPACE}/bin" + +last_version() { + curl -sL -o /dev/null -w %{url_effective} "$RELEASES_URL/latest" | + rev | + cut -f1 -d'/'| + rev +} + +download() { + test -z "$VERSION" && VERSION="$(last_version)" + test -z "$VERSION" && { + echo "Unable to get goreleaser version." >&2 + exit 1 + } + rm -f "$TAR_FILE" + curl -s -L -o "$TAR_FILE" \ + "$RELEASES_URL/download/$VERSION/goreleaser_$(uname -s)_$(uname -m).tar.gz" +} + +download +tar -xf "$TAR_FILE" -C "${TARGET_DIR}" + +rm ${TARGET_FILE} +chmod u+x ${TARGET_DIR}/goreleaser + +# build +goreleaser build + +# release skip +goreleaser release --skip-publish From edfee9f05965d206bd9bade9d656d9d3a315a78c Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Tue, 21 Mar 2023 16:18:59 +0100 Subject: [PATCH 3/7] Remove temporarily integration tests --- .buildkite/pipeline.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 4fa07b45cb..7963988d49 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -35,15 +35,15 @@ steps: - wait: ~ continue_on_failure: true - - label: ":pipeline: Trigger Integration tests" - command: ".buildkite/pipeline.trigger.integration.tests.sh | buildkite-agent pipeline upload" - depends_on: - - step: check-static - allow_failure: false - - step: unit-tests-linux - allow_failure: false - - step: unit-tests-windows - allow_failure: false + # - label: ":pipeline: Trigger Integration tests" + # command: ".buildkite/pipeline.trigger.integration.tests.sh | buildkite-agent pipeline upload" + # depends_on: + # - step: check-static + # allow_failure: false + # - step: unit-tests-linux + # allow_failure: false + # - step: unit-tests-windows + # allow_failure: false - wait: ~ continue_on_failure: true From ea91b5c8497805c05fefdd152e6a3eb9b930a272 Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Tue, 21 Mar 2023 16:29:26 +0100 Subject: [PATCH 4/7] Add variable --- .buildkite/scripts/release.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.buildkite/scripts/release.sh b/.buildkite/scripts/release.sh index 6c9448705a..b071190fb5 100755 --- a/.buildkite/scripts/release.sh +++ b/.buildkite/scripts/release.sh @@ -3,6 +3,7 @@ set -euo pipefail WORKSPACE="$(pwd)" +VERSION="" source .buildkite/scripts/install_deps.sh source .buildkite/scripts/tooling.sh From bf4ec129ac690dbaaab43394fe5bf0193b93e781 Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Tue, 21 Mar 2023 16:40:39 +0100 Subject: [PATCH 5/7] Rename var --- .buildkite/pipeline.yml | 12 ++++++------ .buildkite/scripts/release.sh | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 7963988d49..f32f15ad53 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -25,12 +25,12 @@ steps: cpu: "8" memory: "4G" - - label: ":go: :windows: Run unit tests" - key: unit-tests-windows - command: ".buildkite/scripts/unit_tests_windows.ps1" - agents: - provider: "gcp" - image: "family/ci-windows-2022" + # - label: ":go: :windows: Run unit tests" + # key: unit-tests-windows + # command: ".buildkite/scripts/unit_tests_windows.ps1" + # agents: + # provider: "gcp" + # image: "family/ci-windows-2022" - wait: ~ continue_on_failure: true diff --git a/.buildkite/scripts/release.sh b/.buildkite/scripts/release.sh index b071190fb5..1c89ca7508 100755 --- a/.buildkite/scripts/release.sh +++ b/.buildkite/scripts/release.sh @@ -45,7 +45,7 @@ download() { download tar -xf "$TAR_FILE" -C "${TARGET_DIR}" -rm ${TARGET_FILE} +rm ${TAR_FILE} chmod u+x ${TARGET_DIR}/goreleaser # build From 63261325b4b37d96a1c5f1d5b4ce0b8a18085b1d Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Tue, 21 Mar 2023 16:48:00 +0100 Subject: [PATCH 6/7] Change workspace --- .buildkite/scripts/install_deps.sh | 1 + .buildkite/scripts/release.sh | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.buildkite/scripts/install_deps.sh b/.buildkite/scripts/install_deps.sh index e8de610df9..33c408a4c1 100755 --- a/.buildkite/scripts/install_deps.sh +++ b/.buildkite/scripts/install_deps.sh @@ -5,6 +5,7 @@ set -euo pipefail source .buildkite/scripts/tooling.sh add_bin_path(){ + mkdir -p ${WORKSPACE}/bin export PATH="${WORKSPACE}/bin:${PATH}" } diff --git a/.buildkite/scripts/release.sh b/.buildkite/scripts/release.sh index 1c89ca7508..55c1b0ee89 100755 --- a/.buildkite/scripts/release.sh +++ b/.buildkite/scripts/release.sh @@ -2,7 +2,13 @@ set -euo pipefail -WORKSPACE="$(pwd)" +cleanup() { + rm -rf ${WORKSPACE} +} +trap cleanup exit + +WORKSPACE="/tmp/bin-buildkite/" + VERSION="" source .buildkite/scripts/install_deps.sh source .buildkite/scripts/tooling.sh @@ -48,8 +54,7 @@ tar -xf "$TAR_FILE" -C "${TARGET_DIR}" rm ${TAR_FILE} chmod u+x ${TARGET_DIR}/goreleaser -# build -goreleaser build +git status # release skip -goreleaser release --skip-publish +goreleaser release --skip-publish --snapshot From ac83e7c60c519ea707f49deb14ec64fc7036f6a2 Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Tue, 21 Mar 2023 17:11:41 +0100 Subject: [PATCH 7/7] Restore pipeline and release step --- .buildkite/pipeline.yml | 35 +++++++++++++++++----------------- .buildkite/scripts/release.sh | 36 +---------------------------------- 2 files changed, 18 insertions(+), 53 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index f32f15ad53..67c2f32e78 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -25,25 +25,25 @@ steps: cpu: "8" memory: "4G" - # - label: ":go: :windows: Run unit tests" - # key: unit-tests-windows - # command: ".buildkite/scripts/unit_tests_windows.ps1" - # agents: - # provider: "gcp" - # image: "family/ci-windows-2022" + - label: ":go: :windows: Run unit tests" + key: unit-tests-windows + command: ".buildkite/scripts/unit_tests_windows.ps1" + agents: + provider: "gcp" + image: "family/ci-windows-2022" - wait: ~ continue_on_failure: true - # - label: ":pipeline: Trigger Integration tests" - # command: ".buildkite/pipeline.trigger.integration.tests.sh | buildkite-agent pipeline upload" - # depends_on: - # - step: check-static - # allow_failure: false - # - step: unit-tests-linux - # allow_failure: false - # - step: unit-tests-windows - # allow_failure: false + - label: ":pipeline: Trigger Integration tests" + command: ".buildkite/pipeline.trigger.integration.tests.sh | buildkite-agent pipeline upload" + depends_on: + - step: check-static + allow_failure: false + - step: unit-tests-linux + allow_failure: false + - step: unit-tests-windows + allow_failure: false - wait: ~ continue_on_failure: true @@ -57,9 +57,8 @@ steps: - label: ":github: Release" key: "release" - # build.tag != null && build.branch == "main" - #if: | - # build.tag =~ /^v[0-9]+[.][0-9]+[.][0-9]+$$/ + if: | + build.tag =~ /^v[0-9]+[.][0-9]+[.][0-9]+$$/ command: ".buildkite/scripts/release.sh" agents: provider: "gcp" diff --git a/.buildkite/scripts/release.sh b/.buildkite/scripts/release.sh index 55c1b0ee89..e015bac306 100755 --- a/.buildkite/scripts/release.sh +++ b/.buildkite/scripts/release.sh @@ -23,38 +23,4 @@ git fetch origin --tags echo "--- running goreleaser" # Run latest version of goreleaser -# curl -sL https://git.io/goreleaser | bash - -TAR_FILE="/tmp/goreleaser.tar.gz" -RELEASES_URL="https://github.com/goreleaser/goreleaser/releases" -# test -z "$TMPDIR" && TMPDIR="$(mktemp -d)" -TARGET_DIR="${WORKSPACE}/bin" - -last_version() { - curl -sL -o /dev/null -w %{url_effective} "$RELEASES_URL/latest" | - rev | - cut -f1 -d'/'| - rev -} - -download() { - test -z "$VERSION" && VERSION="$(last_version)" - test -z "$VERSION" && { - echo "Unable to get goreleaser version." >&2 - exit 1 - } - rm -f "$TAR_FILE" - curl -s -L -o "$TAR_FILE" \ - "$RELEASES_URL/download/$VERSION/goreleaser_$(uname -s)_$(uname -m).tar.gz" -} - -download -tar -xf "$TAR_FILE" -C "${TARGET_DIR}" - -rm ${TAR_FILE} -chmod u+x ${TARGET_DIR}/goreleaser - -git status - -# release skip -goreleaser release --skip-publish --snapshot +curl -sL https://git.io/goreleaser | bash