Discover new OtelCol releases #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Discover new OtelCol releases | |
on: | |
schedule: | |
- cron: '0 2 * * *' # run at 2 AM UTC | |
workflow_dispatch: {} | |
jobs: | |
check-community-releases: | |
name: OpenTelemetry official distribution | |
strategy: | |
fail-fast: false | |
matrix: | |
distro: | |
- name: otelcol-core | |
artifact_prefix: otelcol_ | |
artifact_suffix: _linux_amd64.rpm | |
- name: otelcol-contrib | |
artifact_prefix: otelcol-contrib_ | |
artifact_suffix: _linux_amd64.rpm | |
runs-on: ubuntu-latest | |
outputs: | |
releases: ${{ steps.list-releases.outputs.releases }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install dependencies | |
env: | |
NODE_MAJOR: 20 | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ca-certificates curl gnupg | |
sudo mkdir -p /etc/apt/keyrings | |
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg | |
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list | |
sudo apt-get update | |
sudo apt-get install nodejs -y | |
- name: Build list generator | |
working-directory: .github/workflows/scripts/list-releases | |
run: | | |
npm install | |
npm run build | |
- name: Look up ignored releases range | |
id: lookup-ignored-releases | |
shell: bash | |
working-directory: packages/otelbin-validation/src/assets | |
run: | | |
echo "range=$(jq -r '.["${{matrix.distro.name}}"].ignoredReleases' < supported-distributions.json)" | tee -a ${GITHUB_OUTPUT} | |
- name: List matching releases | |
id: list-releases | |
shell: bash | |
env: | |
DISTRO_NAME: ${{ matrix.distro.name }} | |
GH_REPOSITORY: open-telemetry/opentelemetry-collector-releases | |
GH_ASSET_PREFIX: ${{ matrix.distro.artifact_prefix }} | |
GH_ASSET_SUFFIX: ${{ matrix.distro.artifact_suffix }} | |
IGNORED_RELEASES: ${{ steps.lookup-ignored-releases.outputs.range }} | |
working-directory: .github/workflows/scripts/list-releases | |
run: | | |
npm run start --silent | tee releases.json | |
- name: Upload releases.json artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: releases-${{ matrix.distro.name }} | |
path: .github/workflows/scripts/list-releases/releases.json | |
check-adot-releases: | |
name: AWS Distro for OpenTelemetry | |
strategy: | |
fail-fast: false | |
runs-on: ubuntu-latest | |
outputs: | |
releases: ${{ steps.list-releases.outputs.releases }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install dependencies | |
env: | |
NODE_MAJOR: 20 | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ca-certificates curl gnupg | |
sudo mkdir -p /etc/apt/keyrings | |
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg | |
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list | |
sudo apt-get update | |
sudo apt-get install nodejs -y | |
- name: Build list generator | |
working-directory: .github/workflows/scripts/list-releases | |
run: | | |
npm install | |
npm run build | |
- name: Look up ignored releases range | |
id: lookup-ignored-releases | |
shell: bash | |
working-directory: packages/otelbin-validation/src/assets | |
run: | | |
echo "range=$(jq -r '.["adot"].ignoredReleases' < supported-distributions.json)" | tee -a ${GITHUB_OUTPUT} | |
- name: List matching releases | |
id: list-releases | |
working-directory: .github/workflows/scripts/list-releases | |
env: | |
DISTRO_NAME: adot | |
GH_REPOSITORY: aws-observability/aws-otel-collector | |
IGNORED_RELEASES: ${{ steps.lookup-ignored-releases.outputs.range }} | |
run: | | |
npm run start --silent | tee releases.json | |
- name: Upload releases.json artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: releases-adot | |
path: .github/workflows/scripts/list-releases/releases.json | |
compose-supported-distro-list: | |
name: Compose supported distro list | |
needs: | |
- check-community-releases | |
- check-adot-releases | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Download release artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: releases/ | |
- name: Merge release data | |
run: | | |
mv packages/otelbin-validation/src/assets/supported-distributions.json packages/otelbin-validation/src/assets/supported-distributions.json.old | |
jq -rs 'reduce .[] as $item ({}; . * $item)' packages/otelbin-validation/src/assets/supported-distributions.json.old releases/*/*.json > packages/otelbin-validation/src/assets/supported-distributions.json | |
- name: Upload updated releases.json artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: supported-distributions | |
path: packages/otelbin-validation/src/assets/supported-distributions.json | |
create-pr: | |
name: Create Pull Request | |
needs: | |
- compose-supported-distro-list | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download updated supported distro list | |
uses: actions/download-artifact@v3 | |
with: | |
name: supported-distributions | |
path: packages/otelbin-validation/src/assets | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
title: Update supported versions | |
commit-message: 'chore: update the version list of supported OpenTelemetry collector distros' | |
add-paths: packages/otelbin-validation/src/assets/supported-distributions.json | |
branch: update-supported-versions | |
reviewers: mmanciop,bripkens | |
author: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>' |