Skip to content

nri-bundle-5.0.79

nri-bundle-5.0.79 #115

name: Post-Release Tasks (nri-bundle)
on:
release:
types: [released]
env:
ORIGINAL_REPO_NAME: ${{ github.event.repository.full_name }}
RELEASE_PATH: charts/nri-bundle
RELEASE_FILE: RELEASE.md
SLACK_FILE: RELEASE.slack
jobs:
release-notes:
if: startsWith(github.event.release.tag_name, 'nri-bundle-')
name: Publish release notes
runs-on: ubuntu-latest
outputs:
announcement: ${{ steps.slack-announcement.outputs.announcement }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: 'latest' # default is latest (stable)
token: ${{ secrets.GITHUB_TOKEN }} # only needed if version is 'latest'
- name: Add Helm repositories
run: |
helm repo add newrelic-infrastructure https://newrelic.github.io/nri-kubernetes
helm repo add nri-prometheus https://newrelic.github.io/nri-prometheus
helm repo add newrelic-prometheus-configurator https://newrelic.github.io/newrelic-prometheus-configurator
helm repo add nri-metadata-injection https://newrelic.github.io/k8s-metadata-injection
helm repo add newrelic-k8s-metrics-adapter https://newrelic.github.io/newrelic-k8s-metrics-adapter
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add nri-kube-events https://newrelic.github.io/nri-kube-events
helm repo add newrelic-helm-charts https://newrelic.github.io/helm-charts
helm repo add pixie-operator-chart https://pixie-operator-charts.storage.googleapis.com
helm repo add newrelic-infra-operator https://newrelic.github.io/newrelic-infra-operator
helm repo add kube-state-metrics https://kubernetes.github.io/kube-state-metrics
helm repo add newrelic-cdn-helm-charts https://helm-charts.newrelic.com
- name: Create release notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
scripts/write-release-notes.sh ${{ env.RELEASE_FILE }} ${{ env.SLACK_FILE }}
gh release edit ${{ github.event.release.tag_name }} \
--notes-file ${{ env.RELEASE_PATH }}/${{ env.RELEASE_FILE }}
- name: Write Slack announcement
id: slack-announcement
run: |
{
echo 'announcement<<EOF'
cat ${{ env.RELEASE_PATH }}/${{ env.SLACK_FILE }}
echo EOF
} >> "$GITHUB_OUTPUT"
announce-release:
if: startsWith(github.event.release.tag_name, 'nri-bundle-')
name: Announce bundle release
runs-on: ubuntu-latest
needs: release-notes
steps:
- name: Notify release via Slack
uses: archive/github-actions-slack@v2.9.0
with:
slack-bot-user-oauth-access-token: ${{ secrets.K8S_AGENTS_SLACK_TOKEN }}
slack-channel: ${{ secrets.HELP_K8S_AGENTS_SLACK_CHANNEL }}
slack-text: "${{ needs.release-notes.outputs.announcement }}"
update-public-docs:
if: startsWith(github.event.release.tag_name, 'nri-bundle-')
name: Update public docs
runs-on: ubuntu-latest
env:
K8S_FOLDER: src/content/docs/release-notes/infrastructure-release-notes/kubernetes-integration-release-notes
steps:
- name: Checkout `nri-kubernetes` chart
uses: actions/checkout@v4
with:
repository: 'newrelic/nri-kubernetes'
sparse-checkout: |
charts/newrelic-infrastructure/Chart.yaml
sparse-checkout-cone-mode: false
- name: Resolve versions
run: |
cd charts/newrelic-infrastructure
appVersion=$(cat ./Chart.yaml | yq '.appVersion')
version=$(cat ./Chart.yaml | yq '.version')
echo "appVersion=${appVersion}" >> "$GITHUB_ENV"
echo "version=${version}" >> "$GITHUB_ENV"
- name: Write release notes
run: |
today=$(date "+%Y-%m-%d")
{
echo "release_notes<<EOF"
echo "---"
echo "subject: Kubernetes integration"
echo "releaseDate: '${today}'"
echo "version: ${appVersion}"
echo "---"
echo ""
echo "For a detailed description of changes, see the [release notes](https://github.com/newrelic/nri-kubernetes/releases/tag/v${appVersion})."
echo ""
echo "This integration is included in the following chart versions:"
echo "* [newrelic-infrastructure-${version}](https://github.com/newrelic/nri-kubernetes/releases/tag/newrelic-infrastructure-${version})"
echo "* [${{ github.event.release.tag_name }}](https://github.com/newrelic/helm-charts/releases/tag/${{ github.event.release.tag_name }})"
echo EOF
} >> "$GITHUB_ENV"
- name: Checkout docs-website
uses: actions/checkout@v4
with:
repository: 'newrelic/docs-website'
# Token used to run authenticated git commands
token: ${{ secrets.K8S_AGENTS_BOT_TOKEN }}
sparse-checkout: |
${{ env.K8S_FOLDER }}
sparse-checkout-cone-mode: false
- name: Configure Git
run: |
git config user.name "NewRelic-K8s-Agents-Bot"
git config user.email "NewRelic-K8s-Agents-Bot@users.noreply.github.com"
- name: Create branch in forked repo
env:
GITHUB_TOKEN: ${{ secrets.K8S_AGENTS_BOT_TOKEN_FORKS }}
run: |
cd ${{ env.K8S_FOLDER }}
appVersionModified=$(echo ${appVersion} | sed 's/\./-/g' )
branchName=add_kubernetes_release_notes-$( date "+%Y-%m-%d_%H_%M" )
releaseFile=kubernetes-integration-${appVersionModified}.mdx
summary="Add release notes for Kubernetes integration v${appVersion}"
echo "releaseFile=${releaseFile}" >> "$GITHUB_ENV"
echo "summary=${summary}" >> "$GITHUB_ENV"
if [[ -e "${releaseFile}" ]]; then
echo "File '${releaseFile}' already exists. Nothing to do"
else
echo "Creating '${releaseFile}'"
echo "${release_notes}" >> ${releaseFile}
git checkout -b ${branchName}
git add ${releaseFile}
git commit --message="feat: ${summary}"
git remote add upstream https://github.com/NewRelic-K8s-Agents-Bot/docs-website.git
git push --set-upstream upstream ${branchName}
fi
- name: Create PR in original repo
env:
GITHUB_TOKEN: ${{ secrets.K8S_AGENTS_BOT_TOKEN }}
run: |
if [[ -e "${releaseFile}" ]]; then
echo "File '${releaseFile}' already exists. Nothing to do"
else
gh pr create \
--repo newrelic/docs-website \
--title "feat: ${summary}" \
--body "${summary}"
fi
update-eks-sleek:
if: startsWith(github.event.release.tag_name, 'nri-bundle-')
name: Update EKS Sleek repo
runs-on: ubuntu-latest
steps:
- name: Checkout `nri-bundle` chart
uses: actions/checkout@v4
with:
repository: 'newrelic/helm-charts'
sparse-checkout: |
charts/nri-bundle/Chart.yaml
sparse-checkout-cone-mode: false
- name: Resolve bundle version
run: |
version=$(cat charts/nri-bundle/Chart.yaml | yq '.version')
echo "version=${version}" >> "$GITHUB_ENV"
- name: Checkout eks-anywhere-addons
uses: actions/checkout@v4
with:
repository: 'aws-samples/eks-anywhere-addons'
# Token used to run authenticated git commands
token: ${{ secrets.K8S_AGENTS_BOT_TOKEN_AWS_EKS }}
sparse-checkout: |
eks-anywhere-baremetal/Addons/Partner/newrelic/newrelic.yaml
eks-anywhere-baremetal/Addons/Partner/newrelic/namespace.yaml
eks-anywhere-snow/Addons/Partner/newrelic/newrelic.yaml
eks-anywhere-snow/Addons/Partner/newrelic/namespace.yaml
eks-anywhere-vsphere/Addons/Partner/newrelic/newrelic.yaml
eks-anywhere-vsphere/Addons/Partner/newrelic/namespace.yaml
eks-cloud/Partner/newrelic/newrelic.yaml
eks-cloud/Partner/newrelic/namespace.yaml
sparse-checkout-cone-mode: false
- name: Configure Git
run: |
git config user.name "NewRelic-K8s-Agents-Bot"
git config user.email "NewRelic-K8s-Agents-Bot@users.noreply.github.com"
- name: Create branch in forked repo
env:
GITHUB_TOKEN: ${{ secrets.K8S_AGENTS_BOT_TOKEN_AWS_EKS }}
run: |
branchName=update-nri-bundle-$( date "+%Y-%m-%d_%H_%M" )
summary="Update nri-bundle to version ${version}"
echo "summary=${summary}" >> "$GITHUB_ENV"
git checkout -b ${branchName}
folders=(
'eks-anywhere-baremetal/Addons/Partner/newrelic'
'eks-anywhere-snow/Addons/Partner/newrelic'
'eks-anywhere-vsphere/Addons/Partner/newrelic'
'eks-cloud/Partner/newrelic'
)
for directory in "${folders[@]}"; do
file_name="${directory}/newrelic.yaml"
yq eval --inplace ".spec.chart.spec.version=\"${version}\"" "${file_name}"
git add ${file_name}
file_name="${directory}/namespace.yaml"
yq eval --inplace '.metadata.labels."aws.conformance.vendor-solution-version"=env(version)' "${file_name}"
git add ${file_name}
done
git commit --message="feat: ${summary}"
git remote add upstream https://github.com/NewRelic-K8s-Agents-Bot/eks-anywhere-addons.git
git push --set-upstream upstream ${branchName}
- name: Create PR in original repo
env:
GITHUB_TOKEN: ${{ secrets.K8S_AGENTS_BOT_TOKEN_AWS_EKS }}
run: |
gh pr create \
--repo aws-samples/eks-anywhere-addons \
--title "feat: ${summary}" \
--body "${summary}"
notify-failure:
if: ${{ always() && failure() }}
needs: [release-notes,announce-release,update-public-docs,update-eks-sleek]
runs-on: ubuntu-latest
steps:
- name: Notify failure via Slack
uses: archive/github-actions-slack@v2.9.0
with:
slack-bot-user-oauth-access-token: ${{ secrets.K8S_AGENTS_SLACK_TOKEN }}
slack-channel: ${{ secrets.K8S_AGENTS_SLACK_CHANNEL }}
slack-text: "❌ `${{ env.ORIGINAL_REPO_NAME }}`: <${{ github.server_url }}/${{ env.ORIGINAL_REPO_NAME }}/actions/runs/${{ github.run_id }}|'Post Release Tasks (nri-bundle)' failed>."