diff --git a/.ci/bump-golang.yml b/.buildkite/.ci/bumb-golang.yml similarity index 100% rename from .ci/bump-golang.yml rename to .buildkite/.ci/bumb-golang.yml diff --git a/.ci/scripts/install-go.bat b/.buildkite/.ci/scripts/install-go.bat old mode 100755 new mode 100644 similarity index 99% rename from .ci/scripts/install-go.bat rename to .buildkite/.ci/scripts/install-go.bat index 29448bd4f63..edcc30f894c --- a/.ci/scripts/install-go.bat +++ b/.buildkite/.ci/scripts/install-go.bat @@ -54,4 +54,4 @@ IF ERRORLEVEL 1 ( IF ERRORLEVEL 1 ( exit /b 1 ) -) +) \ No newline at end of file diff --git a/.ci/scripts/install-go.sh b/.buildkite/.ci/scripts/install-go.sh old mode 100755 new mode 100644 similarity index 96% rename from .ci/scripts/install-go.sh rename to .buildkite/.ci/scripts/install-go.sh index 31566c08726..ebdf6e4a308 --- a/.ci/scripts/install-go.sh +++ b/.buildkite/.ci/scripts/install-go.sh @@ -40,4 +40,4 @@ chmod +x "${GVM_CMD}" ${GVM_CMD} "${GO_VERSION}" |cut -d ' ' -f 2|tr -d '\"' > ${PROPERTIES_FILE} -eval "$("${GVM_CMD}" "${GO_VERSION}")" +eval "$("${GVM_CMD}" "${GO_VERSION}")" \ No newline at end of file diff --git a/.ci/jobs/defaults.yml b/.ci/jobs/defaults.yml deleted file mode 100644 index a2bcaae57e1..00000000000 --- a/.ci/jobs/defaults.yml +++ /dev/null @@ -1,19 +0,0 @@ - ---- - -##### GLOBAL METADATA - -- meta: - cluster: fleet-ci - -##### JOB DEFAULTS - -- job: - logrotate: - numToKeep: 20 - node: linux - concurrent: true - publishers: - - email: - recipients: infra-root+build@elastic.co - prune-dead-branches: true diff --git a/.ci/jobs/elastic-agent-mbp.yml b/.ci/jobs/elastic-agent-mbp.yml deleted file mode 100644 index 8947d15880a..00000000000 --- a/.ci/jobs/elastic-agent-mbp.yml +++ /dev/null @@ -1,43 +0,0 @@ ---- -- job: - name: "elastic-agent/elastic-agent-mbp" - display-name: elastic-agent - description: "Elastic agent" - project-type: multibranch - script-path: .ci/Jenkinsfile - scm: - - github: - branch-discovery: no-pr - discover-pr-forks-strategy: merge-current - discover-pr-forks-trust: permission - discover-pr-origin: merge-current - discover-tags: true - head-filter-regex: '(main|7\.17|8\.\d+|PR-.*|v\d+\.\d+\.\d+)' - notification-context: 'fleet-ci' - repo: elastic-agent - repo-owner: elastic - credentials-id: 2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken - ssh-checkout: - credentials: f6c7695a-671e-4f4f-a331-acdce44ff9ba - build-strategies: - - tags: - ignore-tags-older-than: -1 - ignore-tags-newer-than: -1 - - regular-branches: true - - change-request: - ignore-target-only-changes: true - clean: - after: true - before: true - prune: true - shallow-clone: true - depth: 4 - do-not-fetch-tags: true - submodule: - disable: false - recursive: true - parent-credentials: true - timeout: 100 - timeout: '15' - use-author: true - wipe-workspace: true diff --git a/.ci/jobs/elastic-agent-schedule-daily.yml b/.ci/jobs/elastic-agent-schedule-daily.yml deleted file mode 100644 index 2fd728a9e8c..00000000000 --- a/.ci/jobs/elastic-agent-schedule-daily.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- job: - name: "elastic-agent/elastic-agent-schedule-daily" - display-name: Jobs scheduled daily (weekdays) - description: Jobs scheduled daily (weekdays) - view: Beats - project-type: pipeline - parameters: - - string: - name: branch_specifier - default: main - description: the Git branch specifier to build - pipeline-scm: - script-path: .ci/schedule-daily.groovy - scm: - - git: - url: git@github.com:elastic/elastic-agent.git - refspec: +refs/heads/*:refs/remotes/origin/* - wipe-workspace: 'True' - name: origin - shallow-clone: true - credentials-id: f6c7695a-671e-4f4f-a331-acdce44ff9ba - branches: - - $branch_specifier - triggers: - - timed: 'H H(2-3) * * 1-5' diff --git a/.ci/jobs/folders.yml b/.ci/jobs/folders.yml deleted file mode 100644 index cf309e259a3..00000000000 --- a/.ci/jobs/folders.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- job: - name: "elastic-agent" - description: "Elastic Agent" - project-type: folder diff --git a/.ci/schedule-daily.groovy b/.ci/schedule-daily.groovy deleted file mode 100644 index 70ad931ecda..00000000000 --- a/.ci/schedule-daily.groovy +++ /dev/null @@ -1,48 +0,0 @@ -@Library('apm@current') _ - -pipeline { - agent none - environment { - NOTIFY_TO = credentials('notify-to') - PIPELINE_LOG_LEVEL = 'INFO' - } - options { - timeout(time: 1, unit: 'HOURS') - buildDiscarder(logRotator(numToKeepStr: '20', artifactNumToKeepStr: '20')) - timestamps() - ansiColor('xterm') - disableResume() - durabilityHint('PERFORMANCE_OPTIMIZED') - } - triggers { - cron('H H(2-3) * * 1-5') - } - stages { - stage('Nighly beats builds') { - steps { - runBuilds(quietPeriodFactor: 2000, branches: ['main', '8.', '8.']) - } - } - } - post { - cleanup { - notifyBuildResult(prComment: false) - } - } -} - -def runBuilds(Map args = [:]) { - def branches = getBranchesFromAliases(aliases: args.branches) - def quietPeriod = 0 - branches.each { branch -> - build(quietPeriod: quietPeriod, - job: "elastic-agent/elastic-agent-mbp/${branch}", - parameters: [ - booleanParam(name: 'integration_tests_ci', value: true), - // Disable running e2e until we fix the 2e2 testing suite - booleanParam(name: 'end_to_end_tests_ci', value: false) - ], - wait: false, propagate: false) - quietPeriod += args.quietPeriodFactor - } -} diff --git a/.github/updatecli-bump-golang.yml b/.github/updatecli-bump-golang.yml new file mode 100644 index 00000000000..df5d8104048 --- /dev/null +++ b/.github/updatecli-bump-golang.yml @@ -0,0 +1,135 @@ +# update-cli configuration for automated go updates +--- +name: Bump golang-version to latest version + +scms: + githubConfig: + kind: github + spec: + user: '{{ requiredEnv "GIT_USER" }}' + email: '{{ requiredEnv "GIT_EMAIL" }}' + owner: elastic + repository: elastic-agent + token: '{{ requiredEnv "GITHUB_TOKEN" }}' + username: '{{ requiredEnv "GIT_USER" }}' + branch: main + +actions: + elastic-agent: + kind: github/pullrequest + scmid: githubConfig + sourceid: latestGoVersion + spec: + automerge: false + labels: + - dependencies + - backport-skip + title: '[Automation] Bump Golang version to {{ source "latestGoVersion" }}' + description: | + It requires the version to be bumped first in golang-crossbuild project, then a new release will be added to: + https://github.com/elastic/golang-crossbuild/releases/tag/v{{ source "latestGoVersion" }}. + Otherwise it will fail until the docker images are available. + +sources: + minor: + name: Get minor version in .go-version + kind: shell + transformers: + - findsubmatch: + pattern: '^\d+.(\d+).\d+$' + captureindex: 1 + spec: + command: cat .go-version + + latestGoVersion: + name: Get Latest Go Release + kind: githubrelease + dependson: + - minor + transformers: + - trimprefix: go + spec: + owner: golang + repository: go + token: '{{ requiredEnv "GITHUB_TOKEN" }}' + username: '{{ requiredEnv "GIT_USER" }}' + versionfilter: + kind: regex + pattern: go1\.{{ source "minor" }}\.(\d*)$ + + gomod: + dependson: + - latestGoVersion + name: Get version in go.mod format + kind: shell + transformers: + - findsubmatch: + pattern: '^(\d+.\d+).\d+' + captureindex: 1 + spec: + command: echo {{ source "latestGoVersion" }} + +conditions: + dockerTag: + name: Is docker image golang:{{ source "latestGoVersion" }} published + kind: dockerimage + spec: + image: golang + tag: '{{ source "latestGoVersion" }}' + sourceid: latestGoVersion + + goDefaultVersion-check: + name: Check if defined golang version differs + kind: shell + sourceid: latestGoVersion + spec: + command: 'grep -v -q {{ source "latestGoVersion" }} .go-version #' + +targets: + update-go-version: + name: "Update .go-version" + sourceid: latestGoVersion + scmid: githubConfig + kind: file + spec: + content: '{{ source "latestGoVersion" }}' + file: .go-version + matchpattern: '\d+.\d+.\d+' + update-golang.ci: + name: "Update .golangci.yml" + sourceid: latestGoVersion + scmid: githubConfig + kind: file + spec: + content: '{{ source "latestGoVersion" }}' + file: .golangci.yml + matchpattern: '\d+.\d+.\d+' + update-version.asciidoc: + name: "Update version.asciidoc" + sourceid: latestGoVersion + scmid: githubConfig + kind: file + spec: + content: ':go-version: {{ source "latestGoVersion" }}' + file: version/docs/version.asciidoc + matchpattern: ':go-version: \d+.\d+.\d+' + update-dockerfiles: + name: "Update from dockerfiles" + sourceid: latestGoVersion + scmid: githubConfig + kind: file + spec: + content: 'ARG GO_VERSION={{ source "latestGoVersion" }}' + files: + - Dockerfile + - Dockerfile.skaffold + matchpattern: 'ARG GO_VERSION=\d+.\d+.\d+' + update-gomod: + name: "Update go.mod" + sourceid: gomod + scmid: githubConfig + kind: file + spec: + content: 'go {{ source "gomod" }}' + file: go.mod + matchpattern: 'go \d+.\d+' diff --git a/.github/workflows/bump-golang.yml b/.github/workflows/bump-golang.yml index 30b8fbd89b3..34d488b9d72 100644 --- a/.github/workflows/bump-golang.yml +++ b/.github/workflows/bump-golang.yml @@ -4,7 +4,7 @@ name: bump-golang on: workflow_dispatch: schedule: - - cron: '0 20 * * 6' + - cron: "0 20 * * 6" permissions: contents: read @@ -13,7 +13,6 @@ jobs: bump: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - uses: elastic/apm-pipeline-library/.github/actions/updatecli@current @@ -21,4 +20,4 @@ jobs: vaultUrl: ${{ secrets.VAULT_ADDR }} vaultRoleId: ${{ secrets.VAULT_ROLE_ID }} vaultSecretId: ${{ secrets.VAULT_SECRET_ID }} - pipeline: ./.ci/bump-golang.yml + pipeline: ./.github/updatecli-bump-golang.yml