Skip to content
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

Bump version with updatecli #207

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions .ci/bump-version.sh

This file was deleted.

60 changes: 60 additions & 0 deletions .ci/bump-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
## Workflow to periodically check if there is an available newer APM agent version, e.g.
## "1.2.3". If so, then update to it.
name: Bump elastic-apm to latest version

title: Bump elastic-apm to latest version

scms:
githubConfig:
kind: github
spec:
user: '{{ requiredEnv "GIT_USER" }}'
email: '{{ requiredEnv "GIT_EMAIL" }}'
owner: elastic
repository: opbeans-python
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
username: '{{ requiredEnv "GIT_USER" }}'
branch: main

actions:
opbeans-python:
kind: github/pullrequest
scmid: githubConfig
spec:
automerge: false
labels:
- dependencies

sources:
elastic-apm-agent-python:
kind: githubrelease
spec:
owner: elastic
repository: apm-agent-python
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
username: '{{ requiredEnv "GIT_USER" }}'
versionfilter:
kind: semver
transformers:
- trimprefix: "v"

targets:
dockerfile:
name: Set org.label-schema.version in Dockerfile
sourceid: elastic-apm-agent-python
scmid: githubConfig
kind: file
spec:
file: Dockerfile
matchpattern: 'org\.label-schema\.version="(\d+.\d+.\d+)"'
replacepattern: org.label-schema.version="{{ source `elastic-apm-agent-python` }}"
requirements_txt:
name: Install new elastic-apm pip dependency version
sourceid: elastic-apm-agent-python
scmid: githubConfig
kind: file
spec:
file: requirements.txt
matchpattern: 'elastic-apm==(\d+.\d+.\d+)'
replacepattern: elastic-apm=={{ source `elastic-apm-agent-python` }}
25 changes: 25 additions & 0 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
## Workflow to periodically check if there is an available newer APM agent version, e.g. "1.2.3".
name: Bump version

on:
schedule:
- cron: '0 20 * * 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 }}
run: updatecli apply --config ./.ci/bump-version.yml
29 changes: 29 additions & 0 deletions .github/workflows/create-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

# Takes the version of elastic-apm in the requirements.txt file and creates a tag
# if the tag does not exist yet.
name: create-tag

on:
push:
branches:
- main
paths:
- requirements.txt

permissions:
contents: write

jobs:
tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # also fetch tags
- run: |
ELASTIC_APM_VERSION="v$(cat requirements.txt | grep "elastic-apm==" | awk 'BEGIN { FS = "==" }; { print $2 }')"
# if the tag does not exist
if [[ ! $(git tag -l "${ELASTIC_APM_VERSION}") ]]; then
git tag ${ELASTIC_APM_VERSION}
git push origin "refs/tags/${ELASTIC_APM_VERSION}"
fi
2 changes: 2 additions & 0 deletions .github/workflows/opentelemetry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
- test
- test-reporter
- release
- create-tag
- bump-version
types: [completed]

jobs:
Expand Down