Skip to content

fix names (#1252) #1198

fix names (#1252)

fix names (#1252) #1198

Workflow file for this run

name: Dev builds
on:
push:
branches:
- main
- 'dev-build/*'
defaults:
run:
shell: bash
env:
GO_VERSION: "1.20.5"
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@v4
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@v3
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@v3
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:
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: darwin_amd64
runs-on: macos-latest
- arch_os: darwin_arm64
runs-on: macos-latest
- arch_os: windows_amd64
runs-on: windows-2022
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/[email protected]
- name: Set up Buildx
id: buildx
uses: docker/[email protected]
- 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
if: matrix.arch_os == 'linux_amd64'
uses: actions/download-artifact@v3
with:
name: otelcol-sumo-fips-${{matrix.arch_os}}
- name: Build and push FIPS image to Open Source ECR
if: matrix.arch_os == 'linux_amd64'
run: |
cp otelcol-sumo-fips-${{ matrix.arch_os }} otelcol-sumo
make build-push-container-multiplatform-dev \
BUILD_TAG=${{ steps.extract_tag.outputs.tag }}-fips \
PLATFORM=${{ matrix.arch_os }} \
LATEST_TAG_FIPS_SUFFIX="-fips"
- name: Download binary action artifact from build phase
uses: actions/download-artifact@v3
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 }}
push-docker-manifest:
name: Push joint container manifest
runs-on: ubuntu-20.04
needs:
- build-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/[email protected]
- name: Set up Buildx
id: buildx
uses: docker/[email protected]
- 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 }}-fips \
PLATFORMS="linux/amd64" \
LATEST_TAG_FIPS_SUFFIX="-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"
package-msi:
name: Package MSI
runs-on: windows-2019
needs:
- build
steps:
- uses: actions/checkout@v4
- name: Fetch current branch
run: ./ci/fetch_current_branch.sh
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: Fetch binary artifact for windows/amd64
uses: actions/download-artifact@v3
with:
name: otelcol-sumo-windows_amd64.exe
path: ./otelcolbuilder/cmd
- 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 windows/amd64
working-directory: ./packaging/msi/wix
run: msbuild.exe -p:Configuration=Release -p:Platform=x64 -p:ProductVersion=$PRODUCT_VERSION -Restore
- name: Store MSI as action artifact for windows/amd64
uses: actions/upload-artifact@v3
with:
name: windows_amd64_msi
path: ./packaging/msi/wix/bin/x64/en-US/*.msi
if-no-files-found: error
# Triggers build_packages workflow in the sumologic-otel-collector-packaging
# repository. It must be the last job run as artifacts only become available
# to download after all jobs have completed. The lint, package-msi and
# push-docker-manifest jobs are independent or depend on all other jobs so
# we add them as "need" dependencies to ensure this job runs last.
trigger-packaging:
name: Trigger Packaging
needs:
- lint
- package-msi
- push-docker-manifest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch tags
run: git fetch --tags origin
- name: Determine version core
id: version-core
run: >
./ci/get_version.sh core > /tmp/version_core &&
cat /tmp/version_core &&
echo version=$(cat /tmp/version_core) >> $GITHUB_OUTPUT
- name: Determine sumo version
id: sumo-version
run: >
./ci/get_version.sh sumo > /tmp/sumo_version &&
cat /tmp/sumo_version &&
echo version=$(cat /tmp/sumo_version) >> $GITHUB_OUTPUT
- name: Trigger packaging workflow
id: trigger-packaging-workflow
uses: aurelien-baudet/workflow-dispatch@v2
with:
workflow: build_packages.yml
repo: SumoLogic/sumologic-otel-collector-packaging
token: ${{ secrets.PACKAGING_GH_TOKEN }}
ref: main
wait-for-completion: false
display-workflow-run-url: true
display-workflow-run-url-interval: 1s
inputs: |-
{
"workflow_id": "${{ github.run_id }}",
"otc_version": "${{ steps.version-core.outputs.version }}",
"otc_sumo_version": "${{ steps.sumo-version.outputs.version }}"
}
# Outputs the Packaging Workflow URL as an Annotation in the UI after the
# packaging workflow has completed.
- name: Packaging Workflow URL
run: echo ::notice title=Packaging Workflow URL::${{ steps.trigger-packaging-workflow.outputs.workflow-url }}