diff --git a/.ci/update-specs.yml b/.ci/update-specs.yml deleted file mode 100644 index 42b7211..0000000 --- a/.ci/update-specs.yml +++ /dev/null @@ -1,57 +0,0 @@ ---- -name: update specs - -scms: - githubConfig: - kind: github - spec: - user: '{{ requiredEnv "GITHUB_ACTOR" }}' - owner: elastic - repository: ecs-logging-java - token: '{{ requiredEnv "GITHUB_TOKEN" }}' - username: '{{ requiredEnv "GITHUB_ACTOR" }}' - branch: main - commitusingapi: true - -actions: - ecs-logging-java: - kind: github/pullrequest - scmid: githubConfig - sourceid: sha - spec: - automerge: false - labels: - - dependencies - title: 'synchronize ecs-logging spec' - description: |- - ### What - - ECS logging specs automatic sync - - ### Why - - *Changeset* - * https://github.com/elastic/ecs-logging/commit/{{ source "sha" }} - -sources: - spec.json: - name: Get specs from json - kind: file - spec: - file: https://raw.githubusercontent.com/elastic/ecs-logging/main/spec/spec.json - - sha: - name: Get commit - kind: json - spec: - file: 'https://api.github.com/repos/elastic/ecs-logging/commits?path=spec%2Fspec.json&page=1&per_page=1' - key: ".[0].sha" - -targets: - spec.json-update: - name: 'synchronize ecs-logging spec' - kind: file - sourceid: spec.json - scmid: githubConfig - spec: - file: ecs-logging-core/src/test/resources/spec/spec.json diff --git a/.ci/updatecli/values.d/ecs-logging-specs.yml b/.ci/updatecli/values.d/ecs-logging-specs.yml new file mode 100644 index 0000000..01e74fd --- /dev/null +++ b/.ci/updatecli/values.d/ecs-logging-specs.yml @@ -0,0 +1,2 @@ +spec_path: ecs-logging-core/src/test/resources/spec/spec.json +signedcommit: true \ No newline at end of file diff --git a/.ci/updatecli/values.d/scm.yml b/.ci/updatecli/values.d/scm.yml new file mode 100644 index 0000000..d2119cd --- /dev/null +++ b/.ci/updatecli/values.d/scm.yml @@ -0,0 +1,9 @@ +scm: + enabled: true + owner: elastic + repository: ecs-logging-java + branch: main + # begin update-compose policy values + user: obltmachine + email: obltmachine@users.noreply.github.com + # end update-compose policy values \ No newline at end of file diff --git a/.ci/updatecli/values.d/update-compose.yml b/.ci/updatecli/values.d/update-compose.yml new file mode 100644 index 0000000..8804f96 --- /dev/null +++ b/.ci/updatecli/values.d/update-compose.yml @@ -0,0 +1,3 @@ +spec: + files: + - "update-compose.yaml" \ No newline at end of file diff --git a/.github/workflows/update-specs.yml b/.github/workflows/updatecli.yml similarity index 51% rename from .github/workflows/update-specs.yml rename to .github/workflows/updatecli.yml index d8376d8..99369c8 100644 --- a/.github/workflows/update-specs.yml +++ b/.github/workflows/updatecli.yml @@ -1,9 +1,7 @@ ---- -# Send PRs to the subscribed ECS Agents if the spec files (JSON) are modified -name: update-specs +name: updatecli on: - workflow_dispatch: + workflow_dispatch: ~ schedule: - cron: '0 6 * * *' @@ -11,20 +9,34 @@ permissions: contents: read jobs: - bump: + compose: runs-on: ubuntu-latest + permissions: + contents: read + packages: read steps: - - uses: actions/checkout@v4 + - uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: elastic/oblt-actions/updatecli/run@v1 + with: + command: --experimental compose diff + env: + GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }} + - uses: elastic/oblt-actions/updatecli/run@v1 with: - command: "--experimental apply --config .ci/update-specs.yml" + command: --experimental compose apply env: GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }} - if: failure() - uses: elastic/oblt-actions/slack/send@v1.2.0 + uses: elastic/oblt-actions/slack/send@v1 with: bot-token: ${{ secrets.SLACK_BOT_TOKEN }} channel-id: "#apm-agent-java" diff --git a/update-compose.yaml b/update-compose.yaml new file mode 100644 index 0000000..a3aff99 --- /dev/null +++ b/update-compose.yaml @@ -0,0 +1,14 @@ +# Config file for `updatecli compose ...`. +# https://www.updatecli.io/docs/core/compose/ +policies: + - name: Handle ecs-logging specs + policy: ghcr.io/elastic/oblt-updatecli-policies/apm/ecs-logging-specs:0.3.0@sha256:6c765407764d391d6d65b04c54ba409977decc24a000d5b8d7839f58bcd07c5b + values: + - .ci/updatecli/values.d/scm.yml + - .ci/updatecli/values.d/ecs-logging-specs.yml + + - name: Update Updatecli policies + policy: ghcr.io/updatecli/policies/autodiscovery/updatecli:0.4.0@sha256:254367f5b1454fd6032b88b314450cd3b6d5e8d5b6c953eb242a6464105eb869 + values: + - .ci/updatecli/values.d/scm.yml + - .ci/updatecli/values.d/update-compose.yml \ No newline at end of file