-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'use-binary-version' into upload-s3
Signed-off-by: Justin Kolberg <[email protected]>
- Loading branch information
Showing
21 changed files
with
441 additions
and
558 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,6 @@ name: '_reusable_build_package' | |
on: | ||
workflow_call: | ||
inputs: | ||
otc_version: | ||
required: true | ||
type: string | ||
otc_sumo_version: | ||
required: true | ||
type: string | ||
otc_build_number: | ||
required: false | ||
type: string | ||
|
@@ -18,10 +12,6 @@ on: | |
workflow_id: | ||
required: false | ||
type: string | ||
use_release_artifacts: | ||
required: false | ||
type: boolean | ||
default: false | ||
runs_on: | ||
required: true | ||
type: string | ||
|
@@ -38,10 +28,6 @@ on: | |
required: false | ||
type: boolean | ||
default: false | ||
packagecloud_go_version: | ||
required: false | ||
type: string | ||
default: "0.2.2" | ||
secrets: | ||
gh_artifacts_token: | ||
required: true | ||
|
@@ -91,7 +77,6 @@ jobs: | |
uses: actions/checkout@v4 | ||
|
||
- name: Workflow URL for sumologic-otel-collector | ||
if: ${{ !inputs.use_release_artifacts && inputs.workflow_id != '' }} | ||
run: | | ||
org="SumoLogic" | ||
repo="sumologic-otel-collector" | ||
|
@@ -104,7 +89,7 @@ jobs: | |
if: inputs.cmake_target == 'otc_linux_amd64_deb' | ||
id: get-build-number | ||
run: | | ||
build_number="${{ inputs.otc_build_number }}" | ||
build_number=${{ inputs.otc_build_number }} | ||
echo "otc_build_number=${build_number}" >> $GITHUB_OUTPUT | ||
- name: Determine if MacOS package should be signed | ||
|
@@ -121,10 +106,6 @@ jobs: | |
if: runner.os != 'Linux' | ||
run: mkdir build | ||
|
||
- name: Use GitHub Artifacts for binaries | ||
if: ${{ !inputs.use_release_artifacts && inputs.workflow_id != '' }} | ||
run: echo "OTC_ARTIFACTS_SOURCE=github-artifacts" >> $GITHUB_ENV | ||
|
||
# TODO: Go back to using Apple-Actions/import-codesign-certs once https://github.com/Apple-Actions/import-codesign-certs/pull/58 is merged | ||
- name: Import macOS Code-Signing Certificates | ||
if: ${{ runner.os == 'macOS' && env.MACOS_SIGNING_ENABLED == 'true' }} | ||
|
@@ -138,13 +119,28 @@ jobs: | |
/usr/bin/security set-key-partition-list -S apple-tool:,apple: -k ${{ secrets.apple_developer_certificate_password }} signing_temp.keychain | ||
/usr/bin/security list-keychains -d user -s signing_temp.keychain login.keychain | ||
- name: Fetch version artifact | ||
if: runner.os == 'Linux' | ||
uses: ./ci/github-actions/cmake | ||
with: | ||
args: -P version_artifact.cmake | ||
gh_token: ${{ secrets.gh_artifacts_token }} | ||
workflow_id: ${{ inputs.workflow_id }} | ||
work_dir: . | ||
|
||
- name: Fetch version artifact | ||
if: runner.os != 'Linux' | ||
env: | ||
GH_TOKEN: ${{ secrets.gh_artifacts_token }} | ||
GH_WORKFLOW_ID: ${{ inputs.workflow_id }} | ||
run: cmake -P version_artifact.cmake | ||
|
||
- name: Build Makefile | ||
id: cmake-linux | ||
if: runner.os == 'Linux' | ||
uses: ./ci/github-actions/cmake | ||
with: | ||
otc_version: ${{ inputs.otc_version }} | ||
otc_sumo_version: ${{ inputs.otc_sumo_version }} | ||
gh_token: ${{ secrets.gh_artifacts_token }} | ||
otc_build_number: ${{ inputs.otc_build_number }} | ||
target: ${{ inputs.cmake_target }} | ||
workflow_id: ${{ inputs.workflow_id }} | ||
|
@@ -153,11 +149,11 @@ jobs: | |
id: cmake-other | ||
if: runner.os != 'Linux' | ||
env: | ||
OTC_VERSION: ${{ inputs.otc_version }} | ||
OTC_SUMO_VERSION: ${{ inputs.otc_sumo_version }} | ||
GH_TOKEN: ${{ secrets.gh_artifacts_token }} | ||
GH_WORKFLOW_ID: ${{ inputs.workflow_id }} | ||
OTC_BUILD_NUMBER: ${{ inputs.otc_build_number }} | ||
TARGET: ${{ inputs.cmake_target }} | ||
PRODUCTBUILD_IDENTITY_NAME: ${{ secrets.productbuild_identity_name }} | ||
TARGET: ${{ inputs.cmake_target }} | ||
working-directory: build | ||
run: cmake ../ | ||
|
||
|
@@ -172,62 +168,17 @@ jobs: | |
run: > | ||
echo path="$PACKAGE_NAME" >> $GITHUB_OUTPUT | ||
- name: Set simple otc-bin outputs | ||
id: bin | ||
if: ${{ !inputs.use_release_artifacts && inputs.workflow_id != '' }} | ||
env: | ||
OTC_BIN: >- | ||
${{ | ||
steps.cmake-linux.outputs.otc-bin || | ||
steps.cmake-other.outputs.otc-bin | ||
}} | ||
OTC_CONFIG_BIN: >- | ||
${{ | ||
steps.cmake-linux.outputs.otc-config-bin || | ||
steps.cmake-other.outputs.otc-config-bin | ||
}} | ||
run: > | ||
echo otelcol_sumo_path="$OTC_BIN" >> $GITHUB_OUTPUT && | ||
echo otelcol_config_path="$OTC_CONFIG_BIN" >> $GITHUB_OUTPUT | ||
# Download the artifacts required to build the package target. If | ||
# inputs.workflow_id is empty then this will be skipped and CMake will | ||
# attempt to fetch the artifacts from a GitHub Release matching | ||
# otc_version and otc_sumo_version. | ||
- name: Download otelcol-sumo artifact from sumologic-otel-collector | ||
uses: dawidd6/[email protected] | ||
if: ${{ !inputs.use_release_artifacts && inputs.workflow_id != '' }} | ||
with: | ||
github_token: ${{ secrets.gh_artifacts_token }} | ||
repo: SumoLogic/sumologic-otel-collector | ||
run_id: ${{ inputs.workflow_id }} | ||
workflow: dev_builds.yml | ||
workflow_conclusion: success | ||
name: ${{ steps.bin.outputs.otelcol_sumo_path }} | ||
path: ./build/gh-artifacts | ||
if_no_artifact_found: fail | ||
|
||
- name: Download otelcol-config artifact from sumologic-otel-collector | ||
uses: dawidd6/[email protected] | ||
if: inputs.workflow_id != '' | ||
with: | ||
github_token: ${{ secrets.gh_artifacts_token }} | ||
repo: SumoLogic/sumologic-otel-collector | ||
run_id: ${{ inputs.workflow_id }} | ||
workflow: dev_builds.yml | ||
workflow_conclusion: success | ||
name: ${{ steps.bin.outputs.otelcol_config_path }} | ||
path: ./build/gh-artifacts | ||
if_no_artifact_found: fail | ||
|
||
- name: Build package | ||
if: runner.os == 'Linux' | ||
uses: ./ci/github-actions/make | ||
with: | ||
gh_token: ${{ secrets.gh_artifacts_token }} | ||
target: package | ||
|
||
- name: Build package | ||
if: runner.os != 'Linux' | ||
env: | ||
GH_TOKEN: ${{ secrets.gh_artifacts_token }} | ||
working-directory: build | ||
run: make package | ||
|
||
|
@@ -263,20 +214,6 @@ jobs: | |
target: wait-for-packagecloud-indexing | ||
packagecloud-token: ${{ secrets.PACKAGECLOUD_TOKEN }} | ||
|
||
- name: Wait for Packagecloud packages to be indexed | ||
if: runner.os == 'Linux' | ||
uses: ./ci/github-actions/make | ||
with: | ||
target: wait-for-packagecloud-indexing | ||
packagecloud-token: ${{ secrets.PACKAGECLOUD_TOKEN }} | ||
|
||
- name: Wait for Packagecloud packages to be indexed | ||
if: runner.os == 'Linux' | ||
uses: ./ci/github-actions/make | ||
with: | ||
target: wait-for-packagecloud-indexing | ||
packagecloud-token: ${{ secrets.PACKAGECLOUD_TOKEN }} | ||
|
||
test_package: | ||
runs-on: ${{ inputs.runs_on }} | ||
name: Test (CMake) | ||
|
@@ -300,15 +237,11 @@ jobs: | |
runs-on: ${{ inputs.runs_on }} | ||
name: Build (WiX) ${{ inputs.fips && 'FIPS' || '' }} | ||
if: inputs.build_tool == 'wix' | ||
env: | ||
OTC_VERSION: ${{ inputs.otc_version }}-${{ inputs.otc_build_number }} | ||
PRODUCT_VERSION: ${{ inputs.otc_version }}.${{ inputs.otc_build_number }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Workflow URL for sumologic-otel-collector | ||
if: ${{ !inputs.use_release_artifacts && inputs.workflow_id != '' }} | ||
run: | | ||
org="SumoLogic" | ||
repo="sumologic-otel-collector" | ||
|
@@ -321,54 +254,40 @@ jobs: | |
- name: Add msbuild to PATH | ||
uses: microsoft/setup-msbuild@v2 | ||
|
||
- name: Use GitHub Artifacts for binaries | ||
if: ${{ !inputs.use_release_artifacts && inputs.workflow_id != '' }} | ||
run: echo "OTC_ARTIFACTS_SOURCE=github-artifacts" >> $GITHUB_ENV | ||
- name: Fetch version artifact | ||
env: | ||
GH_TOKEN: ${{ secrets.gh_artifacts_token }} | ||
GH_WORKFLOW_ID: ${{ inputs.workflow_id }} | ||
shell: cmd | ||
run: cmake -P version_artifact.cmake | ||
|
||
- name: Determine version from binary | ||
id: determine_version | ||
working-directory: ./build/version_detection | ||
run: > | ||
version=$(./otelcol-sumo.exe --version | | ||
sed -E -n 's/.* v([0-9]+\.[0-9]+\.[0-9]+)\-sumo.*/\1/p') && | ||
echo product_version="${version}.${{ inputs.otc_build_number }}" >> $GITHUB_OUTPUT && | ||
echo otc_version="${version}-${{ inputs.otc_build_number }}" >> $GITHUB_OUTPUT | ||
- name: Determine artifact names | ||
run: | | ||
echo "OTC_WORKFLOW_ARTIFACT_NAME=otelcol-sumo-${{ inputs.fips && 'fips-' || '' }}windows_${{ inputs.goarch }}.exe" >> $GITHUB_ENV | ||
echo "OTC_RELEASE_ARTIFACT_NAME=otelcol-sumo-${{ inputs.otc_version }}-sumo-${{inputs.otc_sumo_version }}-${{ inputs.fips && 'fips-' || '' }}windows_${{ inputs.goarch }}.exe" >> $GITHUB_ENV | ||
echo "OTC_BUILD_INPUT_NAME=otelcol-sumo-windows_${{ inputs.goarch }}.exe" >> $GITHUB_ENV | ||
# Download the artifacts required to build the package target. If | ||
# inputs.workflow_id is empty then this will be skipped and an attempt | ||
# will be made to fetch the artifacts from a GitHub Release matching | ||
# otc_version and otc_sumo_version. | ||
- name: Download artifact from workflow | ||
# Download the artifacts required to build the package target. | ||
- name: Download otelcol-sumo artifact from workflow | ||
uses: dawidd6/[email protected] | ||
if: ${{ !inputs.use_release_artifacts && inputs.workflow_id != '' }} | ||
with: | ||
github_token: ${{ secrets.gh_artifacts_token }} | ||
repo: SumoLogic/sumologic-otel-collector | ||
run_id: ${{ inputs.workflow_id }} | ||
workflow: dev_builds.yml | ||
workflow_conclusion: success | ||
name: ${{ env.OTC_WORKFLOW_ARTIFACT_NAME }} | ||
path: ./build/artifacts | ||
if_no_artifact_found: fail | ||
|
||
# Download the artifacts, required to build the package target, from a | ||
# GitHub Release. | ||
- name: Download artifact from GitHub Release | ||
uses: robinraju/[email protected] | ||
if: ${{ inputs.use_release_artifacts && inputs.workflow_id == '' }} | ||
with: | ||
repository: SumoLogic/sumologic-otel-collector | ||
tag: v${{ inputs.otc_version }}-sumo-${{ inputs.otc_sumo_version }} | ||
fileName: ${{ env.OTC_RELEASE_ARTIFACT_NAME }} | ||
out-file-path: build/artifacts | ||
|
||
- name: Rename GitHub Release artifact | ||
if: ${{ inputs.use_release_artifacts && inputs.workflow_id == '' }} | ||
working-directory: ./build/artifacts | ||
env: | ||
MV_FROM: ${{ env.OTC_RELEASE_ARTIFACT_NAME }} | ||
MV_TO: ${{ env.OTC_BUILD_INPUT_NAME }} | ||
run: mv -n "$MV_FROM" "$MV_TO" | ||
|
||
- name: Rename GitHub Workflow artifact | ||
if: ${{ !inputs.use_release_artifacts && inputs.workflow_id != '' }} | ||
working-directory: ./build/artifacts | ||
env: | ||
MV_FROM: ${{ env.OTC_WORKFLOW_ARTIFACT_NAME }} | ||
|
@@ -380,6 +299,7 @@ jobs: | |
working-directory: ./msi/wix | ||
env: | ||
PLATFORM: ${{ inputs.package_arch }} | ||
PRODUCT_VERSION: ${{ steps.determine_version.outputs.product_version }} | ||
run: | | ||
msbuild.exe -p:Configuration=Release \ | ||
-p:Platform=$PLATFORM \ | ||
|
@@ -411,6 +331,7 @@ jobs: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_REGION: us-west-2 | ||
OTC_VERSION: ${{ steps.determine_version.outputs.otc_version }} | ||
PKG_PATH: ${{ steps.build.outputs.package_path }} | ||
PKG_NAME: ${{ steps.build.outputs.package_filename }} | ||
S3_BUCKET: sumologic-osc-ci-builds | ||
|
Oops, something went wrong.