From 6fe379a47a40b44e4f61ebe0887fb6347b1f6c7a Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Thu, 30 Mar 2023 11:29:20 +0200 Subject: [PATCH] Migrate specs update to updatecli (#1402) * Migrate specs update to updatecli * Fix title too long error Co-authored-by: Victor Martinez --------- Co-authored-by: Victor Martinez --- .ci/updatecli.d/update-gherkin-specs.yml | 117 +++++++++++++++++ .ci/updatecli.d/update-json-specs.yml | 122 ++++++++++++++++++ .ci/{ => updatecli.d}/update-specs.yml | 0 .github/workflows/opentelemetry.yml | 2 +- .../{update-specs.yml => updatecli.yml} | 6 +- 5 files changed, 242 insertions(+), 5 deletions(-) create mode 100644 .ci/updatecli.d/update-gherkin-specs.yml create mode 100644 .ci/updatecli.d/update-json-specs.yml rename .ci/{ => updatecli.d}/update-specs.yml (100%) rename .github/workflows/{update-specs.yml => updatecli.yml} (86%) diff --git a/.ci/updatecli.d/update-gherkin-specs.yml b/.ci/updatecli.d/update-gherkin-specs.yml new file mode 100644 index 000000000..f5b4bea6c --- /dev/null +++ b/.ci/updatecli.d/update-gherkin-specs.yml @@ -0,0 +1,117 @@ +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 + token: '{{ requiredEnv "GITHUB_TOKEN" }}' + username: '{{ requiredEnv "GIT_USER" }}' + branch: main + +sources: + sha: + kind: file + spec: + file: 'https://github.com/elastic/apm/commit/main.patch' + matchpattern: "^From\\s([0-9a-f]{40})\\s" + transformers: + - findsubmatch: + pattern: "[0-9a-f]{40}" + + 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 + spec: + file: https://raw.githubusercontent.com/elastic/apm/main/tests/agents/gherkin-specs/user_agent.feature + +actions: + pr: + kind: "github/pullrequest" + scmid: default + title: '[Automation] Update Gherkin specs' + spec: + automerge: false + draft: false + labels: + - "automation" + description: |- + ### What + APM agent Gherkin specs automatic sync + ### Why + *Changeset* + * https://github.com/elastic/apm/commit/{{ source "sha" }} + +targets: + api_key.feature: + name: api_key.feature + 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 + spec: + file: features/user_agent.feature + forcecreate: true diff --git a/.ci/updatecli.d/update-json-specs.yml b/.ci/updatecli.d/update-json-specs.yml new file mode 100644 index 000000000..8ae6b9b45 --- /dev/null +++ b/.ci/updatecli.d/update-json-specs.yml @@ -0,0 +1,122 @@ +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 + token: '{{ requiredEnv "GITHUB_TOKEN" }}' + username: '{{ requiredEnv "GIT_USER" }}' + branch: main + +sources: + sha: + kind: file + spec: + file: 'https://github.com/elastic/apm/commit/main.patch' + matchpattern: "^From\\s([0-9a-f]{40})\\s" + transformers: + - findsubmatch: + pattern: "[0-9a-f]{40}" + + cgroup_parsing.json: + kind: file + spec: + file: https://raw.githubusercontent.com/elastic/apm/main/tests/agents/json-specs/cgroup_parsing.json + 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 + spec: + file: https://raw.githubusercontent.com/elastic/apm/main/tests/agents/json-specs/wildcard_matcher_tests.json + +actions: + pr: + kind: "github/pullrequest" + scmid: default + title: '[Automation] Update JSON specs' + spec: + automerge: false + draft: false + labels: + - "automation" + description: |- + ### What + APM agent specs automatic sync + ### Why + *Changeset* + * https://github.com/elastic/apm/commit/{{ source "sha" }} + +targets: + cgroup_parsing.json: + name: cgroup_parsing.json + scmid: default + sourceid: cgroup_parsing.json + kind: file + spec: + file: internal/testdata/json-specs/cgroup_parsing.json + 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 + 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 + spec: + file: internal/testdata/json-specs/wildcard_matcher_tests.json diff --git a/.ci/update-specs.yml b/.ci/updatecli.d/update-specs.yml similarity index 100% rename from .ci/update-specs.yml rename to .ci/updatecli.d/update-specs.yml diff --git a/.github/workflows/opentelemetry.yml b/.github/workflows/opentelemetry.yml index b497fd200..caac0996f 100644 --- a/.github/workflows/opentelemetry.yml +++ b/.github/workflows/opentelemetry.yml @@ -5,7 +5,7 @@ on: workflow_run: workflows: - ci - - update-specs + - updatecli types: [completed] jobs: diff --git a/.github/workflows/update-specs.yml b/.github/workflows/updatecli.yml similarity index 86% rename from .github/workflows/update-specs.yml rename to .github/workflows/updatecli.yml index bf64bd0e4..0934f3c57 100644 --- a/.github/workflows/update-specs.yml +++ b/.github/workflows/updatecli.yml @@ -1,4 +1,4 @@ -name: update-specs +name: updatecli on: workflow_dispatch: ~ @@ -14,13 +14,11 @@ jobs: steps: - uses: actions/checkout@v3 - uses: elastic/apm-pipeline-library/.github/actions/updatecli@current - env: - BRANCH_NAME: ${{ github.ref_name }} with: vaultUrl: ${{ secrets.VAULT_ADDR }} vaultRoleId: ${{ secrets.VAULT_ROLE_ID }} vaultSecretId: ${{ secrets.VAULT_SECRET_ID }} - pipeline: ./.ci/update-specs.yml + pipeline: .ci/updatecli.d - if: failure() uses: elastic/apm-pipeline-library/.github/actions/notify-build-status@current with: