Skip to content

Commit

Permalink
updatecli: use dynamic approach
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v committed Jan 25, 2024
1 parent fdfa2f4 commit c52dd0e
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 214 deletions.
110 changes: 33 additions & 77 deletions .ci/updatecli/updatecli.d/update-gherkin-specs.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
name: update-gherkin-specs
pipelineid: update-gherkin-specs
title: synchronize gherkin specs

scms:
default:
kind: github
spec:
user: '{{ requiredEnv "GIT_USER" }}'
email: '{{ requiredEnv "GIT_EMAIL" }}'
owner: elastic
repository: apm-agent-go
owner: "{{ .github.owner }}"
repository: "{{ .github.repository }}"
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
username: '{{ requiredEnv "GIT_USER" }}'
branch: main
branch: "{{ .github.branch }}"
apm:
kind: github
spec:
user: '{{ requiredEnv "GIT_USER" }}'
email: '{{ requiredEnv "GIT_EMAIL" }}'
owner: "{{ .github.owner }}"
repository: "{{ .github.apm_repository }}"
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
username: '{{ requiredEnv "GIT_USER" }}'
branch: "{{ .github.branch }}"

sources:
sha:
kind: file
spec:
file: 'https://github.com/elastic/apm/commit/main.patch'
file: 'https://github.com/{{ .github.owner }}/{{ .github.apm_repository }}/commit/{{ .github.branch }}.patch'
matchpattern: "^From\\s([0-9a-f]{40})\\s"
transformers:
- findsubmatch:
Expand All @@ -28,40 +37,25 @@ sources:
dependson:
- sha
spec:
command: gh api /repos/elastic/apm/commits/{{ source "sha" }}/pulls --jq '.[].html_url'
command: gh api /repos/{{ .github.owner }}/{{ .github.apm_repository }}/commits/{{ source "sha" }}/pulls --jq '.[].html_url'
environments:
- name: GITHUB_TOKEN
- name: PATH
api_key.feature:
kind: file
spec:
file: https://raw.githubusercontent.com/elastic/apm/main/tests/agents/gherkin-specs/api_key.feature
azure_app_service_metadata.feature:
kind: file
spec:
file: https://raw.githubusercontent.com/elastic/apm/main/tests/agents/gherkin-specs/azure_app_service_metadata.feature
azure_functions_metadata.feature:
kind: file
spec:
file: https://raw.githubusercontent.com/elastic/apm/main/tests/agents/gherkin-specs/azure_functions_metadata.feature
otel_bridge.feature:
kind: file
spec:
file: https://raw.githubusercontent.com/elastic/apm/main/tests/agents/gherkin-specs/otel_bridge.feature
outcome.feature:
kind: file
spec:
file: https://raw.githubusercontent.com/elastic/apm/main/tests/agents/gherkin-specs/outcome.feature
user_agent.feature:
kind: file
agents-gherkin-specs-tarball:
kind: shell
scmid: apm
dependson:
- sha
spec:
file: https://raw.githubusercontent.com/elastic/apm/main/tests/agents/gherkin-specs/user_agent.feature
command: tar cvzf {{ requiredEnv "GITHUB_WORKSPACE" }}/gherkin-specs.tgz .
environments:
- name: PATH
workdir: "{{ .specs.apm_gherkin_path }}"

actions:
pr:
kind: "github/pullrequest"
scmid: default
title: '[Automation] Update Gherkin specs'
spec:
automerge: false
draft: false
Expand All @@ -70,57 +64,19 @@ actions:
description: |-
### What
APM agent Gherkin specs automatic sync
### Why
*Changeset*
* https://github.com/elastic/apm/commit/{{ source "sha" }}
* {{ source "pull_request" }}
* https://github.com/elastic/apm/commit/{{ source "sha" }}
title: '[Automation] Update Gherkin specs'

targets:
api_key.feature:
name: api_key.feature
agent-gherkin-specs:
name: APM agent gherkin specs {{ source "sha" }}
scmid: default
sourceid: api_key.feature
kind: file
spec:
file: features/api_key.feature
forcecreate: true
azure_app_service_metadata.feature:
name: azure_app_service_metadata.feature
scmid: default
sourceid: azure_app_service_metadata.feature
kind: file
spec:
file: features/azure_app_service_metadata.feature
forcecreate: true
azure_functions_metadata.feature:
name: azure_functions_metadata.feature
scmid: default
sourceid: azure_functions_metadata.feature
kind: file
spec:
file: features/azure_functions_metadata.feature
forcecreate: true
otel_bridge.feature:
name: otel_bridge.feature
scmid: default
sourceid: otel_bridge.feature
kind: file
spec:
file: features/otel_bridge.feature
forcecreate: true
outcome.feature:
name: outcome.feature
scmid: default
sourceid: outcome.feature
kind: file
spec:
file: features/outcome.feature
forcecreate: true
user_agent.feature:
name: user_agent.feature
scmid: default
sourceid: user_agent.feature
kind: file
disablesourceinput: true
kind: shell
spec:
file: features/user_agent.feature
forcecreate: true
command: 'tar -xzf {{ requiredEnv "GITHUB_WORKSPACE" }}/gherkin-specs.tgz && git --no-pager diff'
workdir: "{{ .apm_agent.gherkin_specs_path }}"
104 changes: 33 additions & 71 deletions .ci/updatecli/updatecli.d/update-json-specs.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
name: update-json-specs
pipelineid: update-json-specs
title: synchronize json specs

scms:
default:
kind: github
spec:
user: '{{ requiredEnv "GIT_USER" }}'
email: '{{ requiredEnv "GIT_EMAIL" }}'
owner: elastic
repository: apm-agent-go
owner: "{{ .github.owner }}"
repository: "{{ .github.repository }}"
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
username: '{{ requiredEnv "GIT_USER" }}'
branch: main
branch: "{{ .github.branch }}"
apm:
kind: github
spec:
user: '{{ requiredEnv "GIT_USER" }}'
email: '{{ requiredEnv "GIT_EMAIL" }}'
owner: "{{ .github.owner }}"
repository: "{{ .github.apm_repository }}"
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
username: '{{ requiredEnv "GIT_USER" }}'
branch: "{{ .github.branch }}"

sources:
sha:
kind: file
spec:
file: 'https://github.com/elastic/apm/commit/main.patch'
file: 'https://github.com/{{ .github.owner }}/{{ .github.apm_repository }}/commit/{{ .github.branch }}.patch'
matchpattern: "^From\\s([0-9a-f]{40})\\s"
transformers:
- findsubmatch:
Expand All @@ -28,40 +37,25 @@ sources:
dependson:
- sha
spec:
command: gh api /repos/elastic/apm/commits/{{ source "sha" }}/pulls --jq '.[].html_url'
command: gh api /repos/{{ .github.owner }}/{{ .github.apm_repository }}/commits/{{ source "sha" }}/pulls --jq '.[].html_url'
environments:
- name: GITHUB_TOKEN
- name: PATH
service_resource_inference.json:
kind: file
spec:
file: https://raw.githubusercontent.com/elastic/apm/main/tests/agents/json-specs/service_resource_inference.json
span_types.json:
kind: file
spec:
file: https://raw.githubusercontent.com/elastic/apm/main/tests/agents/json-specs/span_types.json
sql_signature_examples.json:
kind: file
spec:
file: https://raw.githubusercontent.com/elastic/apm/main/tests/agents/json-specs/sql_signature_examples.json
sql_token_examples.json:
kind: file
spec:
file: https://raw.githubusercontent.com/elastic/apm/main/tests/agents/json-specs/sql_token_examples.json
w3c_distributed_tracing.json:
kind: file
spec:
file: https://raw.githubusercontent.com/elastic/apm/main/tests/agents/json-specs/w3c_distributed_tracing.json
wildcard_matcher_tests.json:
kind: file
agents-json-specs-tarball:
kind: shell
scmid: apm
dependson:
- sha
spec:
file: https://raw.githubusercontent.com/elastic/apm/main/tests/agents/json-specs/wildcard_matcher_tests.json
command: tar cvzf {{ requiredEnv "GITHUB_WORKSPACE" }}/json-specs.tgz .
environments:
- name: PATH
workdir: "{{ .specs.apm_json_path }}"

actions:
pr:
kind: "github/pullrequest"
scmid: default
title: '[Automation] Update JSON specs'
spec:
automerge: false
draft: false
Expand All @@ -70,51 +64,19 @@ actions:
description: |-
### What
APM agent specs automatic sync
### Why
*Changeset*
* https://github.com/elastic/apm/commit/{{ source "sha" }}
* {{ source "pull_request" }}
* https://github.com/{{ .github.owner }}/{{ .github.apm_repository }}/commit/{{ source "sha" }}
title: '[Automation] Update JSON specs'

targets:
service_resource_inference.json:
name: service_resource_inference.json
scmid: default
sourceid: service_resource_inference.json
kind: file
spec:
file: internal/testdata/json-specs/service_resource_inference.json
span_types.json:
name: span_types.json
scmid: default
sourceid: span_types.json
kind: file
spec:
file: internal/testdata/json-specs/span_types.json
sql_signature_examples.json:
name: sql_signature_examples.json
scmid: default
sourceid: sql_signature_examples.json
kind: file
spec:
file: internal/testdata/json-specs/sql_signature_examples.json
sql_token_examples.json:
name: sql_token_examples.json
scmid: default
sourceid: sql_token_examples.json
kind: file
spec:
file: internal/testdata/json-specs/sql_token_examples.json
w3c_distributed_tracing.json:
name: w3c_distributed_tracing.json
agent-json-specs:
name: APM agent json specs {{ source "sha" }}
scmid: default
sourceid: w3c_distributed_tracing.json
kind: file
spec:
file: internal/testdata/json-specs/w3c_distributed_tracing.json
wildcard_matcher_tests.json:
name: wildcard_matcher_tests.json
scmid: default
sourceid: wildcard_matcher_tests.json
kind: file
disablesourceinput: true
kind: shell
spec:
file: internal/testdata/json-specs/wildcard_matcher_tests.json
command: 'tar -xzf {{ requiredEnv "GITHUB_WORKSPACE" }}/json-specs.tgz && git --no-pager diff'
workdir: "{{ .apm_agent.json_specs_path }}"
Loading

0 comments on commit c52dd0e

Please sign in to comment.