Skip to content

Commit

Permalink
updatecli: use shared policy for the apm-data-specs
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v committed Jul 2, 2024
1 parent ee50fe1 commit f0b2e29
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 117 deletions.
6 changes: 6 additions & 0 deletions .ci/updatecli/update-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
policies:
- name: Handle apm-data server specs
policy: docker pull ghcr.io/elastic/oblt-updatecli-policies/apm/apm-data-spec:0.0.1@sha256:1b8a9876bb8ff9d4b61a0b655b957f10e9c65de0c8a333a88b7424d10b498adc
values:
- .ci/updatecli/values.d/scm.yaml
- .ci/updatecli/values.d/apm-data-spec.yaml
16 changes: 8 additions & 8 deletions .ci/updatecli/updatecli.d/update-gherkin-specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ scms:
kind: github
spec:
user: '{{ requiredEnv "GITHUB_ACTOR" }}'
owner: "{{ .github.owner }}"
repository: "{{ .github.repository }}"
owner: "{{ .scm.owner }}"
repository: "{{ .scm.repository }}"
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
username: '{{ requiredEnv "GITHUB_ACTOR" }}'
branch: "{{ .github.branch }}"
branch: "{{ .scm.branch }}"
commitusingapi: true
apm:
kind: github
spec:
user: '{{ requiredEnv "GITHUB_ACTOR" }}'
owner: "{{ .github.owner }}"
repository: "{{ .github.apm_repository }}"
owner: "{{ .scm.owner }}"
repository: "{{ .scm.apm_repository }}"
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
username: '{{ requiredEnv "GITHUB_ACTOR" }}'
branch: "{{ .github.branch }}"
branch: "{{ .scm.branch }}"

sources:
sha:
kind: file
spec:
file: 'https://github.com/{{ .github.owner }}/{{ .github.apm_repository }}/commit/{{ .github.branch }}.patch'
file: 'https://github.com/{{ .scm.owner }}/{{ .scm.apm_repository }}/commit/{{ .scm.branch }}.patch'
matchpattern: "^From\\s([0-9a-f]{40})\\s"
transformers:
- findsubmatch:
Expand All @@ -36,7 +36,7 @@ sources:
dependson:
- sha
spec:
command: gh api /repos/{{ .github.owner }}/{{ .github.apm_repository }}/commits/{{ source "sha" }}/pulls --jq '.[].html_url'
command: gh api /repos/{{ .scm.owner }}/{{ .scm.apm_repository }}/commits/{{ source "sha" }}/pulls --jq '.[].html_url'
environments:
- name: GITHUB_TOKEN
- name: PATH
Expand Down
18 changes: 9 additions & 9 deletions .ci/updatecli/updatecli.d/update-json-specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ scms:
kind: github
spec:
user: '{{ requiredEnv "GITHUB_ACTOR" }}'
owner: "{{ .github.owner }}"
repository: "{{ .github.repository }}"
owner: "{{ .scm.owner }}"
repository: "{{ .scm.repository }}"
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
username: '{{ requiredEnv "GITHUB_ACTOR" }}'
branch: "{{ .github.branch }}"
branch: "{{ .scm.branch }}"
commitusingapi: true
apm:
kind: github
spec:
user: '{{ requiredEnv "GITHUB_ACTOR" }}'
owner: "{{ .github.owner }}"
repository: "{{ .github.apm_repository }}"
owner: "{{ .scm.owner }}"
repository: "{{ .scm.apm_repository }}"
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
username: '{{ requiredEnv "GITHUB_ACTOR" }}'
branch: "{{ .github.branch }}"
branch: "{{ .scm.branch }}"

sources:
sha:
kind: file
spec:
file: 'https://github.com/{{ .github.owner }}/{{ .github.apm_repository }}/commit/{{ .github.branch }}.patch'
file: 'https://github.com/{{ .scm.owner }}/{{ .scm.apm_repository }}/commit/{{ .scm.branch }}.patch'
matchpattern: "^From\\s([0-9a-f]{40})\\s"
transformers:
- findsubmatch:
Expand All @@ -36,7 +36,7 @@ sources:
dependson:
- sha
spec:
command: gh api /repos/{{ .github.owner }}/{{ .github.apm_repository }}/commits/{{ source "sha" }}/pulls --jq '.[].html_url'
command: gh api /repos/{{ .scm.owner }}/{{ .scm.apm_repository }}/commits/{{ source "sha" }}/pulls --jq '.[].html_url'
environments:
- name: GITHUB_TOKEN
- name: PATH
Expand Down Expand Up @@ -67,7 +67,7 @@ actions:
### Why
*Changeset*
* {{ source "pull_request" }}
* https://github.com/{{ .github.owner }}/{{ .github.apm_repository }}/commit/{{ source "sha" }}
* https://github.com/{{ .scm.owner }}/{{ .scm.apm_repository }}/commit/{{ source "sha" }}
title: '[Automation] Update JSON specs'

targets:
Expand Down
85 changes: 0 additions & 85 deletions .ci/updatecli/updatecli.d/update-specs.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .ci/updatecli/values.d/apm-data-spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
apm_schema_specs_path: tests/APM_Server_intake_API_schema/latest_used
signedcommit: true
6 changes: 6 additions & 0 deletions .ci/updatecli/values.d/scm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
scm:
enabled: true
owner: elastic
repository: apm-agent-php
apm_repository: apm
branch: main
6 changes: 6 additions & 0 deletions .ci/updatecli/values.d/specs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
specs:
apm_json_path: "tests/agents/json-specs"
apm_gherkin_path: "tests/agents/gherkin-specs"
apm_agent:
gherkin_specs_path: "tests/APM_Agents_shared/gherkin-specs"
json_specs_path: "tests/APM_Agents_shared/json-specs"
14 changes: 0 additions & 14 deletions .ci/updatecli/values.yml

This file was deleted.

32 changes: 31 additions & 1 deletion .github/workflows/updatecli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,37 @@ jobs:

- uses: elastic/oblt-actions/updatecli/run@v1
with:
command: "--experimental apply --config .ci/updatecli/updatecli.d --values .ci/updatecli/values.yml"
command: "--experimental apply --config .ci/updatecli/updatecli.d --values .ci/updatecli/values.d/scm.yml"
env:
GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }}

- if: failure()
uses: elastic/oblt-actions/slack/send@v1
with:
bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
channel-id: "#apm-agent-php"
message: ":traffic_cone: updatecli failed for `${{ github.repository }}@${{ github.ref_name }}`, @robots-ci please look what's going on <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|here>"

compose:
runs-on: ubuntu-latest
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 --file .ci/updatecli/update-compose.yml
env:
GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }}

- uses: elastic/oblt-actions/updatecli/run@v1
with:
command: --experimental compose apply --file .ci/updatecli/update-compose.yml
env:
GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }}

Expand Down

0 comments on commit f0b2e29

Please sign in to comment.