From 898d6f9a02f4fdcc4a670e1b28c6907479f2c45e Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Sep 2025 22:49:24 +0200 Subject: [PATCH 1/2] ci: use gh actions instead --- .buildkite/hooks/post-checkout | 53 ----------------- .buildkite/hooks/pre-command | 18 ------ .buildkite/hooks/pre-exit | 7 --- .buildkite/pipeline.yml | 70 ----------------------- .buildkite/pull-requests.json | 20 ------- .buildkite/scripts/build.sh | 10 ---- .buildkite/scripts/pre-install-command.sh | 44 -------------- .buildkite/scripts/prepare-report.sh | 12 ---- .buildkite/scripts/release.sh | 12 ---- .buildkite/scripts/snapshot.sh | 12 ---- .buildkite/scripts/test.sh | 15 ----- .buildkite/scripts/tooling.sh | 21 ------- catalog-info.yaml | 48 ---------------- 13 files changed, 342 deletions(-) delete mode 100644 .buildkite/hooks/post-checkout delete mode 100644 .buildkite/hooks/pre-command delete mode 100644 .buildkite/hooks/pre-exit delete mode 100644 .buildkite/pipeline.yml delete mode 100644 .buildkite/pull-requests.json delete mode 100644 .buildkite/scripts/build.sh delete mode 100755 .buildkite/scripts/pre-install-command.sh delete mode 100755 .buildkite/scripts/prepare-report.sh delete mode 100644 .buildkite/scripts/release.sh delete mode 100755 .buildkite/scripts/snapshot.sh delete mode 100755 .buildkite/scripts/test.sh delete mode 100755 .buildkite/scripts/tooling.sh diff --git a/.buildkite/hooks/post-checkout b/.buildkite/hooks/post-checkout deleted file mode 100644 index e10f15d..0000000 --- a/.buildkite/hooks/post-checkout +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -checkout_merge() { - local target_branch=$1 - local pr_commit=$2 - local merge_branch=$3 - - if [[ -z "${target_branch}" ]]; then - echo "No pull request target branch" - exit 1 - fi - - git fetch -v origin "${target_branch}" - git checkout FETCH_HEAD - echo "Current branch: $(git rev-parse --abbrev-ref HEAD)" - - # create temporal branch to merge the PR with the target branch - git checkout -b ${merge_branch} - echo "New branch created: $(git rev-parse --abbrev-ref HEAD)" - - # set author identity so it can be run git merge - git config user.name "github-merged-pr-post-checkout" - git config user.email "auto-merge@buildkite" - - git merge --no-edit "${BUILDKITE_COMMIT}" || { - local merge_result=$? - echo "Merge failed: ${merge_result}" - git merge --abort - exit ${merge_result} - } -} - -pull_request="${BUILDKITE_PULL_REQUEST:-false}" - -if [[ "${pull_request}" == "false" ]]; then - echo "Not a pull request, skipping" - exit 0 -fi - -TARGET_BRANCH="${BUILDKITE_PULL_REQUEST_BASE_BRANCH:-master}" -PR_COMMIT="${BUILDKITE_COMMIT}" -PR_ID=${BUILDKITE_PULL_REQUEST} -MERGE_BRANCH="pr_merge_${PR_ID}" - -checkout_merge "${TARGET_BRANCH}" "${PR_COMMIT}" "${MERGE_BRANCH}" - -echo "Commit information" -git --no-pager log --format=%B -n 1 - -# Ensure buildkite groups are rendered -echo "" diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command deleted file mode 100644 index de49648..0000000 --- a/.buildkite/hooks/pre-command +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -echo "Golang version:" -version=$(cat .go-version) -export GO_VERSION="${version}" -echo "${GO_VERSION}" - -source .buildkite/scripts/tooling.sh - -DOCKER_REGISTRY_SECRET_PATH="kv/ci-shared/platform-ingest/docker_registry_prod" -if [[ "$BUILDKITE_PIPELINE_SLUG" == "elastic-agent-changelog-tool" && "$BUILDKITE_STEP_KEY" == "snapshot" ]] || \ - [[ "$BUILDKITE_PIPELINE_SLUG" == "elastic-agent-changelog-tool" && "$BUILDKITE_STEP_KEY" == "release" ]]; then - DOCKER_USERNAME_SECRET=$(retry 5 vault kv get -field user "${DOCKER_REGISTRY_SECRET_PATH}") - DOCKER_PASSWORD_SECRET=$(retry 5 vault kv get -field password "${DOCKER_REGISTRY_SECRET_PATH}") - docker login -u "${DOCKER_USERNAME_SECRET}" -p "${DOCKER_PASSWORD_SECRET}" "${DOCKER_REGISTRY}" 2>/dev/null -fi diff --git a/.buildkite/hooks/pre-exit b/.buildkite/hooks/pre-exit deleted file mode 100644 index 453f14e..0000000 --- a/.buildkite/hooks/pre-exit +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -euo pipefail - -if [[ "$BUILDKITE_PIPELINE_SLUG" == "elastic-agent-changelog-tool" && "$BUILDKITE_STEP_KEY" == "snapshot" ]] || \ - [[ "$BUILDKITE_PIPELINE_SLUG" == "elastic-agent-changelog-tool" && "$BUILDKITE_STEP_KEY" == "release" ]]; then - docker logout ${DOCKER_REGISTRY} -fi diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml deleted file mode 100644 index e54a5e1..0000000 --- a/.buildkite/pipeline.yml +++ /dev/null @@ -1,70 +0,0 @@ -# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json -env: - GVM: 'v0.5.0' - DOCKER_REGISTRY: 'docker.elastic.co' -steps: - - label: ":buildkite: Build" - command: - - ".buildkite/scripts/build.sh" - agents: - image: golang:${GO_VERSION} - cpu: "8" - memory: "4G" - - - label: ":linux: Test on linux" - key: test - command: - - ".buildkite/scripts/test.sh" - agents: - image: golang:${GO_VERSION} - cpu: "8" - memory: "4G" - artifact_paths: - - "tests-report.txt" - - - label: ":buildkite: Prepare reports" - key: prepare-report - command: - - ".buildkite/scripts/prepare-report.sh" - agents: - image: golang:${GO_VERSION} - cpu: "8" - memory: "4G" - artifact_paths: - - "junit-*.xml" - depends_on: - - step: "test" - allow_failure: true - - - label: ":junit: Junit annotate" - plugins: - - junit-annotate#v2.4.1: - artifacts: "junit-*.xml" - fail-build-on-error: true - agents: - provider: "gcp" #junit plugin requires docker - depends_on: - - step: "prepare-report" - allow_failure: true - - - label: ":buildkite: Snapshot" - if: build.tag == null - key: snapshot - command: - - ".buildkite/scripts/snapshot.sh" - agents: - provider: "gcp" - depends_on: - - step: "test" - allow_failure: false - - - label: ":buildkite: Release" - if: build.tag =~ /^v\d+\.\d+\.\d+.*$$/ - key: release - command: - - ".buildkite/scripts/release.sh" - agents: - provider: "gcp" - depends_on: - - step: "test" - allow_failure: false diff --git a/.buildkite/pull-requests.json b/.buildkite/pull-requests.json deleted file mode 100644 index 7b9ca4d..0000000 --- a/.buildkite/pull-requests.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "jobs": [ - { - "enabled": true, - "pipelineSlug": "elastic-agent-changelog-tool", - "allow_org_users": true, - "allowed_repo_permissions": ["admin", "write"], - "allowed_list": [ ], - "set_commit_status": true, - "build_on_commit": true, - "build_on_comment": true, - "trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:build|test)\\W+(?:this|it))|^/test$", - "always_trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:build|test)\\W+(?:this|it))|^/test$", - "skip_ci_labels": [ ], - "skip_target_branches": [ ], - "skip_ci_on_only_changed": [ ], - "always_require_ci_on_changed": [ ] - } - ] - } diff --git a/.buildkite/scripts/build.sh b/.buildkite/scripts/build.sh deleted file mode 100644 index 4067e4f..0000000 --- a/.buildkite/scripts/build.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -echo "--- Pre install" -source .buildkite/scripts/pre-install-command.sh -add_bin_path - -echo "--- Go build" -go build diff --git a/.buildkite/scripts/pre-install-command.sh b/.buildkite/scripts/pre-install-command.sh deleted file mode 100755 index feee8eb..0000000 --- a/.buildkite/scripts/pre-install-command.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -set -euo pipefail - -source .buildkite/scripts/tooling.sh - -add_bin_path(){ - mkdir -p "${WORKSPACE}/bin" - export PATH="${WORKSPACE}/bin:${PATH}" -} - -with_go_junit_report() { - go install github.com/jstemmer/go-junit-report/v2@latest -} - -with_goreleaser() { - go install github.com/goreleaser/goreleaser@v1.6.3 -} - -with_go() { - go_version=$1 - url=$(get_gvm_link "${GVM}") - retry 5 curl -sL -o "${WORKSPACE}/bin/gvm" "${url}" - chmod +x "${WORKSPACE}/bin/gvm" - ls ${WORKSPACE}/bin/ -l - eval "$(gvm $go_version)" - go_path="$(go env GOPATH):$(go env GOPATH)/bin" - export PATH="${PATH}:${go_path}" - go version -} - -# for gvm link -get_gvm_link() { - gvm_version=$1 - platform_type="$(uname)" - platform_type_lowercase="${platform_type,,}" - arch_type="$(uname -m)" - [[ ${arch_type} == "aarch64" ]] && arch_type="arm64" # gvm do not have 'aarch64' name for archetecture type - [[ ${arch_type} == "x86_64" ]] && arch_type="amd64" - echo "https://github.com/andrewkroh/gvm/releases/download/${gvm_version}/gvm-${platform_type_lowercase}-${arch_type}" -} - -# Required env variables: -# WORKSPACE -WORKSPACE=${WORKSPACE:-"$(pwd)"} diff --git a/.buildkite/scripts/prepare-report.sh b/.buildkite/scripts/prepare-report.sh deleted file mode 100755 index 26cfd9e..0000000 --- a/.buildkite/scripts/prepare-report.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -echo "--- Pre install" -source .buildkite/scripts/pre-install-command.sh -add_bin_path -with_go_junit_report - -# Create Junit report for junit annotation plugin -buildkite-agent artifact download tests-report.txt . --step test -go-junit-report > junit-report.xml < tests-report.txt diff --git a/.buildkite/scripts/release.sh b/.buildkite/scripts/release.sh deleted file mode 100644 index bf92809..0000000 --- a/.buildkite/scripts/release.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -echo "--- Pre install" -source .buildkite/scripts/pre-install-command.sh -add_bin_path -with_go "${GO_VERSION}" -with_goreleaser - -echo "--- Goreleaser Release" -goreleaser release diff --git a/.buildkite/scripts/snapshot.sh b/.buildkite/scripts/snapshot.sh deleted file mode 100755 index 89f5918..0000000 --- a/.buildkite/scripts/snapshot.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -echo "--- Pre install" -source .buildkite/scripts/pre-install-command.sh -add_bin_path -with_go "${GO_VERSION}" -with_goreleaser - -echo "--- Goreleaser Snapshot" -goreleaser release --snapshot diff --git a/.buildkite/scripts/test.sh b/.buildkite/scripts/test.sh deleted file mode 100755 index aef3173..0000000 --- a/.buildkite/scripts/test.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -echo "--- Test" -set +e -go test -v ./... > tests-report.txt -exit_code=$? -set -e - -# Buildkite collapse logs under --- symbols -# need to change --- to anything else or switch off collapsing (note: not available at the moment of this commit) -awk '{gsub("---", "----"); print }' tests-report.txt - -exit $exit_code diff --git a/.buildkite/scripts/tooling.sh b/.buildkite/scripts/tooling.sh deleted file mode 100755 index 49dedab..0000000 --- a/.buildkite/scripts/tooling.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -retry() { - local retries=$1 - shift - - local count=0 - until "$@"; do - exit=$? - wait=$((2 ** count)) - count=$((count + 1)) - if [ $count -lt "$retries" ]; then - >&2 echo "Retry $count/$retries exited $exit, retrying in $wait seconds..." - sleep $wait - else - >&2 echo "Retry $count/$retries exited $exit, no more retries left." - return $exit - fi - done - return 0 -} diff --git a/catalog-info.yaml b/catalog-info.yaml index ae61dfb..f5a86ba 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -12,51 +12,3 @@ spec: owner: group:ingest-fp system: platform-ingest lifecycle: production - ---- -# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/e57ee3bed7a6f73077a3f55a38e76e40ec87a7cf/rre.schema.json -apiVersion: backstage.io/v1alpha1 -kind: Resource -metadata: - name: buildkite-pipeline-elastic-agent-changelog-tool - description: Buildkite pipeline for the elastic-agent-changelog-tool project - links: - - title: Pipeline - url: https://buildkite.com/elastic/elastic-agent-changelog-tool - -spec: - type: buildkite-pipeline - owner: group:ingest-fp - system: platform-ingest - implementation: - apiVersion: buildkite.elastic.dev/v1 - kind: Pipeline - metadata: - name: elastic-agent-changelog-tool - description: Buildkite pipeline for the elastic-agent-changelog-tool project - spec: - branch_configuration: "main v0.*" - repository: elastic/elastic-agent-changelog-tool - pipeline_file: ".buildkite/pipeline.yml" - provider_settings: - build_pull_request_forks: false - build_pull_requests: true # requires filter_enabled and filter_condition settings as below when used with buildkite-pr-bot - build_tags: true - filter_enabled: true - filter_condition: >- - build.pull_request.id == null || (build.creator.name == 'elasticmachine' && build.pull_request.id != null) - cancel_intermediate_builds: true - cancel_intermediate_builds_branch_filter: '!main' - skip_intermediate_builds: true - skip_intermediate_builds_branch_filter: '!main' - env: - ELASTIC_PR_COMMENTS_ENABLED: "true" - ELASTIC_SLACK_NOTIFICATIONS_ENABLED: "true" - SLACK_NOTIFICATIONS_CHANNEL: "#ingest-notifications" - SLACK_NOTIFICATIONS_ALL_BRANCHES: "true" - SLACK_NOTIFICATIONS_ON_SUCCESS: "true" - teams: - ingest-fp: - access_level: MANAGE_BUILD_AND_READ - everyone: - access_level: READ_ONLY From 1b27b89ff99a1ce8bec2ffe97ce2a1861e0a3256 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Sep 2025 22:49:52 +0200 Subject: [PATCH 2/2] remove --- .go-version | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .go-version diff --git a/.go-version b/.go-version deleted file mode 100644 index f124bfa..0000000 --- a/.go-version +++ /dev/null @@ -1 +0,0 @@ -1.21.9