Skip to content

Commit

Permalink
added release check
Browse files Browse the repository at this point in the history
  • Loading branch information
oakrizan committed Dec 21, 2023
1 parent 446ea21 commit 660fff3
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 92 deletions.
166 changes: 83 additions & 83 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,99 +9,99 @@ env:
BUILDX: 1

steps:
- group: "Staging"
key: "staging"

steps:
- label: ":linux: Staging / Ubuntu X86_64 - {{matrix.makefile}}"
key: "build-ubuntu-x86"
command:
- ".buildkite/scripts/build.sh {{matrix.makefile}}"
- ".buildkite/scripts/publish.sh {{matrix.makefile}}"
env:
REPOSITORY: "${STAGING_IMAGE}"
if: build.env("BUILDKITE_PULL_REQUEST") != "false"
notify:
- github_commit_status:
context: "Staging / Ubuntu X86_64"
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
matrix:
setup:
makefile:
- "Makefile"
- "Makefile.debian7"
- "Makefile.debian8"
- "Makefile.debian9"
- "Makefile.debian10"
- "Makefile.debian11"
- "Makefile.debian12"

- label: ":linux: Staging / Ubuntu ARM - Makefile.debian9"
key: "build-ubuntu-arm"
command:
- ".buildkite/scripts/build.sh Makefile.debian9"
- ".buildkite/scripts/publish.sh Makefile.debian9"
env:
REPOSITORY: "${STAGING_IMAGE}"
if: build.env("BUILDKITE_PULL_REQUEST") != "false"
notify:
- github_commit_status:
context: "Staging / Ubuntu ARM"
agents:
provider: "aws"
imagePrefix: "${IMAGE_UBUNTU_ARM_64}"
instanceType: "t4g.large"
# - group: "Staging"
# key: "staging"
#
# steps:
# - label: ":linux: Staging / Ubuntu X86_64 - {{matrix.makefile}}"
# key: "build-ubuntu-x86"
# command:
# - ".buildkite/scripts/build.sh {{matrix.makefile}}"
# - ".buildkite/scripts/publish.sh {{matrix.makefile}}"
# env:
# REPOSITORY: "${STAGING_IMAGE}"
# if: build.env("BUILDKITE_PULL_REQUEST") != "false"
# notify:
# - github_commit_status:
# context: "Staging / Ubuntu X86_64"
# agents:
# provider: "gcp"
# image: "${IMAGE_UBUNTU_X86_64}"
# matrix:
# setup:
# makefile:
# - "Makefile"
# - "Makefile.debian7"
# - "Makefile.debian8"
# - "Makefile.debian9"
# - "Makefile.debian10"
# - "Makefile.debian11"
# - "Makefile.debian12"
#
# - label: ":linux: Staging / Ubuntu ARM - Makefile.debian9"
# key: "build-ubuntu-arm"
# command:
# - ".buildkite/scripts/build.sh Makefile.debian9"
# - ".buildkite/scripts/publish.sh Makefile.debian9"
# env:
# REPOSITORY: "${STAGING_IMAGE}"
# if: build.env("BUILDKITE_PULL_REQUEST") != "false"
# notify:
# - github_commit_status:
# context: "Staging / Ubuntu ARM"
# agents:
# provider: "aws"
# imagePrefix: "${IMAGE_UBUNTU_ARM_64}"
# instanceType: "t4g.large"

- group: "Release"
key: "release"

steps:
- label: ":linux: Release / Ubuntu X86_64 - {{matrix.makefile}}"
key: "release-ubuntu-x86"
command:
- ".buildkite/scripts/build.sh {{matrix.makefile}}"
- ".buildkite/scripts/publish.sh {{matrix.makefile}}"
if: build.branch == "main" || build.branch =~ /^[0-9]+\.[0-9]+$$/
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
matrix:
setup:
makefile:
- "Makefile"
- "Makefile.debian7"
- "Makefile.debian8"
- "Makefile.debian9"
- "Makefile.debian10"
- "Makefile.debian11"
- "Makefile.debian12"
notify:
- github_commit_status:
context: "Release / Ubuntu X86_64"
# - label: ":linux: Release / Ubuntu X86_64 - {{matrix.makefile}}"
# key: "release-ubuntu-x86"
# command:
# - ".buildkite/scripts/build.sh {{matrix.makefile}}"
# - ".buildkite/scripts/publish.sh {{matrix.makefile}}"
# if: build.branch == "main" || build.branch =~ /^[0-9]+\.[0-9]+$$/
# agents:
# provider: "gcp"
# image: "${IMAGE_UBUNTU_X86_64}"
# matrix:
# setup:
# makefile:
# - "Makefile"
# - "Makefile.debian7"
# - "Makefile.debian8"
# - "Makefile.debian9"
# - "Makefile.debian10"
# - "Makefile.debian11"
# - "Makefile.debian12"
# notify:
# - github_commit_status:
# context: "Release / Ubuntu X86_64"

- label: ":linux: Release / Ubuntu ARM - Makefile.debian9"
key: "release-ubuntu-arm"
command:
- ".buildkite/scripts/build.sh Makefile.debian9"
- ".buildkite/scripts/publish.sh Makefile.debian9"
if: build.branch == "main" || build.branch =~ /^[0-9]+\.[0-9]+$$/
agents:
provider: "aws"
imagePrefix: "${IMAGE_UBUNTU_ARM_64}"
instanceType: "t4g.large"
notify:
- github_commit_status:
context: "Release / Ubuntu ARM"
# - label: ":linux: Release / Ubuntu ARM - Makefile.debian9"
# key: "release-ubuntu-arm"
# command:
# - ".buildkite/scripts/build.sh Makefile.debian9"
# - ".buildkite/scripts/publish.sh Makefile.debian9"
# if: build.branch == "main" || build.branch =~ /^[0-9]+\.[0-9]+$$/
# agents:
# provider: "aws"
# imagePrefix: "${IMAGE_UBUNTU_ARM_64}"
# instanceType: "t4g.large"
# notify:
# - github_commit_status:
# context: "Release / Ubuntu ARM"

- label: "Post-Release"
key: "release-post"
command: ".buildkite/scripts/post-release.sh ${GOLANG_VERSION}"
if: build.branch == "main" || build.branch =~ /^[0-9]+\.[0-9]+$$/
depends_on:
- "release-ubuntu-x86"
- "release-ubuntu-arm"
# if: build.branch == "main" || build.branch =~ /^[0-9]+\.[0-9]+$$/
# depends_on:
# - "release-ubuntu-x86"
# - "release-ubuntu-arm"
notify:
- github_commit_status:
context: "Post-release"
Expand Down
10 changes: 10 additions & 0 deletions .buildkite/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,16 @@ tag_Exists() {
fi
}

release_exists() {
local releases=$(retry 3 curl -s -u ${GITHUB_TOKEN_SECRET}:x-oauth-basic https://api.github.com/repos/elastic/${REPO}/releases)
echo ":: RELEASES ::"
echo $releases

if [[ $releases == *"${GOLANG_VERSION}"* ]]; then
echo ":: RELEASE EXISTS! ::"
fi
}

check_is_arm() {
if [[ ${HW_TYPE} == "aarch64" || ${HW_TYPE} == "arm64" ]]; then
is_arm="-arm"
Expand Down
20 changes: 11 additions & 9 deletions .buildkite/scripts/post-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@ git_push_with_auth() {
}

if [[ "${TAG_EXISTS}" == true ]]; then
message="Tag '$TAG' already exists! Exiting Post-release stage."
echo "$message"
buildkite-agent annotate "$message" --style 'warning' --context 'ctx-warn'
# This should return any error but skip the release.
exit 0
release_exists

# message="Tag '$TAG' already exists! Exiting Post-release stage."
# echo "$message"
# buildkite-agent annotate "$message" --style 'warning' --context 'ctx-warn'
# # This should return any error but skip the release.
# exit 0
fi

set_git_config
tag_commit
git_push_with_auth
buildkite-agent annotate "Tag '$TAG' has been created." --style 'success' --context 'ctx-success'
#set_git_config
#tag_commit
#git_push_with_auth
#buildkite-agent annotate "Tag '$TAG' has been created." --style 'success' --context 'ctx-success'

0 comments on commit 660fff3

Please sign in to comment.