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

Update (or create) opentelemetrybot/semantic-conventions-v* branch daily #6081

Merged
merged 7 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
9 changes: 0 additions & 9 deletions .github/workflows/build-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ on:
description: Regex of submodule paths to update to HEAD before building.
default: content-modules
type: string
workflow_call:
inputs:
submodule_path_regex:
type: string
required: true
skip_ref_cache_check:
type: boolean
default: false
chalin marked this conversation as resolved.
Show resolved Hide resolved

jobs:
build-and-test:
Expand Down Expand Up @@ -60,7 +52,6 @@ jobs:
name: REFCACHE updates?
needs: build-and-test
runs-on: ubuntu-latest
if: ${{ !inputs.skip_ref_cache_check }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
Expand Down
26 changes: 0 additions & 26 deletions .github/workflows/build-semconv-daily.yml

This file was deleted.

59 changes: 0 additions & 59 deletions .github/workflows/reusable-workflow-notification.yml
Copy link
Member Author

Choose a reason for hiding this comment

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

removed since going in a different direction now

This file was deleted.

97 changes: 97 additions & 0 deletions .github/workflows/update-semconv-integration-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Update semconv integration branch

on:
schedule:
# daily at 10:24 UTC
- cron: '24 10 * * *'
workflow_dispatch:

jobs:
update-semconv-integration-branch:
runs-on: ubuntu-latest
if: github.repository == 'open-telemetry/opentelemetry.io'
steps:
- uses: actions/checkout@v4
with:
# this is needed in order to do the rebase below
fetch-depth: 0
chalin marked this conversation as resolved.
Show resolved Hide resolved
# this is needed in order to trigger workflows when pushing new commits to the PR
token: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}

- name: Set environment variables
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
version=$(git branch -r \
| grep '^ *origin/opentelemetrybot/semantic-conventions-v[0-9]+\.[0-9]+\.[0-9]+$' \
trask marked this conversation as resolved.
Show resolved Hide resolved
| sed 's/ *origin\/opentelemetrybot\/semantic-conventions-//')

if [[ -z "$versions" ]]; then
latest_version=$(gh release view \
--repo open-telemetry/semantic-conventions \
--json tagName \
--jq .tagName)
if [[ $latest_version =~ ^v([0-9]+)\.([0-9]+)\.[0-9]+ ]]; then
trask marked this conversation as resolved.
Show resolved Hide resolved
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
version="v$major.$((minor + 1)).0"
trask marked this conversation as resolved.
Show resolved Hide resolved
else
echo "unexpected version: $latest_version"
exit 1
fi
fi

echo "VERSION=$version" >> $GITHUB_ENV
echo "BRANCH=opentelemetrybot/semantic-conventions-${version}" >> $GITHUB_ENV
trask marked this conversation as resolved.
Show resolved Hide resolved

- name: Checkout or create branch
run: |
if ! git ls-remote --exit-code --heads origin $BRANCH; then
git checkout -b $BRANCH origin/main
git push -u origin $BRANCH
else
git checkout $BRANCH
fi

- name: Use CLA approved github bot
run: |
git config user.name opentelemetrybot
git config user.email 107717825+opentelemetrybot@users.noreply.github.com

- name: Rebase
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I'm not sure that I'd want to automatically rebase the otel.io repo (that is what this is doing, right?). My gut feeling is that we might want to do this by hand. Maybe introduce a script bool argument to control this? Or just omit it and we can do it fully manually.

Copy link
Member Author

@trask trask Jan 30, 2025

Choose a reason for hiding this comment

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

it's merging from main (no force pushing involved), I can remove it if you'd prefer to do it by hand for now

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer rebasing, to keep the PR branch clean, and make it easier to cherry pick if/once we want to create a final PR.

But let's leave this as is for now. We can revisit later if necessary.

run: |
previous=$(git rev-parse HEAD)
git fetch origin
git merge origin/main
if [ "$(git rev-parse HEAD)" != "$previous" ]; then
git push
fi

- name: Update submodule
run: |
git submodule update --init content-modules/semantic-conventions
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally, we should be running npm run get:submodule, but that would require that in this step we not only update the submodule commit, but that we change the value of semconv-pin to correspond to the value returned by git describe --tags. Can we do that further below in this step?

Copy link
Member Author

Choose a reason for hiding this comment

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

I updated semconv-pin now, but I'm not sure what npm run get:submodule is for, or when to run it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, npm run get:submodule is mainly to help local devs sync their submodules to the pinned versions. Come to think of it, we won't need it here.

cd content-modules/semantic-conventions

if git ls-remote --exit-code --tags origin $VERSION; then
git reset --hard $VERSION
else
git reset --hard origin/main
fi

cd ../..

if ! git diff-index --quiet HEAD; then
git commit -am "Update submodule"
trask marked this conversation as resolved.
Show resolved Hide resolved
git push
fi

- name: Create pull request if needed
env:
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
run: |
prs=$(gh pr list --state open --head $BRANCH)
if [ -z "$prs" ]; then
gh pr create --title "Update semantic conventions to ${VERSION}" \
--body "This PR updates the semantic conventions to ${VERSION}."
fi