ci: trigger packaging for release builds #1648
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: Dev builds | |
on: | |
push: | |
branches: | |
- main | |
- 'dev-build/*' | |
defaults: | |
run: | |
shell: bash | |
env: | |
GO_VERSION: "1.21.4" | |
jobs: | |
# Add lint to dev builds as that's the only way for cache to be shared across branches. | |
# https://docs.github.com/en/actions/advanced-guides/caching-dependencies-to-speed-up-workflows#matching-a-cache-key | |
lint: | |
name: Lint (golangci-lint) | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
arch_os: [ 'linux_amd64' ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: false | |
- name: Get GOCACHE and GOMODCACHE | |
run: | | |
echo "GOMODCACHE=$(go env GOMODCACHE)" >> "$GITHUB_ENV" | |
echo "GOCACHE=$(go env GOCACHE)" >> "$GITHUB_ENV" | |
- uses: actions/cache/restore@v4 | |
with: | |
path: | | |
${{ env.GOMODCACHE }}/cache | |
${{ env.GOCACHE }} | |
key: go-test-${{ env.GO_VERSION }}-${{matrix.arch_os}}-${{ hashFiles('pkg/**/go.sum', 'otelcolbuilder/.otelcol-builder.yaml') }} | |
restore-keys: | | |
go-test-${{ env.GO_VERSION }}-${{matrix.arch_os}}- | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
/home/runner/.cache/golangci-lint | |
key: golangci-lint-${{ env.GO_VERSION }}-${{matrix.arch_os}}-${{ hashFiles('pkg/**/go.sum', 'otelcolbuilder/.otelcol-builder.yaml') }} | |
restore-keys: | | |
golangci-lint-${{ env.GO_VERSION }}-${{matrix.arch_os}}- | |
- name: Install golangci-lint | |
run: make install-golangci-lint | |
- name: Add opentelemetry-collector-builder installation dir to PATH | |
run: echo "$HOME/bin" >> $GITHUB_PATH | |
- name: Run golangci-lint | |
run: make golint | |
test: | |
name: Test | |
uses: ./.github/workflows/workflow-test.yml | |
strategy: | |
matrix: | |
include: | |
- arch_os: linux_amd64 | |
runs-on: ubuntu-20.04 | |
- arch_os: linux_amd64 | |
runs-on: ubuntu-20.04 | |
boringcrypto: true | |
- arch_os: darwin_amd64 | |
runs-on: macos-latest | |
- arch_os: windows_amd64 | |
runs-on: windows-2022 | |
with: | |
arch_os: ${{ matrix.arch_os }} | |
runs-on: ${{ matrix.runs-on }} | |
save-cache: true | |
boringcrypto: ${{ matrix.boringcrypto == true }} | |
build: | |
name: Build | |
uses: ./.github/workflows/workflow-build.yml | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- arch_os: linux_amd64 | |
runs-on: ubuntu-20.04 | |
- arch_os: linux_amd64 | |
runs-on: ubuntu-20.04 | |
fips: true | |
- arch_os: linux_arm64 | |
runs-on: ubuntu-20.04 | |
- arch_os: linux_arm64 | |
runs-on: ubuntu-20.04 | |
fips: true | |
- arch_os: darwin_amd64 | |
runs-on: macos-latest | |
- arch_os: darwin_arm64 | |
runs-on: macos-latest | |
- arch_os: windows_amd64 | |
runs-on: windows-2022 | |
- arch_os: windows_amd64 | |
runs-on: windows-2022 | |
fips: true | |
with: | |
arch_os: ${{ matrix.arch_os }} | |
runs-on: ${{ matrix.runs-on }} | |
fips: ${{ matrix.fips == true }} | |
save-cache: true | |
build-container-images: | |
name: Build container | |
runs-on: ubuntu-20.04 | |
needs: | |
- build | |
strategy: | |
matrix: | |
arch_os: [ 'linux_amd64', 'linux_arm64' ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract tag | |
id: extract_tag | |
run: echo "tag=$(git rev-parse HEAD)" > $GITHUB_OUTPUT | |
- name: Print tag | |
run: echo "Running dev build for ${{ steps.extract_tag.outputs.tag }}" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3.0.0 | |
- name: Set up Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3.2.0 | |
- 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_DEV }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }} | |
- name: Download FIPS binary action artifact from build phase | |
uses: actions/download-artifact@v4 | |
with: | |
name: otelcol-sumo-fips-${{matrix.arch_os}} | |
- name: Build and push FIPS image to Open Source ECR | |
run: | | |
cp otelcol-sumo-fips-${{ matrix.arch_os }} otelcol-sumo | |
make build-push-container-multiplatform-dev \ | |
BUILD_TAG=${{ steps.extract_tag.outputs.tag }} \ | |
PLATFORM=${{ matrix.arch_os }} \ | |
BUILD_TYPE_SUFFIX="-fips" | |
- name: Build and push UBI-based FIPS image to Open Source ECR | |
run: | | |
cp otelcol-sumo-fips-${{ matrix.arch_os }} otelcol-sumo | |
make build-push-container-ubi-dev \ | |
BUILD_TAG=${{ steps.extract_tag.outputs.tag }} \ | |
PLATFORM=${{ matrix.arch_os }} \ | |
BUILD_TYPE_SUFFIX="-ubi-fips" | |
- name: Download binary action artifact from build phase | |
uses: actions/download-artifact@v4 | |
with: | |
name: otelcol-sumo-${{ matrix.arch_os }} | |
- name: Build and push image to Open Source ECR | |
run: | | |
cp otelcol-sumo-${{ matrix.arch_os }} otelcol-sumo | |
make build-push-container-multiplatform-dev \ | |
BUILD_TAG=${{ steps.extract_tag.outputs.tag }} \ | |
PLATFORM=${{ matrix.arch_os }} | |
- name: Build and push UBI-based image to Open Source ECR | |
run: | | |
cp otelcol-sumo-${{ matrix.arch_os }} otelcol-sumo | |
make build-push-container-ubi-dev \ | |
BUILD_TAG=${{ steps.extract_tag.outputs.tag }} \ | |
PLATFORM=${{ matrix.arch_os }} \ | |
BUILD_TYPE_SUFFIX="-ubi" | |
build-windows-container-images: | |
name: Build Windows container | |
runs-on: ${{ matrix.runs-on }} | |
needs: | |
- build | |
strategy: | |
matrix: | |
include: | |
- arch_os: windows_amd64 | |
base_image_tag: ltsc2022 | |
runs-on: windows-2022 | |
- arch_os: windows_amd64 | |
base_image_tag: ltsc2019 | |
runs-on: windows-2019 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract tag | |
id: extract_tag | |
run: echo "tag=$(git rev-parse HEAD)" > $GITHUB_OUTPUT | |
- name: Print tag | |
run: echo "Running dev build for ${{ steps.extract_tag.outputs.tag }}" | |
- name: Login to Open Source ECR | |
run: | | |
USERNAME=$(powershell.exe "echo \$Env:UserName") | |
# remove wincred entry and fix json format by replacing }, with } | |
cat "C:\\Users\\${USERNAME}\\.docker\\config.json" | grep -v "wincred" | sed 's/},$/}/' > "C:\\Users\\${USERNAME}\\.docker\\config.json.tmp" | |
mv "C:\\Users\\${USERNAME}\\.docker\\config.json.tmp" "C:\\Users\\${USERNAME}\\.docker\\config.json" | |
make login | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_DEV }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }} | |
- name: Download binary action artifact from build phase | |
uses: actions/download-artifact@v4 | |
with: | |
name: otelcol-sumo-${{matrix.arch_os}}.exe | |
path: artifacts/ | |
- name: Build and push images to Open Source ECR | |
run: | | |
cp artifacts/otelcol-sumo-${{matrix.arch_os}}.exe otelcol-sumo.exe | |
make build-push-container-windows-dev \ | |
BUILD_TAG=${{ steps.extract_tag.outputs.tag }} \ | |
PLATFORM=${{ matrix.arch_os }}_${{ matrix.base_image_tag }} | |
push-docker-manifest: | |
name: Push joint container manifest | |
runs-on: ubuntu-20.04 | |
needs: | |
- build-container-images | |
- build-windows-container-images | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract tag | |
id: extract_tag | |
run: echo "tag=$(git rev-parse HEAD)" > $GITHUB_OUTPUT | |
- name: Print tag | |
run: echo "Running dev build for ${{ steps.extract_tag.outputs.tag }}" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3.0.0 | |
- name: Set up Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3.2.0 | |
- 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_DEV }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }} | |
- name: Push joint FIPS container manifest for all platforms to Open Source ECR | |
run: | | |
make push-container-manifest-dev \ | |
BUILD_TAG=${{ steps.extract_tag.outputs.tag }} \ | |
PLATFORMS="linux/amd64" \ | |
BUILD_TYPE_SUFFIX="-fips" | |
- name: Push joint UBI-based FIPS container manifest for all platforms to Open Source ECR | |
run: | | |
make push-container-manifest-dev \ | |
BUILD_TAG=${{ steps.extract_tag.outputs.tag }} \ | |
PLATFORMS="linux/amd64" \ | |
BUILD_TYPE_SUFFIX="-ubi-fips" | |
- name: Push joint container manifest for all platforms to Open Source ECR | |
run: | | |
make push-container-manifest-dev \ | |
BUILD_TAG=${{ steps.extract_tag.outputs.tag }} \ | |
PLATFORMS="linux/amd64 linux/arm64 windows/amd64/ltsc2022 windows/amd64/ltsc2019" | |
- name: Push joint UBI-based container manifest for all platforms to Open Source ECR | |
run: | | |
make push-container-manifest-dev \ | |
BUILD_TAG=${{ steps.extract_tag.outputs.tag }} \ | |
PLATFORMS="linux/amd64" \ | |
BUILD_TYPE_SUFFIX="-ubi" | |
package-msi: | |
name: Package MSI | |
runs-on: windows-2019 | |
needs: | |
- build | |
strategy: | |
matrix: | |
include: | |
- arch_os: windows_amd64 | |
platform: x64 | |
fips: false | |
- arch_os: windows_amd64 | |
platform: x64 | |
fips: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Fetch current branch | |
run: ./ci/fetch_current_branch.sh | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
- name: Fetch binary artifact for ${{ matrix.arch_os }} | |
uses: actions/download-artifact@v4 | |
with: | |
name: otelcol-sumo${{ matrix.fips && '-fips' || '' }}-${{ matrix.arch_os }}.exe | |
path: ./otelcolbuilder/cmd | |
- name: Rename fips binary artifact for ${{ matrix.arch_os }} | |
if: matrix.fips | |
working-directory: ./otelcolbuilder/cmd | |
run: mv otelcol-sumo-fips-${{ matrix.arch_os }}.exe otelcol-sumo-${{ matrix.arch_os }}.exe | |
- name: Set OVERRIDE_BUILD_NUMBER | |
run: echo "OVERRIDE_BUILD_VERSION=$GITHUB_RUN_NUMBER" >> $GITHUB_ENV | |
- name: Set PRODUCT_VERSION | |
run: echo "PRODUCT_VERSION=$(./ci/get_version.sh productversion)" >> $GITHUB_ENV | |
- name: Build MSI for ${{ matrix.arch_os }} | |
working-directory: ./packaging/msi/wix | |
run: msbuild.exe -p:Configuration=Release -p:Platform=${{ matrix.platform }} -p:ProductVersion=$PRODUCT_VERSION -p:FIPSEnabled=${{ matrix.fips }} -Restore | |
- name: Store MSI as action artifact for ${{ matrix.arch_os }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.arch_os }}${{ matrix.fips && '_fips' || '' }}_msi | |
path: ./packaging/msi/wix/bin/${{ matrix.platform }}/en-US/*.msi | |
if-no-files-found: error | |
trigger-packaging: | |
name: Trigger Packaging | |
needs: | |
- lint | |
- package-msi | |
- push-docker-manifest | |
uses: ./.github/workflows/workflow-trigger-packaging.yml | |
secrets: inherit | |
with: | |
create_release: false |