diff --git a/.github/workflows/package-prepare-patch-release.yml b/.github/workflows/package-prepare-patch-release.yml new file mode 100644 index 0000000000..e9cc7d55ba --- /dev/null +++ b/.github/workflows/package-prepare-patch-release.yml @@ -0,0 +1,116 @@ +name: "[Package] Prepare patch release" +on: + workflow_dispatch: + inputs: + package: + type: choice + options: + - opentelemetry-propagator-aws-xray + - opentelemetry-resource-detector-azure + - opentelemetry-sdk-extension-aws + description: 'Package to be released' + required: true +jobs: + prepare-patch-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Verify prerequisites + run: | + if [[ $GITHUB_REF_NAME != package-release/${{ inputs.package }}/v* ]]; then + echo this workflow should only be run against package-release/${{ inputs.package }}* branches, but is running on $GITHUB_REF_NAME + exit 1 + fi + + path=./$(./scripts/eachdist.py find-package --package ${{ inputs.package }}) + changelog=$path/CHANGELOG.md + + if [ ! -f $changelog ]; then + echo "missing $changelog file" + exit 1 + fi + + if ! grep --quiet "^## Unreleased$" CHANGELOG.md; then + echo the $changelog is missing an \"Unreleased\" section + exit 1 + fi + + version=$(./scripts/eachdist.py version --package ${{ inputs.package }}) + + version_file=$(find $path -type f -path "*version*.py") + file_count=$(echo "$version_file" | wc -l) + + if [ "$file_count" -ne 1 ]; then + echo "Error: expected one version file, found $file_count" + echo "$version_file" + exit 1 + fi + + if [[ $version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then + # 1.2.3 or 1.2.3rc1 + major="${BASH_REMATCH[1]}" + minor="${BASH_REMATCH[2]}" + patch="${BASH_REMATCH[3]}" + next_version="$major.$minor.$((patch + 1))" + release_branch_name="package-release/${{ inputs.package }}/v$major.$minor.x" + elif [[ $version =~ ^([0-9]+)\.([0-9]+)b([0-9]+)$ ]]; then + # 0.1b1 + major="${BASH_REMATCH[1]}" + minor="${BASH_REMATCH[2]}" + patch="${BASH_REMATCH[3]}" + next_version="$major.${minor}b$((patch + 1))" + release_branch_name="package-release/${{ inputs.package }}/v$major.${minor}bx" + else + echo "unexpected version: '$version'" + exit 1 + fi + + if [[ $GITHUB_REF_NAME != $release_branch_name ]]; then + echo this workflow should only be run against $release_branch_name branch, but is running on $GITHUB_REF_NAME + exit 1 + fi + + echo "PACKAGE_NAME=${{ inputs.package }}" >> $GITHUB_ENV + echo "VERSION=$version" >> $GITHUB_ENV + echo "NEXT_VERSION=$next_version" >> $GITHUB_ENV + echo "CHANGELOG=$changelog" >> $GITHUB_ENV + echo "VERSION_FILE=$version_file" >> $GITHUB_ENV + + - name: Update version + run: | + # replace the version in the version file (1.2.3 -> 1.2.4) + sed -i -E "s/__version__\s*=\s*\"${VERSION}\"/__version__ = \"${NEXT_VERSION}\"/g" $VERSION_FILE + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: 3.9 + - name: Install tox + run: pip install tox + - name: run tox + run: tox -e generate + + - name: Update the change log with the approximate release date + run: | + # the actual release date on main will be updated at the end of the release workflow + date=$(date "+%Y-%m-%d") + sed -Ei "s/^## Unreleased$/## Unreleased\n\n## Version ${NEXT_VERSION} ($date)/" ${CHANGELOG} + + - name: Use CLA approved github bot + run: .github/scripts/use-cla-approved-github-bot.sh + + - name: Create pull request + env: + # not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows + GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} + run: | + message="Prepare patch release for ${PACKAGE_NAME} v${NEXT_VERSION}" + branch="opentelemetrybot/patch-${PACKAGE_NAME}-version-to-v${NEXT_VERSION}" + + git commit -a -m "$message" + git push origin HEAD:$branch + gh pr create --title "[$GITHUB_REF_NAME] $message" \ + --body "$message." \ + --head $branch \ + --base $GITHUB_REF_NAME diff --git a/.github/workflows/package-prepare-release.yml b/.github/workflows/package-prepare-release.yml new file mode 100644 index 0000000000..61dd1eb971 --- /dev/null +++ b/.github/workflows/package-prepare-release.yml @@ -0,0 +1,194 @@ +name: "[Package] Prepare release" +on: + workflow_dispatch: + inputs: + package: + type: choice + options: + - opentelemetry-propagator-aws-xray + - opentelemetry-resource-detector-azure + - opentelemetry-sdk-extension-aws + description: 'Package to be released' + required: true + +jobs: + prereqs: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.verify.outputs.version }} + changelog: ${{ steps.verify.outputs.changelog }} + version_file: ${{ steps.verify.outputs.version_file }} + release_branch_name: ${{ steps.verify.outputs.release_branch_name }} + next_version: ${{ steps.verify.outputs.next_version }} + steps: + - uses: actions/checkout@v4 + + - id: verify + name: Verify prerequisites + run: | + if [[ $GITHUB_REF_NAME != main ]]; then + echo this workflow should only be run against main + exit 1 + fi + + path=./$(./scripts/eachdist.py find-package --package ${{ inputs.package }}) + changelog=$path/CHANGELOG.md + + if [ ! -f $changelog ]; then + echo "missing $changelog file" + exit 1 + fi + + if ! grep --quiet "^## Unreleased$" $changelog; then + echo the $changelog is missing an \"Unreleased\" section + exit 1 + fi + + version_dev=$(./scripts/eachdist.py version --package ${{ inputs.package }}) + + if [[ ! $version_dev =~ ^([0-9]+)\.([0-9]+)[\.|b]{1}([0-9]+).*.dev$ ]]; then + echo "unexpected version: $version" + exit 1 + fi + + version=${version_dev%.dev} + + version_file=$(find $path -type f -path "*version*.py") + file_count=$(echo "$version_file" | wc -l) + + if [ "$file_count" -ne 1 ]; then + echo "Error: expected one version file, found $file_count" + echo "$version_file" + exit 1 + fi + + if [[ $version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then + # 1.2.3 or 1.2.3rc1 + major="${BASH_REMATCH[1]}" + minor="${BASH_REMATCH[2]}" + release_branch_name="package-release/${{ inputs.package }}/v$major.$minor.x" + next_version="$major.$((minor + 1)).0" + elif [[ $version =~ ^([0-9]+)\.([0-9]+)b([0-9]+)$ ]]; then + # 0.1b1 + major="${BASH_REMATCH[1]}" + minor="${BASH_REMATCH[2]}" + release_branch_name="package-release/${{ inputs.package }}/v$major.${minor}bx" + next_version="$major.$((minor + 1))b0" + else + echo "unexpected version: '$version'" + exit 1 + fi + + echo "version=$version" >> $GITHUB_OUTPUT + echo "changelog=$changelog" >> $GITHUB_OUTPUT + echo "version_file=$version_file" >> $GITHUB_OUTPUT + echo "release_branch_name=$release_branch_name" >> $GITHUB_OUTPUT + echo "next_version=$next_version" >> $GITHUB_OUTPUT + + create-pull-request-against-release-branch: + runs-on: ubuntu-latest + needs: prereqs + steps: + - uses: actions/checkout@v4 + + - name: Set environment variables + run: | + echo "RELEASE_BRANCH_NAME=${{ needs.prereqs.outputs.release_branch_name }}" >> $GITHUB_ENV + echo "VERSION=${{ needs.prereqs.outputs.version }}" >> $GITHUB_ENV + echo "CHANGELOG=${{ needs.prereqs.outputs.changelog }}" >> $GITHUB_ENV + echo "VERSION_FILE=${{ needs.prereqs.outputs.version_file }}" >> $GITHUB_ENV + echo "PACKAGE_NAME=${{ github.event.inputs.package }}" >> $GITHUB_ENV + + - name: Create package release branch + run: | + git push origin HEAD:$RELEASE_BRANCH_NAME + + - name: Update package version + run: | + # replace the version in the version file (1.2.3dev -> 1.2.3) + sed -i -E "s/__version__\s*=\s*\"${VERSION}\.dev\"/__version__ = \"${VERSION}\"/g" $VERSION_FILE + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: 3.9 + - name: Install tox + run: pip install tox + - name: run tox + run: tox -e generate + + - name: Update the change log with the approximate release date + run: | + date=$(date "+%Y-%m-%d") + sed -Ei "s/^## Unreleased$/## Version ${VERSION} ($date)/" ${CHANGELOG} + + - name: Use CLA approved github bot + run: .github/scripts/use-cla-approved-github-bot.sh + + - name: Create pull request against the release branch + env: + # not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows + GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} + run: | + message="Prepare release for ${PACKAGE_NAME} v${VERSION}" + branch="opentelemetrybot/prepare-${RELEASE_BRANCH_NAME}" + + git commit -a -m "$message" + git push origin HEAD:$branch + gh pr create --title "[$RELEASE_BRANCH_NAME] $message" \ + --body "$message." \ + --head $branch \ + --base $RELEASE_BRANCH_NAME + + create-pull-request-against-main: + runs-on: ubuntu-latest + needs: prereqs + steps: + - uses: actions/checkout@v4 + + - name: Set environment variables + run: | + echo "PACKAGE_NAME=${{ github.event.inputs.package }}" >> $GITHUB_ENV + echo "VERSION=${{ needs.prereqs.outputs.version }}" >> $GITHUB_ENV + echo "VERSION_FILE=${{ needs.prereqs.outputs.version_file }}" >> $GITHUB_ENV + echo "NEXT_VERSION=${{ needs.prereqs.outputs.next_version }}" >> $GITHUB_ENV + echo "CHANGELOG=${{ needs.prereqs.outputs.changelog }}" >> $GITHUB_ENV + + - name: Update version + run: | + # replace the version in the version file (1.2.3dev -> 1.3.3.dev) + sed -i -E "s/__version__\s*=\s*\"${VERSION}\.dev\"/__version__ = \"${NEXT_VERSION}.dev\"/g" $VERSION_FILE + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: 3.9 + - name: Install tox + run: pip install tox + - name: run tox + run: tox -e generate + + - name: Update the change log on main + run: | + # the actual release date on main will be updated at the end of the release workflow + date=$(date "+%Y-%m-%d") + sed -Ei "s/^## Unreleased$/## Unreleased\n\n## Version ${VERSION} ($date)/" ${CHANGELOG} + + - name: Use CLA approved github bot + run: .github/scripts/use-cla-approved-github-bot.sh + + - name: Create pull request against main + env: + # not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows + GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} + run: | + message="Update ${PACKAGE_NAME} version to v${NEXT_VERSION}" + body="Update \`${PACKAGE_NAME}\` version to v\`${NEXT_VERSION}\`." + branch="opentelemetrybot/update-${PACKAGE_NAME}-version-to-v${NEXT_VERSION}" + + git commit -a -m "$message" + git push origin HEAD:$branch + gh pr create --title "$message" \ + --body "$body" \ + --head $branch \ + --base main diff --git a/.github/workflows/package-release.yml b/.github/workflows/package-release.yml new file mode 100644 index 0000000000..823f2c83d2 --- /dev/null +++ b/.github/workflows/package-release.yml @@ -0,0 +1,156 @@ +name: "[Package] Release" +on: + workflow_dispatch: + inputs: + package: + type: choice + options: + - opentelemetry-propagator-aws-xray + - opentelemetry-resource-detector-azure + - opentelemetry-sdk-extension-aws + description: 'Package to be released' + required: true +jobs: + release: + runs-on: ubuntu-latest + steps: + - run: | + if [[ $GITHUB_REF_NAME != package-release/${{ inputs.package }}* ]]; then + echo this workflow should only be run against package-release/${{ inputs.package }}* branches + exit 1 + fi + + - uses: actions/checkout@v4 + + - name: Set environment variables + run: | + version=$(./scripts/eachdist.py version --package ${{ inputs.package }}) + if [[ $version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then + major="${BASH_REMATCH[1]}" + minor="${BASH_REMATCH[2]}" + patch="${BASH_REMATCH[3]}" + if [[ $patch != 0 ]]; then + prior_version_when_patch="${major}.${minor}.$((patch - 1))" + fi + elif [[ $version =~ ^([0-9]+)\.([0-9]+)b([0-9]+)$ ]]; then + major="${BASH_REMATCH[1]}" + minor="${BASH_REMATCH[2]}" + patch="${BASH_REMATCH[3]}" + + if [[ $patch != 0 ]]; then + prior_version_when_patch="${major}.${minor}b$((patch - 1))" + fi + else + echo "unexpected version: $version" + exit 1 + fi + + path=$(./scripts/eachdist.py find-package --package ${{ inputs.package }}) + echo "CHANGELOG=./$path/CHANGELOG.md" >> $GITHUB_ENV + echo "PACKAGE_NAME=${{ inputs.package }}" >> $GITHUB_ENV + echo "VERSION=$version" >> $GITHUB_ENV + echo "RELEASE_TAG=${{ inputs.package }}==$version" >> $GITHUB_ENV + echo "PRIOR_VERSION_WHEN_PATCH=$prior_version_when_patch" >> $GITHUB_ENV + + # check out main branch to verify there won't be problems with merging the change log + # at the end of this workflow + - uses: actions/checkout@v4 + with: + ref: main + + - name: Check that change log update was merged to main + run: | + if [[ -z $PRIOR_VERSION_WHEN_PATCH ]]; then + # not making a patch release + if ! grep --quiet "^## Version ${VERSION}" ${CHANGELOG}; then + echo the pull request generated by prepare-release-branch.yml needs to be merged first + exit 1 + fi + fi + + # back to the release branch + - uses: actions/checkout@v4 + + # next few steps publish to pypi + - uses: actions/setup-python@v5 + with: + python-version: '3.8' + + - name: Build wheels + run: ./scripts/build_a_package.sh + + - name: Install twine + run: | + pip install twine + + # The step below publishes to testpypi in order to catch any issues + # with the package configuration that would cause a failure to upload + # to pypi. One example of such a failure is if a classifier is + # rejected by pypi (e.g "3 - Beta"). This would cause a failure during the + # middle of the package upload causing the action to fail, and certain packages + # might have already been updated, this would be bad. + # EDIT: 5/31/2024 - TestPypi now requires a verified email. Commenting out as a temporary measure + # until we found TestPypi credentials. + # - name: Publish to TestPyPI + # env: + # TWINE_USERNAME: '__token__' + # TWINE_PASSWORD: ${{ secrets.test_pypi_token }} + # run: | + # twine upload --repository testpypi --skip-existing --verbose dist/* + + - name: Publish to PyPI + env: + TWINE_USERNAME: '__token__' + TWINE_PASSWORD: ${{ secrets.test_pypi_token }} + run: | + twine upload --repository testpypi --skip-existing --verbose dist/* + + - name: Generate release notes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./scripts/generate_release_notes.sh + + - name: Create GitHub release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create --target $GITHUB_REF_NAME \ + --title "${PACKAGE_NAME} ${VERSION}" \ + --notes-file /tmp/release-notes.txt \ + --discussion-category announcements \ + $RELEASE_TAG + + - uses: actions/checkout@v4 + with: + ref: main + + - name: Copy change log updates to main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./scripts/merge_changelog_to_main.sh + + - name: Use CLA approved github bot + run: .github/scripts/use-cla-approved-github-bot.sh + + - name: Create pull request against main + env: + # not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows + GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} + run: | + message="Copy changelog updates from $GITHUB_REF_NAME" + body="Copy changelog updates from \`$GITHUB_REF_NAME\`." + branch="opentelemetrybot/changelog-${GITHUB_REF_NAME//\//-}" + + if [[ -z $PRIOR_VERSION_WHEN_PATCH ]]; then + if git diff --quiet; then + echo there are no updates needed to the change log on main, not creating pull request + exit 0 # success + fi + fi + + git commit -a -m "$message" + git push origin HEAD:$branch + gh pr create --title "$message" \ + --body "$body" \ + --head $branch \ + --base main diff --git a/.github/workflows/publish-a-package-from-tag.yml b/.github/workflows/publish-a-package-from-tag.yml deleted file mode 100644 index a64f5fcf15..0000000000 --- a/.github/workflows/publish-a-package-from-tag.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Publish a Package from Tag - -on: - push: - tags: - - 'opentelemetry-*==[1-9]*.*' - -jobs: - publish-a-package: - name: Publish package from tag - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.9' - - name: Log tag that triggered publish workflow - run: echo "Attempting to publish package from tag $GITHUB_REF" - - name: Build wheel for tag - run: ./scripts/build_a_package.sh - - name: Install twine - run: | - pip install twine - # We don't need to publish to TestPyPI because we only publish 1 package. - # If it fails no other work needs to be reversed. - - name: Publish to PyPI - env: - TWINE_USERNAME: '__token__' - TWINE_PASSWORD: ${{ secrets.pypi_password }} - run: | - twine upload --skip-existing --verbose dist/* diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ec544b43c8..964d6f93df 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,7 +42,7 @@ jobs: echo "STABLE_VERSION=$stable_version" >> $GITHUB_ENV echo "UNSTABLE_VERSION=$unstable_version" >> $GITHUB_ENV - + echo "CHANGELOG=CHANGELOG.md" >> $GITHUB_ENV echo "PRIOR_VERSION_WHEN_PATCH=$prior_version_when_patch" >> $GITHUB_ENV - run: | @@ -101,23 +101,8 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - # conditional block not indented because of the heredoc - if [[ ! -z $PRIOR_VERSION_WHEN_PATCH ]]; then - cat > /tmp/release-notes.txt << EOF - This is a patch release on the previous $PRIOR_VERSION_WHEN_PATCH release, fixing the issue(s) below. - - EOF - fi - - # CHANGELOG_SECTION.md is also used at the end of the release workflow - # for copying the change log updates to main - sed -n "0,/^## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} /d;/^## Version /q;p" CHANGELOG.md \ - > /tmp/CHANGELOG_SECTION.md - - # the complex perl regex is needed because markdown docs render newlines as soft wraps - # while release notes render them as line breaks - perl -0pe 's/(?> /tmp/release-notes.txt + echo "VERSION=${STABLE_VERSION}\/${UNSTABLE_VERSION}" >> $GITHUB_ENV + ./scripts/generate_release_notes.sh - name: Create GitHub release env: @@ -138,47 +123,9 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - if [[ -z $PRIOR_VERSION_WHEN_PATCH ]]; then - # this was not a patch release, so the version exists already in the CHANGELOG.md - - # update the release date - date=$(gh release view v$STABLE_VERSION --json publishedAt --jq .publishedAt | sed 's/T.*//') - sed -Ei "s/## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} .*/## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} ($date)/" CHANGELOG.md - - # the entries are copied over from the release branch to support workflows - # where change log entries may be updated after preparing the release branch - - # copy the portion above the release, up to and including the heading - sed -n "0,/^## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} ($date)/p" CHANGELOG.md > /tmp/CHANGELOG.md - - # copy the release notes - cat /tmp/CHANGELOG_SECTION.md >> /tmp/CHANGELOG.md - - # copy the portion below the release - sed -n "0,/^## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} /d;0,/^## Version /{/^## Version/!d};p" CHANGELOG.md \ - >> /tmp/CHANGELOG.md - - # update the real CHANGELOG.md - cp /tmp/CHANGELOG.md CHANGELOG.md - else - # this was a patch release, so the version does not exist already in the CHANGELOG.md - - # copy the portion above the top-most release, not including the heading - sed -n "0,/^## Version /{ /^## Version /!p }" CHANGELOG.md > /tmp/CHANGELOG.md - - # add the heading - date=$(gh release view v$STABLE_VERSION --json publishedAt --jq .publishedAt | sed 's/T.*//') - echo "## Version ${STABLE_VERSION}/${UNSTABLE_VERSION} ($date)" >> /tmp/CHANGELOG.md - - # copy the release notes - cat /tmp/CHANGELOG_SECTION.md >> /tmp/CHANGELOG.md - - # copy the portion starting from the top-most release - sed -n "/^## Version /,\$p" CHANGELOG.md >> /tmp/CHANGELOG.md - - # update the real CHANGELOG.md - cp /tmp/CHANGELOG.md CHANGELOG.md - fi + echo "VERSION=${STABLE_VERSION}\/${UNSTABLE_VERSION}" >> $GITHUB_ENV + echo "RELEASE_TAG=$STABLE_VERSION" >> $GITHUB_ENV + ./scripts/merge_changelog_to_main.sh - name: Use CLA approved github bot run: .github/scripts/use-cla-approved-github-bot.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index af18236dab..90f0b3c90b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +> [!NOTE] +> The following components are released independently and maintain individual CHANGELOG files. +> Use [this search for a list of all CHANGELOG.md files in this repo](https://github.com/search?q=repo%3Aopen-telemetry%2Fopentelemetry-python-contrib+path%3A**%2FCHANGELOG.md&type=code). + ## Unreleased ## Version 1.27.0/0.49b0 () diff --git a/RELEASING.md b/RELEASING.md index 5a359159fb..c1c923b705 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -12,6 +12,21 @@ * Merge the one targeted towards the release branch. * The builds will fail for the `main` pr because of validation rules. Follow the [release workflow](https://github.com/open-telemetry/opentelemetry-python/blob/main/RELEASING.md) for the core repo up until this same point. Change the SHAs of each PR to point at each other to get the `main` builds to pass. +### Preparing a major or minor release for individual package + +> [!NOTE] +> Per-package release is supported for the following packages only: +> - opentelemetry-propagator-aws-xray +> - opentelemetry-resource-detector-azure +> - opentelemetry-sdk-extension-aws +> +> These libraries are also excluded from the general release. + +Package release preparation is handled by the [`[Package] Prepare release`](./.github/workflows/package-prepare-release.yml) workflow that allows +to pick a specific package to release. It follows the same versioning strategy and process as the general release. + +Long-term package release branch follows `package-release/{package-name}/v{major}.{minor}.x` (or `package-release/{package-name}/v{major}.{minor}bx`) naming pattern. + ## Preparing a new patch release * Backport pull request(s) to the release branch. @@ -27,6 +42,17 @@ e.g. `release/v1.9.x`, and click the "Run workflow" button below that. * Review and merge the pull request that it creates for updating the version. +### Preparing a patch release for individual package + +> [!NOTE] +> Per-package release is supported only for packages included in the corresponding workflow. Libraries that support per-package release are currently +> excluded from the general patch release. + +Per-package patch release preparation is handled by the [`[Package] Prepare patch release`](./.github/workflows/package-prepare-patch-release.yml) workflow that allows +to pick a specific package to release. + +The workflow can only be run against long-term release branch such as `package-release/{package-name}/v{major}.{minor}.x` or `package-release/{package-name}/v{major}.{minor}bx`. + ## Making the release * Run the [Release workflow](https://github.com/open-telemetry/opentelemetry-python-contrib/actions/workflows/release.yml). @@ -37,6 +63,21 @@ (note that if this is not a patch release then the change log on main may already be up-to-date, in which case no pull request will be created). +### Releasing individual package + +> [!NOTE] +> Per-package patch release is supported for the following packages only: +> - opentelemetry-propagator-aws-xray +> - opentelemetry-resource-detector-azure +> - opentelemetry-sdk-extension-aws +> +> These libraries are also excluded from the general patch release. + +Per-package release is handled by the [`[Package] Release`](./.github/workflows/package-release.yml) workflow that allows +to pick a specific package to release. + +The workflow can only be run against long-term release branch such as `package-release/{package-name}/v{major}.{minor}.x` or `package-release/{package-name}/v{major}.{minor}bx`. + ## Notes about version numbering for stable components * The version number for stable components in the `main` branch is always `X.Y.0.dev`, diff --git a/eachdist.ini b/eachdist.ini index 0ebc2053c7..5b045b6996 100644 --- a/eachdist.ini +++ b/eachdist.ini @@ -51,6 +51,7 @@ packages= opentelemetry-sdk-extension-aws opentelemetry-propagator-aws-xray opentelemetry-instrumentation-openai + opentelemetry-instrumentation-test [lintroots] extraroots=examples/*,scripts/ diff --git a/instrumentation/README.md b/instrumentation/README.md index 2a564f9344..f8d188cec3 100644 --- a/instrumentation/README.md +++ b/instrumentation/README.md @@ -44,6 +44,7 @@ | [opentelemetry-instrumentation-sqlite3](./opentelemetry-instrumentation-sqlite3) | sqlite3 | No | experimental | [opentelemetry-instrumentation-starlette](./opentelemetry-instrumentation-starlette) | starlette ~= 0.13.0 | Yes | experimental | [opentelemetry-instrumentation-system-metrics](./opentelemetry-instrumentation-system-metrics) | psutil >= 5 | No | experimental +| [opentelemetry-instrumentation-test](./opentelemetry-instrumentation-test) | test | No | migration | [opentelemetry-instrumentation-threading](./opentelemetry-instrumentation-threading) | threading | No | experimental | [opentelemetry-instrumentation-tornado](./opentelemetry-instrumentation-tornado) | tornado >= 5.1.1 | Yes | experimental | [opentelemetry-instrumentation-tortoiseorm](./opentelemetry-instrumentation-tortoiseorm) | tortoise-orm >= 0.17.0 | No | experimental diff --git a/instrumentation/opentelemetry-instrumentation-aws-lambda/pyproject.toml b/instrumentation/opentelemetry-instrumentation-aws-lambda/pyproject.toml index debc3ce033..6c1aad7d23 100644 --- a/instrumentation/opentelemetry-instrumentation-aws-lambda/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-aws-lambda/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ ] dependencies = [ "opentelemetry-instrumentation == 0.49b0.dev", - "opentelemetry-propagator-aws-xray ~= 1.0.1", "opentelemetry-semantic-conventions == 0.49b0.dev", + "opentelemetry-propagator-aws-xray ~= 1.0", ] [project.optional-dependencies] diff --git a/instrumentation/opentelemetry-instrumentation-botocore/pyproject.toml b/instrumentation/opentelemetry-instrumentation-botocore/pyproject.toml index 797145b728..dae5b29661 100644 --- a/instrumentation/opentelemetry-instrumentation-botocore/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-botocore/pyproject.toml @@ -28,7 +28,7 @@ dependencies = [ "opentelemetry-api ~= 1.12", "opentelemetry-instrumentation == 0.49b0.dev", "opentelemetry-semantic-conventions == 0.49b0.dev", - "opentelemetry-propagator-aws-xray ~= 1.0.1", + "opentelemetry-propagator-aws-xray ~= 1.0", ] [project.optional-dependencies] diff --git a/instrumentation/opentelemetry-instrumentation-test/LICENSE b/instrumentation/opentelemetry-instrumentation-test/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-test/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License 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. diff --git a/instrumentation/opentelemetry-instrumentation-test/README.rst b/instrumentation/opentelemetry-instrumentation-test/README.rst new file mode 100644 index 0000000000..fe5aeea554 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-test/README.rst @@ -0,0 +1,25 @@ +OpenTelemetry TEst Middleware +============================= + +|pypi| + +.. |pypi| image:: https://badge.fury.io/py/opentelemetry-instrumentation-test.svg + :target: https://pypi.org/project/opentelemetry-instrumentation-test/ + + +This library provides a test middleware that can be used on any test framework. + +Installation +------------ + +:: + + pip install opentelemetry-instrumentation-test + +References +---------- + +* `OpenTelemetry TEst Middleware `_ +* `OpenTelemetry Project `_ +* `WSGI `_ +* `OpenTelemetry Python Examples `_ diff --git a/instrumentation/opentelemetry-instrumentation-test/pyproject.toml b/instrumentation/opentelemetry-instrumentation-test/pyproject.toml new file mode 100644 index 0000000000..78e12624d0 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-test/pyproject.toml @@ -0,0 +1,49 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "opentelemetry-instrumentation-test" +dynamic = ["version"] +description = "test Middleware for OpenTelemetry" +readme = "README.rst" +license = "Apache-2.0" +requires-python = ">=3.8" +authors = [ + { name = "OpenTelemetry Authors", email = "cncf-opentelemetry-contributors@lists.cncf.io" }, +] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", +] +dependencies = [ + "opentelemetry-api ~= 1.12", + "opentelemetry-instrumentation ~= 0.47b0", + "opentelemetry-semantic-conventions == 0.47b0", +] + +[project.optional-dependencies] +instruments = [] + +[project.urls] +Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-test" + +[tool.hatch.version] +path = "src/opentelemetry/instrumentation/test/version.py" + +[tool.hatch.build.targets.sdist] +include = [ + "/src", + "/tests", +] + +[tool.hatch.build.targets.wheel] +packages = ["src/opentelemetry"] diff --git a/instrumentation/opentelemetry-instrumentation-test/src/opentelemetry/instrumentation/test/__init__.py b/instrumentation/opentelemetry-instrumentation-test/src/opentelemetry/instrumentation/test/__init__.py new file mode 100644 index 0000000000..3401275a73 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-test/src/opentelemetry/instrumentation/test/__init__.py @@ -0,0 +1,17 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License 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. +""" +This library provides a WSGI middleware that can be used on any WSGI framework +(such as Django / Flask / Web.py) to track requests timing through OpenTelemetry. +""" diff --git a/instrumentation/opentelemetry-instrumentation-test/src/opentelemetry/instrumentation/test/package.py b/instrumentation/opentelemetry-instrumentation-test/src/opentelemetry/instrumentation/test/package.py new file mode 100644 index 0000000000..361eac89c9 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-test/src/opentelemetry/instrumentation/test/package.py @@ -0,0 +1,20 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License 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. + + +_instruments = tuple() + +_supports_metrics = False + +_semconv_status = "migration" diff --git a/instrumentation/opentelemetry-instrumentation-test/src/opentelemetry/instrumentation/test/version.py b/instrumentation/opentelemetry-instrumentation-test/src/opentelemetry/instrumentation/test/version.py new file mode 100644 index 0000000000..0d3adda0a2 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-test/src/opentelemetry/instrumentation/test/version.py @@ -0,0 +1,15 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License 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. + +__version__ = "1.0.0b.dev" diff --git a/instrumentation/opentelemetry-instrumentation-test/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-test/test-requirements.txt new file mode 100644 index 0000000000..743026e94a --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-test/test-requirements.txt @@ -0,0 +1,14 @@ +asgiref==3.8.1 +Deprecated==1.2.14 +importlib-metadata==6.11.0 +iniconfig==2.0.0 +packaging==24.0 +pluggy==1.5.0 +py-cpuinfo==9.0.0 +pytest==7.4.4 +tomli==2.0.1 +typing_extensions==4.9.0 +wrapt==1.16.0 +zipp==3.19.2 +opentelemetry-instrumentation==0.48b0 +-e instrumentation/opentelemetry-instrumentation-test diff --git a/instrumentation/opentelemetry-instrumentation-test/tests/__init__.py b/instrumentation/opentelemetry-instrumentation-test/tests/__init__.py new file mode 100644 index 0000000000..a0b2062b52 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-test/tests/__init__.py @@ -0,0 +1,23 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License 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. +import pkg_resources + +# IMPORTANT: Only the TEst module needs this because it is always the first +# package that uses the `{rootdir}/*/tests/` path and gets installed by +# `eachdist.py` and according to `eachdist.ini`. + +# Naming the tests module as a namespace package ensures that +# relative imports will resolve properly for subsequent test packages, +# as it enables searching for a composite of multiple test modules. +pkg_resources.declare_namespace(__name__) diff --git a/opentelemetry-contrib-instrumentations/pyproject.toml b/opentelemetry-contrib-instrumentations/pyproject.toml index 3a9c94c295..3912681d96 100644 --- a/opentelemetry-contrib-instrumentations/pyproject.toml +++ b/opentelemetry-contrib-instrumentations/pyproject.toml @@ -72,6 +72,7 @@ dependencies = [ "opentelemetry-instrumentation-sqlite3==0.49b0.dev", "opentelemetry-instrumentation-starlette==0.49b0.dev", "opentelemetry-instrumentation-system-metrics==0.49b0.dev", + "opentelemetry-instrumentation-test==1.0.0b.dev", "opentelemetry-instrumentation-threading==0.49b0.dev", "opentelemetry-instrumentation-tornado==0.49b0.dev", "opentelemetry-instrumentation-tortoiseorm==0.49b0.dev", diff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py index 3fd0bc39e3..3a3aedfaa9 100644 --- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py +++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py @@ -198,6 +198,7 @@ "opentelemetry-instrumentation-dbapi==0.49b0.dev", "opentelemetry-instrumentation-logging==0.49b0.dev", "opentelemetry-instrumentation-sqlite3==0.49b0.dev", + "opentelemetry-instrumentation-test==1.0.0b.dev", "opentelemetry-instrumentation-threading==0.49b0.dev", "opentelemetry-instrumentation-urllib==0.49b0.dev", "opentelemetry-instrumentation-wsgi==0.49b0.dev", diff --git a/propagator/opentelemetry-propagator-aws-xray/CHANGELOG.md b/propagator/opentelemetry-propagator-aws-xray/CHANGELOG.md new file mode 100644 index 0000000000..bb0292f819 --- /dev/null +++ b/propagator/opentelemetry-propagator-aws-xray/CHANGELOG.md @@ -0,0 +1,13 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## Unreleased + +## Version 1.0.2 (2024-08-05) + +See [common CHANGELOG](../../CHANGELOG.md) for the changes in this and prior versions. + diff --git a/propagator/opentelemetry-propagator-aws-xray/src/opentelemetry/propagators/aws/version.py b/propagator/opentelemetry-propagator-aws-xray/src/opentelemetry/propagators/aws/version.py index 1a30b96547..12da797c60 100644 --- a/propagator/opentelemetry-propagator-aws-xray/src/opentelemetry/propagators/aws/version.py +++ b/propagator/opentelemetry-propagator-aws-xray/src/opentelemetry/propagators/aws/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.0.2" +__version__ = "1.1.0.dev" diff --git a/resource/opentelemetry-resource-detector-azure/src/opentelemetry/resource/detector/azure/version.py b/resource/opentelemetry-resource-detector-azure/src/opentelemetry/resource/detector/azure/version.py index fac29d773f..3e15120575 100644 --- a/resource/opentelemetry-resource-detector-azure/src/opentelemetry/resource/detector/azure/version.py +++ b/resource/opentelemetry-resource-detector-azure/src/opentelemetry/resource/detector/azure/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.1.5" +__version__ = "0.2.0.dev" diff --git a/scripts/build_a_package.sh b/scripts/build_a_package.sh index 333deccd80..e5642dbd09 100755 --- a/scripts/build_a_package.sh +++ b/scripts/build_a_package.sh @@ -14,23 +14,27 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This script builds wheels for a single package when triggered from a push to -# a tag as part of a GitHub workflow (See .github/publish-a-package.yml). The -# wheel is then published to PyPI. +# This script builds wheels for a single package when triggered from per-package release +# GitHub workflow (see .github/package-release.yml). +# The wheel is then published to PyPI by the workflow. set -ev -if [ -z $GITHUB_REF ]; then - echo 'Failed to run script, missing workflow env variable GITHUB_REF.' +if [ $PACKAGE_NAME ]; then + pkg_name=${PACKAGE_NAME} + pkg_version=${VERSION} +elif [ $GITHUB_REF ]; then + pkg_name_and_version=${GITHUB_REF#refs/tags/*} + pkg_name=${pkg_name_and_version%==*} + pkg_version=${pkg_name_and_version#opentelemetry-*==} +else + echo 'Failed to run script, missing workflow env variable GITHUB_REF or PACKAGE_NAME and VERSION.' exit 1 fi -pkg_name_and_version=${GITHUB_REF#refs/tags/*} -pkg_name=${pkg_name_and_version%==*} -pkg_version=${pkg_name_and_version#opentelemetry-*==} # Get the latest versions of packaging tools -python3 -m pip install --upgrade pip setuptools wheel packaging +python3 -m pip install --upgrade pip build setuptools wheel packaging # Validate version against PEP 440 conventions: https://packaging.pypa.io/en/latest/version.html python3 -c "from packaging.version import Version; Version('${pkg_version}')" @@ -57,7 +61,12 @@ python3 -m build --outdir ${distdir} cd $distdir -pkg_tar_gz_file=${pkg_name}-${pkg_version}.tar.gz +pkg_tar_gz_file=`echo $pkg_name | sed 's/-/_/g'`-${pkg_version}.tar.gz + +echo "Checking if $pkg_tar_gz_file exists in dist/ directory." + +# print the list of files in current directory +echo "$(ls)" if ! [ -f $pkg_tar_gz_file ]; then echo 'Error! Tag version does not match version built using latest package files.' diff --git a/scripts/eachdist.py b/scripts/eachdist.py index 2eaabee2c7..57d98206b7 100755 --- a/scripts/eachdist.py +++ b/scripts/eachdist.py @@ -260,7 +260,23 @@ def setup_instparser(instparser): See description of exec for available options.""" ), ) + versionparser.add_argument( + "--package", + "-p", + required=False, + help="Name of a specific package to get the version for", + ) + findparser = subparsers.add_parser( + "find-package", help="Find package path.", + ) + findparser.set_defaults(func=find_package_args) + findparser.add_argument( + "--package", + "-p", + required=True, + help="Name of the package to find", + ) return parser.parse_args(args) @@ -478,7 +494,7 @@ def install_args(args): ), ) ) - + if args.with_dev_deps: rootpath = find_projectroot() runsubprocess( @@ -726,8 +742,37 @@ def format_args(args): def version_args(args): cfg = ConfigParser() cfg.read(str(find_projectroot() / "eachdist.ini")) - print(cfg[args.mode]["version"]) + if not args.package: + print(cfg[args.mode]["version"]) + return + + root = find_projectroot() + for package in find_targets_unordered(root): + if args.package == package.name: + version_file = find("version.py", package) + if version_file is None: + print(f"file missing: {package}/version.py") + return + with open(version_file, encoding="utf-8") as file: + for line in file: + if "__version__" in line: + print(line.split('"')[1]) + return + + print("package not found") + sys.exit(1) + +def find_package_args(args): + root = find_projectroot() + for package in find_targets_unordered(root): + if args.package == package.name: + relative_path = package.relative_to(root) + print(relative_path) + return + + print("package not found") + sys.exit(1) def main(): args = parse_args() diff --git a/scripts/generate_release_notes.sh b/scripts/generate_release_notes.sh new file mode 100755 index 0000000000..193e624174 --- /dev/null +++ b/scripts/generate_release_notes.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# This script copies release notes for the current version from CHANGELOG.md file +# and stores them in /tmp/release-notes.txt. +# It also stores them in a /tmp/CHANGELOG_SECTION.md which is used later to copy them over to the +# CHANGELOG in main branch which is done by merge_changelog_to_main script. + +# This script is called from the release workflows (package-release.yml and release.yml). + +set -ev + +# conditional block not indented because of the heredoc +if [[ ! -z $PRIOR_VERSION_WHEN_PATCH ]]; then +cat > /tmp/release-notes.txt << EOF +This is a patch release on the previous $PRIOR_VERSION_WHEN_PATCH release, fixing the issue(s) below. + +EOF +fi + +# CHANGELOG_SECTION.md is also used at the end of the release workflow +# for copying the change log updates to main +sed -n "0,/^## Version ${VERSION}/d;/^## Version /q;p" $CHANGELOG > /tmp/CHANGELOG_SECTION.md + +# the complex perl regex is needed because markdown docs render newlines as soft wraps +# while release notes render them as line breaks +perl -0pe 's/(?> /tmp/release-notes.txt diff --git a/scripts/merge_changelog_to_main.sh b/scripts/merge_changelog_to_main.sh new file mode 100755 index 0000000000..ee7d027c97 --- /dev/null +++ b/scripts/merge_changelog_to_main.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# This script copies release notes for the current version from CHANGELOG.md file +# and stores them in a temporary file for later use in the release workflow + +# This script is called from the release workflows (package-release.yml and release.yml). + +set -ev + +if [[ -z $PRIOR_VERSION_WHEN_PATCH ]]; then + # this was not a patch release, so the version exists already in the CHANGELOG.md + + # update the release date + date=$(gh release view $RELEASE_TAG --json publishedAt --jq .publishedAt | sed 's/T.*//') + sed -Ei "s/## Version ${VERSION}.*/## Version ${VERSION} ($date)/" ${CHANGELOG} + + # the entries are copied over from the release branch to support workflows + # where change log entries may be updated after preparing the release branch + + # copy the portion above the release, up to and including the heading + sed -n "0,/^## Version ${VERSION} ($date)/p" ${CHANGELOG} > /tmp/CHANGELOG.md + + # copy the release notes + cat /tmp/CHANGELOG_SECTION.md >> /tmp/CHANGELOG.md + + # copy the portion below the release + sed -n "0,/^## Version ${VERSION} /d;0,/^## Version /{/^## Version/!d};p" ${CHANGELOG} \ + >> /tmp/CHANGELOG.md + + # update the real CHANGELOG.md + cp /tmp/CHANGELOG.md ${CHANGELOG} +else + # this was a patch release, so the version does not exist already in the CHANGELOG.md + + # copy the portion above the top-most release, not including the heading + sed -n "0,/^## Version /{ /^## Version /!p }" ${CHANGELOG} > /tmp/CHANGELOG.md + + # add the heading + date=$(gh release view $RELEASE_TAG --json publishedAt --jq .publishedAt | sed 's/T.*//') + echo "## Version ${VERSION} ($date)" >> /tmp/CHANGELOG.md + + # copy the release notes + cat /tmp/CHANGELOG_SECTION.md >> /tmp/CHANGELOG.md + + # copy the portion starting from the top-most release + sed -n "/^## Version /,\$p" ${CHANGELOG} >> /tmp/CHANGELOG.md + + # update the real CHANGELOG.md + cp /tmp/CHANGELOG.md ${CHANGELOG} +fi \ No newline at end of file diff --git a/sdk-extension/opentelemetry-sdk-extension-aws/CHANGELOG.md b/sdk-extension/opentelemetry-sdk-extension-aws/CHANGELOG.md new file mode 100644 index 0000000000..2d01260554 --- /dev/null +++ b/sdk-extension/opentelemetry-sdk-extension-aws/CHANGELOG.md @@ -0,0 +1,13 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## Unreleased + +## Version 2.0.2 (2024-08-05) + +See [common CHANGELOG](../../CHANGELOG.md) for the changes in this and prior versions. + diff --git a/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/version.py b/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/version.py index c9cb3877e2..b065755302 100644 --- a/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/version.py +++ b/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "2.0.2" +__version__ = "2.1.0.dev"