-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add update-specs updatcli workflow #1745
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
name: update-specs | ||
|
||
title: synchronize schema specs | ||
|
||
scms: | ||
apm-agent-python: | ||
kind: github | ||
spec: | ||
user: '{{ requiredEnv "GIT_USER" }}' | ||
email: '{{ requiredEnv "GIT_EMAIL" }}' | ||
owner: elastic | ||
repository: apm-agent-python | ||
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: "apm-agent-python" | ||
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: apm-agent-python | ||
sourceid: error.json | ||
kind: file | ||
spec: | ||
file: tests/upstream/json-specs/error.json | ||
forcecreate: true | ||
metadata.json: | ||
name: metadata.json | ||
scmid: apm-agent-python | ||
sourceid: metadata.json | ||
kind: file | ||
spec: | ||
file: tests/upstream/json-specs/metadata.json | ||
forcecreate: true | ||
metricset.json: | ||
name: metricset.json | ||
scmid: apm-agent-python | ||
sourceid: metricset.json | ||
kind: file | ||
spec: | ||
file: tests/upstream/json-specs/metricset.json | ||
forcecreate: true | ||
span.json: | ||
name: span.json | ||
scmid: apm-agent-python | ||
sourceid: span.json | ||
kind: file | ||
spec: | ||
file: tests/upstream/json-specs/span.json | ||
forcecreate: true | ||
transaction.json: | ||
name: transaction.json | ||
scmid: apm-agent-python | ||
sourceid: transaction.json | ||
kind: file | ||
spec: | ||
file: tests/upstream/json-specs/transaction.json | ||
forcecreate: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ on: | |
- snapshoty | ||
- release | ||
- packages | ||
- update-specs | ||
types: [completed] | ||
|
||
jobs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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-python" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@axw
Is it okay for this to be a "static list" of files, or do we need something more dynamic here that considers file additions/deletions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are our other options? The set of files won't change often, but they might still change. I think we could go ahead with this, and look at bundling the schema documents into a Compound Schema Document: http://json-schema.org/understanding-json-schema/structuring.html#bundling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened elastic/apm-data#15 to improve this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option could be a shell script that does the cloning and copying of the files. Which feels a bit hacky in the updatecli way, but is certainly possible.
Regardless, a compound schema sounds really good! This will also account for deletions.
I actually encountered a case where
log.json
was not removed (Also in the current implementation). (See elastic/apm-agent-nodejs#3153 (review)) A single file would fix this behaviour.P.S.
From what I've seen, something like
rsync --delete
, to account for deletions, probably won't work seemlessly either.. because in some repos the schemas are in the same folder with other schemas.