From acfa51dd27ca0daa23ca61382edfe3a5779496c0 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Wed, 8 Feb 2023 14:41:55 +0100 Subject: [PATCH 1/3] Add update-spec updatecli workflow --- .ci/update-specs.yml | 101 +++++++++++++++++++++++++++++ .github/workflows/update-specs.yml | 32 +++++++++ 2 files changed, 133 insertions(+) create mode 100644 .ci/update-specs.yml create mode 100644 .github/workflows/update-specs.yml diff --git a/.ci/update-specs.yml b/.ci/update-specs.yml new file mode 100644 index 0000000000..55dc32c6df --- /dev/null +++ b/.ci/update-specs.yml @@ -0,0 +1,101 @@ +name: update-specs + +title: synchronize schema specs + +scms: + default: + kind: github + spec: + user: '{{ requiredEnv "GIT_USER" }}' + email: '{{ requiredEnv "GIT_EMAIL" }}' + owner: elastic + repository: apm-agent-nodejs + token: '{{ requiredEnv "GITHUB_TOKEN" }}' + username: '{{ requiredEnv "GIT_USER" }}' + branch: main + +sources: + sha: + kind: file + spec: + file: 'https://github.com/elastic/apm-data/commit/main.patch' + matchpattern: "^From\\s([0-9a-f]{40})\\s" + error.json: + kind: file + spec: + file: https://raw.githubusercontent.com/elastic/apm-data/main/input/elasticapm/docs/spec/v2/error.json + metadata.json: + kind: file + spec: + file: https://raw.githubusercontent.com/elastic/apm-data/main/input/elasticapm/docs/spec/v2/metadata.json + metricset.json: + kind: file + spec: + file: https://raw.githubusercontent.com/elastic/apm-data/main/input/elasticapm/docs/spec/v2/metricset.json + span.json: + kind: file + spec: + file: https://raw.githubusercontent.com/elastic/apm-data/main/input/elasticapm/docs/spec/v2/span.json + transaction.json: + kind: file + spec: + file: https://raw.githubusercontent.com/elastic/apm-data/main/input/elasticapm/docs/spec/v2/transaction.json + +actions: + pr: + kind: "github/pullrequest" + scmid: default + sourceid: sha + spec: + automerge: false + draft: false + labels: + - "automation" + description: |- + ### What + APM agent json schema automatic sync + ### Why + *Changeset* + * https://github.com/elastic/apm-data/commit/{{ source "sha" }} + +targets: + error.json: + name: error.json + scmid: default + sourceid: error.json + kind: file + spec: + file: test/integration/api-schema/apm-server-schema/error.json + forcecreate: true + metadata.json: + name: metadata.json + scmid: default + sourceid: metadata.json + kind: file + spec: + file: test/integration/api-schema/apm-server-schema/metadata.json + forcecreate: true + metricset.json: + name: metricset.json + scmid: default + sourceid: metricset.json + kind: file + spec: + file: test/integration/api-schema/apm-server-schema/metricset.json + forcecreate: true + span.json: + name: span.json + scmid: default + sourceid: span.json + kind: file + spec: + file: test/integration/api-schema/apm-server-schema/span.json + forcecreate: true + transaction.json: + name: transaction.json + scmid: default + sourceid: transaction.json + kind: file + spec: + file: test/integration/api-schema/apm-server-schema/transaction.json + forcecreate: true diff --git a/.github/workflows/update-specs.yml b/.github/workflows/update-specs.yml new file mode 100644 index 0000000000..bcc49c8011 --- /dev/null +++ b/.github/workflows/update-specs.yml @@ -0,0 +1,32 @@ +name: update-specs + +on: + workflow_dispatch: ~ + schedule: + - cron: '0 6 * * *' + +permissions: + pull-requests: write + contents: write + +jobs: + bump: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup Git + uses: elastic/apm-pipeline-library/.github/actions/setup-git@current + - name: Install Updatecli in the runner + uses: updatecli/updatecli-action@453502948b442d7b9a923de7b40cc7ce8628505c + - name: Run Updatecli + env: + GITHUB_TOKEN: ${{ github.token }} + BRANCH_NAME: ${{ github.ref_name }} + run: updatecli apply --config ./.ci/update-specs.yml + - if: failure() + uses: elastic/apm-pipeline-library/.github/actions/notify-build-status@current + with: + vaultUrl: ${{ secrets.VAULT_ADDR }} + vaultRoleId: ${{ secrets.VAULT_ROLE_ID }} + vaultSecretId: ${{ secrets.VAULT_SECRET_ID }} + slackChannel: "#apm-agent-node" From 8320bdd3c70e3409771d4afd5a89828d38487ac8 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Wed, 8 Feb 2023 14:46:05 +0100 Subject: [PATCH 2/3] Add to OpenTelemetry workflow --- .github/workflows/opentelemetry.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/opentelemetry.yml b/.github/workflows/opentelemetry.yml index fcc4339754..9c59c79073 100644 --- a/.github/workflows/opentelemetry.yml +++ b/.github/workflows/opentelemetry.yml @@ -2,7 +2,7 @@ name: OpenTelemetry Export Trace on: workflow_run: - workflows: [Edge, Test, Lint, Snapshoty] + workflows: [Edge, Test, Lint, Snapshoty, update-specs] types: [completed] jobs: From 3f85aa3af716ba4876b0d39122d0b0bbbe47aed2 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Thu, 9 Feb 2023 09:24:01 +0100 Subject: [PATCH 3/3] Remove deprecated log.json file --- .../api-schema/apm-server-schema/log.json | 87 ------------------- 1 file changed, 87 deletions(-) delete mode 100644 test/integration/api-schema/apm-server-schema/log.json diff --git a/test/integration/api-schema/apm-server-schema/log.json b/test/integration/api-schema/apm-server-schema/log.json deleted file mode 100644 index dd0cd4eb47..0000000000 --- a/test/integration/api-schema/apm-server-schema/log.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "$id": "docs/spec/v2/log", - "type": "object", - "properties": { - "@timestamp": { - "description": "Timestamp holds the recorded time of the event, UTC based and formatted as microseconds since Unix epoch", - "type": [ - "null", - "integer" - ] - }, - "faas": { - "description": "FAAS holds fields related to Function as a Service events.", - "type": [ - "null", - "object" - ], - "properties": { - "coldstart": { - "description": "Indicates whether a function invocation was a cold start or not.", - "type": [ - "null", - "boolean" - ] - }, - "execution": { - "description": "The request id of the function invocation.", - "type": [ - "null", - "string" - ] - }, - "id": { - "description": "A unique identifier of the invoked serverless function.", - "type": [ - "null", - "string" - ] - }, - "name": { - "description": "The lambda function name.", - "type": [ - "null", - "string" - ] - }, - "trigger": { - "description": "Trigger attributes.", - "type": [ - "null", - "object" - ], - "properties": { - "request_id": { - "description": "The id of the origin trigger request.", - "type": [ - "null", - "string" - ] - }, - "type": { - "description": "The trigger type.", - "type": [ - "null", - "string" - ] - } - } - }, - "version": { - "description": "The lambda function version.", - "type": [ - "null", - "string" - ] - } - } - }, - "message": { - "description": "Message logged as part of the log. In case a parameterized message is captured, Message should contain the same information, but with any placeholders being replaced.", - "type": [ - "null", - "string" - ] - } - } -} \ No newline at end of file