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

[chore] added a new chloggen to track changes to the contrib #125

Merged
merged 9 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
23 changes: 23 additions & 0 deletions .chloggen-aws/TEMPLATE.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type:

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component:

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note:

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: []

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# e.g. '[aws]'
# Include 'aws' if the change is done done by cwa
# Default: '[user]'
change_logs: [aws]
26 changes: 26 additions & 0 deletions .chloggen-aws/changelog-aws.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: 'new_component'

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: changelog

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Added a chloggen for cwa"

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [125]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: Added a new changelog directory that stores the changelog yaml files created by the cwa team with (make chlog-new-aws)
Added a new CHANGELOG-AWS.md file for cwa team.
make chlog-update-aws will update the CHANGELOG-AWS.md file with the .chloggen-aws files and delete the .chloggen-aws directory yaml after updating.


# e.g. '[aws]'
# Include 'aws' if the change is done done by cwa
# Default: '[user]'
change_logs: [aws]
23 changes: 23 additions & 0 deletions .chloggen-aws/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# The directory that stores individual changelog entries.
# Each entry is stored in a dedicated yaml file.
# - 'chloggen new' will copy the 'template_yaml' to this directory as a new entry file.
# - 'chloggen validate' will validate that all entry files are valid.
# - 'chloggen update' will read and delete all entry files in this directory, and update 'changelog_md'.
# Specify as relative path from root of repo.
# (Optional) Default: .chloggen
entries_dir: .chloggen-aws

# This file is used as the input for individual changelog entries.
# Specify as relative path from root of repo.
# (Optional) Default: .chloggen/TEMPLATE.yaml
template_yaml: .chloggen-aws/TEMPLATE.yaml

# The CHANGELOG file or files to which 'chloggen update' will write new entries
# (Optional) Default filename: CHANGELOG.md
change_logs:
aws: CHANGELOG-AWS.md

# The default change_log or change_logs to which an entry should be added.
# If 'change_logs' is specified in this file, and no value is specified for 'default_change_logs',
# then 'change_logs' MUST be specified in every entry file.
default_change_logs: [aws]
93 changes: 93 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# This action requires that any PR targeting the main branch should add a
Copy link

Choose a reason for hiding this comment

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

nit: This action requires that any PR targeting the aws-cwa-dev branch

Copy link
Author

Choose a reason for hiding this comment

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

changed.

# yaml file to the ./.chloggen/ directory. If a CHANGELOG entry is not required,
# or if performing maintance on the Changelog, add either \"[chore]\" to the title of
# the pull request or add the \"Skip Changelog\" label to disable this action.

name: changelog

on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
Copy link

Choose a reason for hiding this comment

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

Based on previous conversations, I think the agreement is to render change log entry into CHANGELOG-AWS.md when a PR is merged.

Looks like this workflow checks if a changelog entry is added on PR creation, but is there a workflow to automatically convert the entry post-merge or am I missing something?

branches:
- aws-cwa-dev
env:
# Make sure to exit early if cache segment download times out after 2 minutes.
# We limit cache download as a whole to 5 minutes.
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
changelog:
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
env:
PR_HEAD: ${{ github.event.pull_request.head.sha }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: ~1.20.10
cache: false
- name: Cache Go
id: go-cache
timeout-minutes: 5
uses: actions/cache@v3
with:
path: |
~/go/bin
~/go/pkg/mod
key: changelog-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- name: Ensure no changes to the CHANGELOG-AWS.md
if: ${{ !contains(github.event.pull_request.labels.*.name, 'dependencies') && !contains(github.event.pull_request.labels.*.name, 'Skip Changelog') && !contains(github.event.pull_request.title, '[chore]')}}
run: |
if [[ $(git diff --name-only $(git merge-base origin/main $PR_HEAD) $PR_HEAD ./CHANGELOG-AWS.md) ]]
then
echo "CHANGELOG-AWS.md should not be directly modified."
echo "Please add a .yaml file to the ./.chloggen-aws/ directory."
echo "See CONTRIBUTING-AWS.md for more details."
echo "Alternately, add either \"[chore]\" to the title of the pull request or add the \"Skip Changelog\" label if this job should be skipped."
false
else
echo "CHANGELOG-AWS.md were not modified."
fi
- name: Ensure ./.chloggen-aws/*.yaml addition(s)
if: ${{ !contains(github.event.pull_request.labels.*.name, 'dependencies') && !contains(github.event.pull_request.labels.*.name, 'Skip Changelog') && !contains(github.event.pull_request.title, '[chore]')}}
run: |
if [[ 1 -gt $(git diff --diff-filter=A --name-only $(git merge-base origin/main $PR_HEAD) $PR_HEAD ./.chloggen-aws | grep -c \\.yaml) ]]
then
echo "No changelog entry was added to the ./.chloggen-aws/ directory."
echo "Please add a .yaml file to the ./.chloggen-aws/ directory."
echo "See CONTRIBUTING-AWS.md for more details."
echo "Alternately, add either \"[chore]\" to the title of the pull request or add the \"Skip Changelog\" label if this job should be skipped."
false
else
ls ./.chloggen-aws
echo "A changelog entry was added to the ./.chloggen-aws/ directory."
fi

- name: Validate ./.chloggen/*.yaml changes
run: |
make chlog-validate-aws \
|| { echo "New ./.chloggen-aws/*.yaml file failed validation."; exit 1; }

# In order to validate any links in the yaml file, render the config to markdown
- name: Render .chloggen changelog entries
if: ${{ !contains(github.event.pull_request.labels.*.name, 'dependencies') && !contains(github.event.pull_request.labels.*.name, 'Skip Changelog') && !contains(github.event.pull_request.title, '[chore]')}}
run: make chlog-preview-aws > changelog_preview.md
- name: Install markdown-link-check
if: ${{ !contains(github.event.pull_request.labels.*.name, 'dependencies') && !contains(github.event.pull_request.labels.*.name, 'Skip Changelog') && !contains(github.event.pull_request.title, '[chore]')}}
run: npm install -g markdown-link-check
- name: Run markdown-link-check
if: ${{ !contains(github.event.pull_request.labels.*.name, 'dependencies') && !contains(github.event.pull_request.labels.*.name, 'Skip Changelog') && !contains(github.event.pull_request.title, '[chore]')}}
run: |
markdown-link-check \
--verbose \
--config .github/workflows/check_links_config.json \
changelog_preview.md \
|| { echo "Check that anchor links are lowercase"; exit 1; }
38 changes: 38 additions & 0 deletions .github/workflows/prepare-release-cwa-aws.yml
Copy link

Choose a reason for hiding this comment

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

Do we need this file? We are never "releasing" the OTEL agent, but just updating the component so we can reference it in CWAgent code.

Copy link
Author

Choose a reason for hiding this comment

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

We can update with the command as well "make chlog-update-aws --version v1.1.1" . We can discuss the best way and we can work on it. For now we can store chnages in yaml files.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Automation - Prepare Release

on:
workflow_dispatch:
# Determine the version number that will be assigned to the release. During the beta phase, we increment
# the minor version number and set the patch number to 0.
inputs:
candidate-beta:
required: true
description: Release candidate version (beta, like 0.70.0)

current-beta:
required: true
description: Current version (beta, like 0.69.1)
jobs:
# Releasing opentelemetry-collector-contrib
prepare-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: 'open-telemetry/opentelemetry-collector'
path: opentelemetry-collector
- uses: actions/checkout@v4
with:
path: opentelemetry-collector-contrib
- uses: actions/setup-go@v4
with:
go-version: ~1.20.8
cache: false
- name: Prepare release for contrib
working-directory: opentelemetry-collector-contrib
env:
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
REPO: open-telemetry/opentelemetry-collector-contrib
CANDIDATE_BETA: ${{ inputs.candidate-beta }}
CURRENT_BETA: ${{ inputs.current-beta }}
run: ./.github/workflows/scripts/release-prepare-release-cwa-aws.sh
65 changes: 65 additions & 0 deletions .github/workflows/scripts/release-prepare-release-cwa-aws.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash -ex

# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

PATTERN="^[0-9]+\.[0-9]+\.[0-9]+.*"
if ! [[ ${CURRENT_BETA} =~ $PATTERN ]]
then
echo "CURRENT_BETA should follow a semver format and not be led by a v"
exit 1
fi

if ! [[ ${CANDIDATE_BETA} =~ $PATTERN ]]
then
echo "CANDIDATE_BETA should follow a semver format and not be led by a v"
exit 1
fi

make chlog-update-aws VERSION="v${CANDIDATE_BETA}"
git config user.name opentelemetrybot
git config user.email [email protected]

BRANCH="prepare-release-prs/${CANDIDATE_BETA}"
git checkout -b "${BRANCH}"
git add --all
git commit -m "changelog update ${CANDIDATE_BETA}"

sed -i.bak "s/${CURRENT_BETA}/${CANDIDATE_BETA}/g" versions.yaml
find . -name "*.bak" -type f -delete
git add versions.yaml
git commit -m "update version.yaml ${CANDIDATE_BETA}"

sed -i.bak "s/v${CURRENT_BETA}/v${CANDIDATE_BETA}/g" ./cmd/oteltestbedcol/builder-config.yaml
sed -i.bak "s/v${CURRENT_BETA}/v${CANDIDATE_BETA}/g" ./cmd/otelcontribcol/builder-config.yaml
sed -i.bak "s/${CURRENT_BETA}-dev/${CANDIDATE_BETA}-dev/g" ./cmd/otelcontribcol/builder-config.yaml
sed -i.bak "s/${CURRENT_BETA}-dev/${CANDIDATE_BETA}-dev/g" ./cmd/oteltestbedcol/builder-config.yaml

find . -name "*.bak" -type f -delete
make genotelcontribcol
make genoteltestbedcol
git add .
git commit -m "builder config changes ${CANDIDATE_BETA}" || (echo "no builder config changes to commit")

make multimod-prerelease
git add .
git commit -m "make multimod-prerelease changes ${CANDIDATE_BETA}" || (echo "no multimod changes to commit")

make multimod-sync
git add .
git commit -m "make multimod-sync changes ${CANDIDATE_BETA}" || (echo "no multimod changes to commit")

make gotidy
git add .
git commit -m "make gotidy changes ${CANDIDATE_BETA}" || (echo "no gotidy changes to commit")
make otelcontribcol

git push origin "${BRANCH}"

gh pr create --title "[chore] Prepare release ${CANDIDATE_BETA}" --body "
Copy link

Choose a reason for hiding this comment

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

Do we need this file? We are never "releasing" the OTEL agent, but just updating the component so we can reference it in CWAgent code.

Copy link
Author

Choose a reason for hiding this comment

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

We can update with the command as well "make chlog-update-aws --version v1.1.1" . We can discuss the best way and we can work on it. For now we can store chnages in yaml files.

The following commands were run to prepare this release:
- make chlog-update VERSION=v${CANDIDATE_BETA}
- sed -i.bak s/${CURRENT_BETA}/${CANDIDATE_BETA}/g versions.yaml
- make multimod-prerelease
- make multimod-sync
"
10 changes: 10 additions & 0 deletions CHANGELOG-AWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!-- This file is autogenerated. See CONTRIBUTING.md for instructions to add an entry. -->

# GO AWS cloudwatch agent Changelog

This changelog includes only clodwatch agent developer-facing changes.
Please checkout contributing file [CONTRIBUTING.md](./CONTRIBUTING.md)
Copy link

Choose a reason for hiding this comment

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

We should be referencing CONTRIBUTING-AWS.md right?


<!-- next version -->


Loading
Loading