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

Post release 1.32.7: Update version to 1.32.7.dev0 #6

Closed
wants to merge 6 commits into from
Closed
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
139 changes: 139 additions & 0 deletions .github/workflows/post_release_version_bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Post Release - Prepare Main for Next Development Cycle

on:
workflow_dispatch:
inputs:
version:
description: 'Version number (e.g., 1.0.1)'
required: true
push:

env:
AWS_DEFAULT_REGION: us-east-1

permissions:
id-token: write
contents: write
pull-requests: write

jobs:
check-version:
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v2
with:
ref: add-checksum
fetch-depth: 0

- name: Extract Major.Minor Version and setup Env variable
run: |
echo "VERSION=1.32.5" >> $GITHUB_ENV
echo "MAJOR_MINOR=$(echo 1.32.5 | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV

- name: Get current major.minor version from main branch
id: get_version
run: |
CURRENT_VERSION=$(grep 'public static string version' awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/Version.java | sed -E 's/ public static String VERSION = "([0-9]+\.[0-9]+)\.[0-9]+.*";/\1/')
echo "CURRENT_MAJOR_MINOR_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV

- name: Set major and minor for current version
run: |
echo "CURRENT_MAJOR=$(echo $CURRENT_MAJOR_MINOR_VERSION | cut -d. -f1)" >> $GITHUB_ENV
echo "CURRENT_MINOR=$(echo $CURRENT_MAJOR_MINOR_VERSION | cut -d. -f2)" >> $GITHUB_ENV

- name: Set major and minor for input version
run: |
echo "INPUT_MAJOR=$(echo $MAJOR_MINOR | cut -d. -f1)" >> $GITHUB_ENV
echo "INPUT_MINOR=$(echo $MAJOR_MINOR | cut -d. -f2)" >> $GITHUB_ENV

- name: Compare major.minor version and skip if behind
run: |
if [ "$CURRENT_MAJOR" -gt "$INPUT_MAJOR" ] || { [ "$CURRENT_MAJOR" -eq "$INPUT_MAJOR" ] && [ "$CURRENT_MINOR" -gt "$INPUT_MINOR" ]; }; then
echo "Input version is behind main's current major.minor version, don't need to update major version"
exit 1
fi

prepare-main:
runs-on: ubuntu-latest
needs: check-version
steps:
- name: Configure AWS credentials for BOT secrets
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN_SECRETS_MANAGER }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}

- name: Get Bot secrets
uses: aws-actions/aws-secretsmanager-get-secrets@v1
id: bot_secrets
with:
secret-ids: |
BOT_TOKEN ,${{ secrets.BOT_TOKEN_SECRET_ARN }}
parse-json-secrets: true

- name: Setup Git
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
ref: add-checksum

- name: Configure Git
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"

- name: Extract Major.Minor Version and setup Env variable
run: |
echo "VERSION=1.32.5" >> $GITHUB_ENV
echo "MAJOR_MINOR=$(echo 1.32.5 | sed -E 's/([0-9]+\.[0-9]+)\.[0-9]+/\1/')" >> $GITHUB_ENV

- name: Determine release branch and checkout
run: |
RELEASE_BRANCH="release/v${MAJOR_MINOR}.x"
git fetch origin $RELEASE_BRANCH
git checkout -b "prepare-main-for-next-dev-cycle-${VERSION}" origin/$RELEASE_BRANCH

- name: Update version to next development version in main
# TODO update version in daily_scan.yml
run: |
DEV_VERSION="1.32.5.dev0"
sed -i "s/public static String VERSION = \".*\";/public static String VERSION = \"${DEV_VERSION}\";/" awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/Version.java
VERSION="1.32.5"
git add awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/Version.java

- name: Append latest release checksum to release-build-metadata.json
run: |
ARTIFACT_NAME="aws-opentelemetry-agent.jar"
curl -L -o $ARTIFACT_NAME https://github.com/aws-observability/aws-otel-java-instrumentation/releases/download/v1.32.5/$ARTIFACT_NAME

CHECKSUM=$(shasum -a 256 $ARTIFACT_NAME | awk '{ print $1 }')

FILE="release-build-metadata.json"
UPDATED_JSON=$(jq --arg version "${{ env.VERSION }}" \
--arg name "$ARTIFACT_NAME" \
--arg checksum "$CHECKSUM" \
'.release += [{"version": $version, "checksum": [{"name": $name, "checksum": $checksum}]}]' "$FILE")

echo "$UPDATED_JSON" > "$FILE"
git add release-build-metadata.json

- name: Push changes to Github
run: |
git commit -m "Prepare main for next development cycle: Update version to 1.32.5"
git push --set-upstream origin "prepare-main-for-next-dev-cycle-1.32.5"

- name: Create Pull Request to main
env:
GITHUB_TOKEN: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
run: |
DEV_VERSION="1.32.5.dev0"
gh pr create --title "Post release $VERSION: Update version to $DEV_VERSION" \
--body "This PR prepares the main branch for the next development cycle by updating the version to $DEV_VERSION and updating the image version to be scanned to the latest released.

This PR should only be merge when release for version v$VERSION is success.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \
--head prepare-main-for-next-dev-cycle-${VERSION} \
--base main
21 changes: 21 additions & 0 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,24 @@ jobs:
--draft \
"v${{ github.event.inputs.version }}" \
aws-opentelemetry-agent.jar

- name: Get SHA256 checksum of wheel file
id: get_sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
checksum=$(shasum -a 256 aws-opentelemetry-agent.jar | awk '{ print $1 }')
echo "CHECKSUM=$checksum" >> $GITHUB_OUTPUT

- name: Append checksum and update version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "${{ github.event.inputs.version }} ${{ steps.get_sha256.outputs.CHECKSUM }}" >> checksum.txt
echo "${{ github.event.inputs.version }}" > version.txt

git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "GitHub Action Release Workflow"
git add checksum.txt version.txt
git commit -m "Update latest version and append checksum"
git push
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright Amazon.com, Inc. or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

package software.amazon.opentelemetry.javaagent.providers;

import io.opentelemetry.api.common.AttributeKey;

/** Utility class holding attribute keys with special meaning to AWS components */
final class AwsAttributeKeys {

private AwsAttributeKeys() {}

static final String VERSION = "1.32.5.dev0";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright Amazon.com, Inc. or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

package software.amazon.opentelemetry.javaagent.providers;

static class Version {
public static String VERSION = "1.32.5.dev0";
}
Empty file added checksum.txt
Empty file.
22 changes: 22 additions & 0 deletions release-build-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"release": [
{
"version": "1.32.5",
"checksum": [
{
"name": "aws-opentelemetry-agent.jar",
"checksum": "1644b11c2c90747c99934c3c52d800e95bfb854e459ba9f50054b21233c65c37"
}
]
},
{
"version": "1.32.7",
"checksum": [
{
"name": "aws-opentelemetry-agent.jar",
"checksum": "1644b11c2c90747c99934c3c52d800e95bfb854e459ba9f50054b21233c65c37"
}
]
}
]
}
Empty file added version.txt
Empty file.
Loading