Skip to content

Publish Release for Workflow: 12437912104 #19

Publish Release for Workflow: 12437912104

Publish Release for Workflow: 12437912104 #19

Workflow file for this run

name: "Publish release"
run-name: >
${{ format('Publish Release for Workflow: {0}', inputs.workflow_id) }}
on:
workflow_dispatch:
inputs:
workflow_id:
description: |
Workflow Run ID from this repository to fetch artifacts from for this
release.
required: true
type: string
defaults:
run:
shell: bash
jobs:
get-version:
name: Get application version for this revision
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.get-sha.outputs.git-sha }}
otc-version: ${{ steps.get-version.outputs.otc-version }}
sumo-version: ${{ steps.get-version.outputs.sumo-version }}
version: ${{ steps.get-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Outuput Workflow ID
run: echo ::notice title=Workflow ID::${{ inputs.workflow_id }}
- name: Output Workflow URL
run: |
repo_url="https://github.com/SumoLogic/sumologic-otel-collector"
url="${repo_url}/actions/runs/${{ inputs.workflow_id }}"
echo ::notice title=Workflow URL::${url}
- name: Download otelcol-sumo artifact from workflow
uses: actions/download-artifact@v4
with:
name: otelcol-sumo-linux_amd64
path: artifacts/
merge-multiple: true
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ inputs.workflow_id }}
- name: Determine version from artifact
id: get-version
run: |
artifact="artifacts/otelcol-sumo-linux_amd64"
chmod +x "${artifact}"
script="ci/get_version_from_binary.sh"
core="$("$script" core "${artifact}")"
sumo="$("$script" sumo "${artifact}")"
echo "otc-version=$core" >> $GITHUB_OUTPUT
echo "sumo-version=$sumo" >> $GITHUB_OUTPUT
echo "version=${core}-sumo-${sumo}" >> $GITHUB_OUTPUT
- name: Output Version
run: |
echo ::notice title=Version::${{ steps.get-version.outputs.version }}
- name: Determine Git SHA of workflow
id: get-sha
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
workflow="${{ inputs.workflow_id }}"
sha="$(gh run view ${workflow} --json headSha -t '{{.headSha}}')"
echo "git-sha=$sha" >> $GITHUB_OUTPUT
- name: Output Git SHA
run: |
echo ::notice title=Git SHA::${{ steps.get-sha.outputs.git-sha }}
build-container-images:
name: Build container
runs-on: ubuntu-20.04
needs:
- get-version
strategy:
matrix:
arch_os: ["linux_amd64", "linux_arm64"]
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.2.0
- name: Set up Buildx
id: buildx
uses: docker/setup-buildx-action@v3.7.1
- name: Show Buildx platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Login to Open Source ECR
run: make login
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Login to Docker Hub
run: |
docker login \
--username ${{ secrets.DOCKERHUB_LOGIN }} \
--password ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Download platform otelcol-sumo artifacts from workflow
uses: actions/download-artifact@v4
with:
pattern: otelcol-sumo-${{ matrix.arch_os }}
path: artifacts/
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ inputs.workflow_id }}
- name: Download platform fips otelcol-sumo artifacts from workflow
uses: actions/download-artifact@v4
with:
pattern: otelcol-sumo-fips-${{ matrix.arch_os }}
path: artifacts/
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ inputs.workflow_id }}
- name: Build and push FIPS image to Open Source ECR
run: |
cp artifacts/otelcol-sumo-fips-${{matrix.arch_os}}/otelcol-sumo-fips-${{matrix.arch_os}} otelcol-sumo
make build-push-container-multiplatform \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORM=${{ matrix.arch_os }} \
BUILD_TYPE_SUFFIX="-fips"
- name: Build and push FIPS image to DockerHub
run: |
cp artifacts/otelcol-sumo-fips-${{matrix.arch_os}}/otelcol-sumo-fips-${{matrix.arch_os}} otelcol-sumo
make build-push-container-multiplatform \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORM=${{ matrix.arch_os }} \
REPO_URL=sumologic/sumologic-otel-collector \
BUILD_TYPE_SUFFIX="-fips"
- name: Build and push UBI-based FIPS image to Open Source ECR
run: |
cp artifacts/otelcol-sumo-fips-${{matrix.arch_os}}/otelcol-sumo-fips-${{matrix.arch_os}} otelcol-sumo
make build-push-container-ubi \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORM=${{ matrix.arch_os }} \
BUILD_TYPE_SUFFIX="-ubi-fips"
- name: Build and push UBI-based FIPS image to DockerHub
run: |
cp artifacts/otelcol-sumo-fips-${{matrix.arch_os}}/otelcol-sumo-fips-${{matrix.arch_os}} otelcol-sumo
make build-push-container-ubi \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORM=${{ matrix.arch_os }} \
REPO_URL=sumologic/sumologic-otel-collector \
BUILD_TYPE_SUFFIX="-ubi-fips"
- name: Build and push image to Open Source ECR
run: |
cp artifacts/otelcol-sumo-${{matrix.arch_os}}/otelcol-sumo-${{matrix.arch_os}} otelcol-sumo
make build-push-container-multiplatform \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORM=${{ matrix.arch_os }}
- name: Build and push image to DockerHub
run: |
cp artifacts/otelcol-sumo-${{matrix.arch_os}}/otelcol-sumo-${{matrix.arch_os}} otelcol-sumo
make build-push-container-multiplatform \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORM=${{ matrix.arch_os }} \
REPO_URL=sumologic/sumologic-otel-collector
- name: Build and push UBI-based image to Open Source ECR
run: |
cp artifacts/otelcol-sumo-${{matrix.arch_os}}/otelcol-sumo-${{matrix.arch_os}} otelcol-sumo
make build-push-container-ubi \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORM=${{ matrix.arch_os }} \
BUILD_TYPE_SUFFIX="-ubi"
- name: Build and push UBI-based image to DockerHub
run: |
cp artifacts/otelcol-sumo-${{matrix.arch_os}}/otelcol-sumo-${{matrix.arch_os}} otelcol-sumo
make build-push-container-ubi \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORM=${{ matrix.arch_os }} \
REPO_URL=sumologic/sumologic-otel-collector \
BUILD_TYPE_SUFFIX="-ubi"
push-docker-manifest:
name: Push joint container manifest
runs-on: ubuntu-20.04
needs:
# Require darwin build to succeed to prevent pushing container images
# when darwin build fails.
- build-container-images
- get-version
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.2.0
- name: Set up Buildx
id: buildx
uses: docker/setup-buildx-action@v3.7.1
- name: Show Buildx platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Login to Open Source ECR
run: make login
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Login to Docker Hub
run: |
docker login \
--username ${{ secrets.DOCKERHUB_LOGIN }} \
--password ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Push joint FIPS container manifest for all platforms to Open Source ECR
run: |
make push-container-manifest \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORMS="linux/amd64" \
BUILD_TYPE_SUFFIX="-fips"
- name: Push joint FIPS container manifest for all platforms to DockerHub
run: |
make push-container-manifest \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORMS="linux/amd64" \
REPO_URL=sumologic/sumologic-otel-collector \
BUILD_TYPE_SUFFIX="-fips"
- name: Push joint UBI-based FIPS container manifest for all platforms to Open Source ECR
run: |
make push-container-manifest \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORMS="linux/amd64 linux/arm64" \
BUILD_TYPE_SUFFIX="-ubi-fips"
- name: Push joint UBI-based FIPS container manifest for all platforms to DockerHub
run: |
make push-container-manifest \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORMS="linux/amd64 linux/arm64" \
REPO_URL=sumologic/sumologic-otel-collector \
BUILD_TYPE_SUFFIX="-ubi-fips"
- name: Push joint container manifest for all platforms to Open Source ECR
run: |
make push-container-manifest \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORMS="linux/amd64 linux/arm64"
- name: Push joint container manifest for all platforms to DockerHub
run: |
make push-container-manifest \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORMS="linux/amd64 linux/arm64" \
REPO_URL=sumologic/sumologic-otel-collector
- name: Push joint UBI-based container manifest for all platforms to Open Source ECR
run: |
make push-container-manifest \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORMS="linux/amd64 linux/arm64" \
BUILD_TYPE_SUFFIX="-ubi"
- name: Push joint UBI-based container manifest for all platforms to DockerHub
run: |
make push-container-manifest \
BUILD_TAG=${{ needs.get-version.outputs.version }} \
PLATFORMS="linux/amd64 linux/arm64" \
REPO_URL=sumologic/sumologic-otel-collector \
BUILD_TYPE_SUFFIX="-ubi"
# Store the install script from the packaging repository as a release artifact.
# Originally, this script was stored in this repository, and the official download url pointed
# to the most recent release here. The script has since been moved to the packaging repository.
# It is kept here for backwards compatibility. Once the download count for this artifact
# reaches 0 for new releases, this can be removed.
#
# TODO: This pulls the latest install scripts from the main branch of the
# packaging reopsitory. There is a chance that the install scripts attached to
# a collector release will differ from the install scripts attached to a
# packaging release. We can either remove install scripts from releases here
# or we should ensure that the install scripts are always automically synced
# to this repository and use the install scripts from the HEAD SHA of the
# collector workflow run specified for a release.
install-script:
name: Store install script
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: SumoLogic/sumologic-otel-collector-packaging
- name: Store Linux install script as action artifact
uses: actions/upload-artifact@v4
with:
name: install.sh
path: ./install-script/install.sh
if-no-files-found: error
- name: Store Windows install script as action artifact
uses: actions/upload-artifact@v4
with:
name: install.ps1
path: ./install-script/install.ps1
if-no-files-found: error
config-management-assets:
name: Store Chef cookbook, Puppet module, and Ansible playbook
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Archive Chef cookbook
run: tar -cvf ./examples/chef/chef-cookbook.tar.gz -C ./examples/chef sumologic-otel-collector/
- name: Archive Puppet module
run: tar -cvf ./examples/puppet/puppet-module.tar.gz -C ./examples/puppet/modules install_otel_collector/
- name: Archive Ansible playbook
run: tar -cvf ./examples/ansible-playbook.tar.gz -C ./examples ansible/
# Users can download it via the "latest/download" redirect.
- name: Store Chef cookbook archive as action artifact
uses: actions/upload-artifact@v4
with:
name: chef-cookbook.tar.gz
path: ./examples/chef/chef-cookbook.tar.gz
if-no-files-found: error
- name: Store Puppet module archive as action artifact
uses: actions/upload-artifact@v4
with:
name: puppet-module.tar.gz
path: ./examples/puppet/puppet-module.tar.gz
if-no-files-found: error
- name: Store Ansible playbook archive as action artifact
uses: actions/upload-artifact@v4
with:
name: ansible-playbook.tar.gz
path: ./examples/ansible-playbook.tar.gz
if-no-files-found: error
create-release:
name: Create Github release
runs-on: ubuntu-20.04
needs:
- get-version
- build-container-images
- push-docker-manifest
steps:
- name: Download all artifacts from workflow
uses: actions/download-artifact@v4
with:
path: artifacts/
merge-multiple: true
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ inputs.workflow_id }}
- name: Add version to binary names
working-directory: artifacts/
run: |
version="${{ needs.get-version.outputs.version }}"
find . -type f -name 'otelcol-sumo*' \
| sed 's/^\.\///' \
| while read -r file; do
new_name=$(echo "$file" | sed "s/otelcol-sumo/otelcol-sumo-${version}/g")
mv "$file" "$new_name"
done
find . -type f -name 'otelcol-config*' \
| sed 's/^\.\///' \
| while read -r file; do
new_name=$(echo "$file" | sed "s/otelcol-config/otelcol-config-${version}/g")
mv "$file" "$new_name"
done
- uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
prerelease: false
commit: ${{ needs.get-sha.outputs.git-sha }}
tag: v${{ needs.get-version.outputs.version }}
allowUpdates: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
body: |
## v${{ needs.get-version.outputs.version }}
**TODO**
### Upstream releases
** TODO: Add upstream versions in the links below**
Core: https://github.com/open-telemetry/opentelemetry-collector/releases/tag/v
Contrib: https://github.com/open-telemetry/opentelemetry-collector-contrib/releases/tag/v
### Changelog
**TODO**
### Container images:
```
docker pull public.ecr.aws/sumologic/sumologic-otel-collector:${{ needs.get-version.outputs.version }}
```
artifacts: "artifacts/*"
artifactErrorsFailBuild: true
replacesArtifacts: true