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 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
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]
48 changes: 48 additions & 0 deletions .github/workflows/changelog-update.yml
Copy link

Choose a reason for hiding this comment

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

This is an empty file, can we remove this?

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Update changelog

on:
pull_request:
types:
- closed
jobs:
update:
runs-on: ubuntu-latest

permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# updated CHANGELOG-AWS.md back to the repository.
# https://github.blog/changelog/2023-02-02-github-actions-updating-the-default-github_token-permissions-to-read-only/
contents: write
steps:
- name: Checkout action
uses: actions/checkout@v3
- name : checkout
run : |
git config --global user.name 'Github Action'
git config --global user.email '[email protected]'
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.21.1
cache: false
- name: make update changelog
run: make chlog-update-aws
- name: switching from HTTPS to SSH
run: git remote set-url origin https://github.com/amazon-contributing/opentelemetry-collector-contrib.git
- name: check for changes
run: |
git branch
git status
- name: stage changed files
run: git add ./CHANGELOG-AWS.md
- name: commit changed files
run: |
git config --global user.name 'Github Action'
git config --global user.email '[email protected]'
git commit -m "Auto updating changelog-aws.md"
- name: pull from master
run: |
git remote -v
git pull
- name: push code to aws-cwa-dev
run: git push origin aws-cwa-dev
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 aws-cwa-dev branch should add a
# 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; }
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-AWS.md](./CONTRIBUTING-AWS.md)

<!-- next version -->


Loading
Loading