diff --git a/.github/workflows/bump-elastic-stack-version.yml b/.github/workflows/bump-elastic-stack-version.yml index 47c2e61ae..21cda7d52 100644 --- a/.github/workflows/bump-elastic-stack-version.yml +++ b/.github/workflows/bump-elastic-stack-version.yml @@ -1,10 +1,10 @@ --- -name: bump-elastic-stack-version +name: Update versions of Elastic Stack dependencies on: workflow_dispatch: schedule: - - cron: '0 15 * * 1-5' + - cron: '0 1 * * 1-5' permissions: contents: read @@ -21,10 +21,28 @@ jobs: - uses: actions/checkout@v4 - name: Install Updatecli in the runner - uses: updatecli/updatecli-action@9a37c7e35598d7b37d8e7568b40ed9538112be01 # v0.76.1 + uses: updatecli/updatecli-action@v2.58.0 # updatecli v0.77.0 - - name: Run Updatecli in Apply mode - # TODO: Change from diff to apply. - run: updatecli diff --config .github/workflows/updatecli.d/bump-elastic-stack-version.yml --values .github/workflows/updatecli.d/scm.yml + - name: Update default stack version + # --experimental needed for commitusingapi option. + run: updatecli --experimental apply --config .github/workflows/updatecli.d/bump-elastic-stack-version.yml --values .github/workflows/updatecli.d/scm.yml env: - GITHUB_TOKEN: ${{ secrets.ECOSYSTEM_USER_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Update latest testing 7.x stack version + # --experimental needed for commitusingapi option. + run: updatecli --experimental apply --config .github/workflows/updatecli.d/bump-latest-7x-version.yml --values .github/workflows/updatecli.d/scm.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Update latest testing stack version + # --experimental needed for commitusingapi option. + run: updatecli --experimental apply --config .github/workflows/updatecli.d/bump-latest-snapshot-version.yml --values .github/workflows/updatecli.d/scm.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Update Package Registry version + # --experimental needed for commitusingapi option. + run: updatecli --experimental apply --config .github/workflows/updatecli.d/bump-package-registry-version.yml --values .github/workflows/updatecli.d/scm.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/updatecli.d/bump-elastic-stack-version.yml b/.github/workflows/updatecli.d/bump-elastic-stack-version.yml index bd9b4335f..f80b01a29 100644 --- a/.github/workflows/updatecli.d/bump-elastic-stack-version.yml +++ b/.github/workflows/updatecli.d/bump-elastic-stack-version.yml @@ -1,10 +1,10 @@ --- -name: Bump elastic-stack versions -pipelineid: 'bump-elastic-stack-version' +name: Bump elastic-stack default version +pipelineid: 'bump-elastic-stack-default-version' actions: default: - title: '[updatecli] update elastic stack version for testing {{ source "latestVersion" }}' + title: '[updatecli] Update default stack version to {{ source "latest8xVersion" }}' kind: github/pullrequest scmid: default spec: @@ -21,20 +21,9 @@ scms: user: '{{ requiredEnv "GITHUB_ACTOR" }}' token: '{{ requiredEnv "GITHUB_TOKEN" }}' commitusingapi: true + branch: main sources: - latestSnapshot: - name: Get latest snapshot build - kind: json - spec: - file: https://storage.googleapis.com/artifacts-api/snapshots/main.json - key: .build_id - latest7xSnapshot: - name: Get latest 7.x snapshot build - kind: json - spec: - file: https://storage.googleapis.com/artifacts-api/snapshots/7.17.json - key: .build_id latest8xVersion: name: Get latest 8.x version kind: file @@ -45,34 +34,10 @@ sources: captureindex: 1 spec: file: https://storage.googleapis.com/artifacts-api/releases/current/8 - latestRegistryVersion: - name: Get latest Package Registry version - kind: json - spec: - file: https://api.github.com/repos/elastic/package-registry/releases/latest - key: .tag_name targets: - update-snapshot: - name: "Update snapshot" - kind: file - sourceid: latestSnapshot - scmid: default - spec: - file: Makefile - matchpattern: '(./scripts/test-stack-command.sh) 8\.[^\s]+-SNAPSHOT' - replacepattern: '$1 {{ source "latestSnapshot" }}-SNAPSHOT' - update-7x-version: - name: "Update 7.x version" - kind: file - sourceid: latest7xSnapshot - scmid: default - spec: - file: Makefile - matchpattern: '(./scripts/test-stack-command.sh) 7\.17\.[^\s]*' - replacepattern: '$1 {{ source "latest7xSnapshot" }}-SNAPSHOT' update-default-version: - name: "Update default version" + name: '[updatecli] Update default stack version to {{ source "latest8xVersion" }}' kind: file sourceid: latest8xVersion scmid: default @@ -80,12 +45,3 @@ targets: file: internal/install/stack_version.go matchpattern: '(DefaultStackVersion =) "[^"]+"' replacepattern: '$1 "{{ source "latest8xVersion" }}"' - update-package-registry-base-image: - name: "Update Package Registry base image" - kind: file - sourceid: latestRegistryVersion - scmid: default - spec: - file: internal/stack/resources.go - matchpattern: '"(docker.elastic.co/package-registry/package-registry):v[0-9\.]+"' - replacepattern: '"$1:{{ source "latestRegistryVersion" }}"' diff --git a/.github/workflows/updatecli.d/bump-latest-7x-version.yml b/.github/workflows/updatecli.d/bump-latest-7x-version.yml new file mode 100644 index 000000000..d943c23b9 --- /dev/null +++ b/.github/workflows/updatecli.d/bump-latest-7x-version.yml @@ -0,0 +1,43 @@ +--- +name: Bump 7.x test version +pipelineid: 'bump-elastic-stack-7x-version' + +actions: + default: + title: '[updatecli] Update 7.x snapshot to {{ source "latest7xSnapshot" }}' + kind: github/pullrequest + scmid: default + spec: + labels: + - automation + - dependency + +scms: + default: + kind: github + spec: + owner: '{{ .scm.owner }}' + repository: '{{ .scm.repository }}' + user: '{{ requiredEnv "GITHUB_ACTOR" }}' + token: '{{ requiredEnv "GITHUB_TOKEN" }}' + commitusingapi: true + branch: main + +sources: + latest7xSnapshot: + name: Get latest 7.x snapshot build + kind: json + spec: + file: https://storage.googleapis.com/artifacts-api/snapshots/7.17.json + key: .build_id + +targets: + update-7x-version: + name: '[updatecli] Update 7.x snapshot to {{ source "latest7xSnapshot" }}' + kind: file + sourceid: latest7xSnapshot + scmid: default + spec: + file: Makefile + matchpattern: '(./scripts/test-stack-command.sh) 7\.17\.[^\s]*' + replacepattern: '$1 {{ source "latest7xSnapshot" }}-SNAPSHOT' diff --git a/.github/workflows/updatecli.d/bump-latest-snapshot-version.yml b/.github/workflows/updatecli.d/bump-latest-snapshot-version.yml new file mode 100644 index 000000000..f0602b740 --- /dev/null +++ b/.github/workflows/updatecli.d/bump-latest-snapshot-version.yml @@ -0,0 +1,43 @@ +--- +name: Bump latest elastic-stack test version +pipelineid: 'bump-latest-elastic-stack-version' + +actions: + default: + title: '[updatecli] Update latest snapshot to {{ source "latestSnapshot" }}' + kind: github/pullrequest + scmid: default + spec: + labels: + - automation + - dependency + +scms: + default: + kind: github + spec: + owner: '{{ .scm.owner }}' + repository: '{{ .scm.repository }}' + user: '{{ requiredEnv "GITHUB_ACTOR" }}' + token: '{{ requiredEnv "GITHUB_TOKEN" }}' + commitusingapi: true + branch: main + +sources: + latestSnapshot: + name: Get latest snapshot build + kind: json + spec: + file: https://storage.googleapis.com/artifacts-api/snapshots/main.json + key: .build_id + +targets: + update-snapshot: + name: '[updatecli] Update latest snapshot to {{ source "latestSnapshot" }}' + kind: file + sourceid: latestSnapshot + scmid: default + spec: + file: Makefile + matchpattern: '(./scripts/test-stack-command.sh) 8\.[^\s]+-SNAPSHOT' + replacepattern: '$1 {{ source "latestSnapshot" }}-SNAPSHOT' diff --git a/.github/workflows/updatecli.d/bump-package-registry-version.yml b/.github/workflows/updatecli.d/bump-package-registry-version.yml new file mode 100644 index 000000000..ad6fb9ff5 --- /dev/null +++ b/.github/workflows/updatecli.d/bump-package-registry-version.yml @@ -0,0 +1,43 @@ +--- +name: Bump Package Registry version +pipelineid: 'bump-package-registry-version' + +actions: + default: + title: '[updatecli] Update Package Registry base image to {{ source "latestRegistryVersion" }}' + kind: github/pullrequest + scmid: default + spec: + labels: + - automation + - dependency + +scms: + default: + kind: github + spec: + owner: '{{ .scm.owner }}' + repository: '{{ .scm.repository }}' + user: '{{ requiredEnv "GITHUB_ACTOR" }}' + token: '{{ requiredEnv "GITHUB_TOKEN" }}' + commitusingapi: true + branch: main + +sources: + latestRegistryVersion: + name: Get latest Package Registry version + kind: json + spec: + file: https://api.github.com/repos/elastic/package-registry/releases/latest + key: .tag_name + +targets: + update-package-registry-base-image: + name: '[updatecli] Update Package Registry base image to {{ source "latestRegistryVersion" }}' + kind: file + sourceid: latestRegistryVersion + scmid: default + spec: + file: internal/stack/resources.go + matchpattern: '"(docker.elastic.co/package-registry/package-registry):v[0-9\.]+"' + replacepattern: '"$1:{{ source "latestRegistryVersion" }}"'