diff --git a/.ci/bump-version.sh b/.ci/bump-version.sh deleted file mode 100755 index e3a1482..0000000 --- a/.ci/bump-version.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -set -euxo pipefail - -AGENT_VERSION="${1?Missing the APM python agent version}" - -sed -ibck "s#elastic-apm==.*#elastic-apm==${AGENT_VERSION}#g" requirements.txt - -## Bump agent version in the Dockerfile -sed -ibck "s#\(org.label-schema.version=\)\(\".*\"\)\(.*\)#\1\"${AGENT_VERSION}\"\3#g" Dockerfile - -# Commit changes -git add requirements.txt Dockerfile -git commit -m "Bump version ${AGENT_VERSION}" diff --git a/.ci/bump-version.yml b/.ci/bump-version.yml new file mode 100644 index 0000000..818335b --- /dev/null +++ b/.ci/bump-version.yml @@ -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` }} diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml new file mode 100644 index 0000000..e5cf1ca --- /dev/null +++ b/.github/workflows/bump-version.yml @@ -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 diff --git a/.github/workflows/create-tag.yml b/.github/workflows/create-tag.yml new file mode 100644 index 0000000..5880882 --- /dev/null +++ b/.github/workflows/create-tag.yml @@ -0,0 +1,29 @@ +--- +# 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 diff --git a/.github/workflows/opentelemetry.yml b/.github/workflows/opentelemetry.yml index 6a4dd89..0fb132c 100644 --- a/.github/workflows/opentelemetry.yml +++ b/.github/workflows/opentelemetry.yml @@ -7,6 +7,8 @@ on: - test - test-reporter - release + - create-tag + - bump-version types: [completed] jobs: