Skip to content

Commit

Permalink
Merge branch 'main' into add-msi-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pjanotti authored Dec 2, 2024
2 parents 51d43d1 + 1271690 commit 2ff95d7
Show file tree
Hide file tree
Showing 21 changed files with 251 additions and 69 deletions.
75 changes: 73 additions & 2 deletions .github/workflows/base-ci-goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@ on:
goarch:
required: true
type: string
nightly:
required: false
type: boolean
default: false
description: "Set to true to fetch latest otelcol-contrib main branch version instead of building the version in this repo"

env:
# renovate: datasource=github-tags depName=goreleaser-pro packageName=goreleaser/goreleaser-pro
GORELEASER_PRO_VERSION: v2.4.1
GORELEASER_PRO_VERSION: v2.4.8

jobs:
check-goreleaser:
Expand Down Expand Up @@ -64,9 +69,75 @@ jobs:
go-version: '1.23'
check-latest: true

- name: Generate the sources
- name: Create artifacts directory to store build artifacts
if: inputs.distribution == 'otelcol-contrib'
run: mkdir -p distributions/otelcol-contrib/artifacts

- name: "[Nightly] Get latest finished run ID from contrib repo build-and-test"
id: get-run-id
if: inputs.distribution == 'otelcol-contrib' && inputs.nightly == true && matrix.GOARCH == 'amd64' && matrix.GOOS == 'linux'
env:
GH_TOKEN: ${{ github.token }}
run: |
run_id=$(gh run list \
--branch main \
--workflow build-and-test \
--repo open-telemetry/opentelemetry-collector-contrib \
--limit 1 \
--status success \
--json databaseId \
--jq '.[0].databaseId' \
)
echo "Found run ID: $run_id"
echo "run_id=$run_id" >> "$GITHUB_OUTPUT"
- name: "[Nightly] Create sub-directory for otelcol-contrib nightly build"
if: inputs.distribution == 'otelcol-contrib' && inputs.nightly == true && matrix.GOARCH == 'amd64' && matrix.GOOS == 'linux'
run: mkdir -p distributions/otelcol-contrib/artifacts/otelcol-contrib_linux_amd64_v1

- name: "[Nightly] Download built otelcol-contrib artifact from contrib repo"
if: inputs.distribution == 'otelcol-contrib' && inputs.nightly == true && matrix.GOARCH == 'amd64' && matrix.GOOS == 'linux'
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: collector-binaries-linux-amd64
repository: open-telemetry/opentelemetry-collector-contrib
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ steps.get-run-id.outputs.run_id }}

- name: "[Nightly] Move downloaded artifact"
if: inputs.distribution == 'otelcol-contrib' && inputs.nightly == true && matrix.GOARCH == 'amd64' && matrix.GOOS == 'linux'
run: mv otelcontribcol_linux_amd64 distributions/otelcol-contrib/artifacts/otelcol-contrib_linux_amd64_v1/otelcol-contrib

- name: Generate the sources for ${{ inputs.distribution }}
if: inputs.nightly != true
env:
DISTRIBUTIONS: ${{ inputs.distribution }}
run: make generate-sources

# otelcol-contrib is built in a separate stage
- name: Build ${{ inputs.distribution }}
if: inputs.distribution == 'otelcol-contrib' && inputs.nightly != true
uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0
with:
distribution: goreleaser-pro
version: ${{ env.GORELEASER_PRO_VERSION }}
workdir: distributions/otelcol-contrib
args: --snapshot --clean --timeout 2h --split --config .goreleaser-build.yaml
env:
GOOS: ${{ matrix.GOOS }}
GOARCH: ${{ matrix.GOARCH }}
GOARM: 7 # Default is 6
GOAMD64: v1
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

- name: Move built artifacts
if: inputs.distribution == 'otelcol-contrib' && inputs.nightly != true
run: mv distributions/otelcol-contrib/dist/**/* distributions/otelcol-contrib/artifacts/

- name: Show built or downloaded content
if: inputs.distribution == 'otelcol-contrib'
run: ls -laR distributions/otelcol-contrib/artifacts

- name: Run GoReleaser for ${{ inputs.distribution }}
uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0
with:
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions .github/workflows/base-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:

env:
# renovate: datasource=github-tags depName=goreleaser-pro packageName=goreleaser/goreleaser-pro
GORELEASER_PRO_VERSION: v2.4.1
GORELEASER_PRO_VERSION: v2.4.8

jobs:
prepare:
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:

- uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0

- uses: anchore/sbom-action/download-syft@fc46e51fd3cb168ffb36c6d1915723c47db58abb # v0.17.7
- uses: anchore/sbom-action/download-syft@55dc4ee22412511ee8c3142cbea40418e6cec693 # v0.17.8

- uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
with:
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:

- uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0

- uses: anchore/sbom-action/download-syft@fc46e51fd3cb168ffb36c6d1915723c47db58abb # v0.17.7
- uses: anchore/sbom-action/download-syft@55dc4ee22412511ee8c3142cbea40418e6cec693 # v0.17.8

- uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/builder-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

env:
# renovate: datasource=github-tags depName=goreleaser-pro packageName=goreleaser/goreleaser-pro
GORELEASER_PRO_VERSION: v2.4.1
GORELEASER_PRO_VERSION: v2.4.8

jobs:
goreleaser:
Expand Down Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Copy Dockerfile to Core Repo directory
run: cp cmd/builder/Dockerfile .core/cmd/builder/Dockerfile
- uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
- uses: anchore/sbom-action/download-syft@fc46e51fd3cb168ffb36c6d1915723c47db58abb # v0.17.7
- uses: anchore/sbom-action/download-syft@55dc4ee22412511ee8c3142cbea40418e6cec693 # v0.17.8
- uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
with:
platforms: amd64, arm64,ppc64le
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/builder-testbuild.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Builder - Check and Test Build

on:
merge_group:
push:
branches: [main]
paths:
Expand All @@ -24,7 +25,7 @@ on:

env:
# renovate: datasource=github-tags depName=goreleaser-pro packageName=goreleaser/goreleaser-pro
GORELEASER_PRO_VERSION: v2.4.1
GORELEASER_PRO_VERSION: v2.4.8

jobs:
check-goreleaser:
Expand All @@ -43,7 +44,7 @@ jobs:
- name: Copy Dockerfile to Core Repo directory
run: cp cmd/builder/Dockerfile .core/cmd/builder/Dockerfile
- uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
- uses: anchore/sbom-action/download-syft@fc46e51fd3cb168ffb36c6d1915723c47db58abb # v0.17.7
- uses: anchore/sbom-action/download-syft@55dc4ee22412511ee8c3142cbea40418e6cec693 # v0.17.8
- uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
with:
platforms: amd64, arm64,ppc64le
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-goreleaser-contrib.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Continuous Integration - Contrib - GoReleaser

on:
merge_group:
push:
branches: [main]
paths:
Expand Down Expand Up @@ -35,7 +36,7 @@ jobs:
package-tests:
name: Package tests
needs: check-goreleaser
uses: ./.github/workflows/package-tests.yaml
uses: ./.github/workflows/base-package-tests.yaml
with:
distribution: otelcol-contrib
type: '[ "deb", "rpm" ]'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci-goreleaser-core.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Continuous Integration - Core - GoReleaser

on:
merge_group:
push:
branches: [main]
paths:
Expand Down Expand Up @@ -35,7 +36,7 @@ jobs:
package-tests:
name: Package tests
needs: check-goreleaser
uses: ./.github/workflows/package-tests.yaml
uses: ./.github/workflows/base-package-tests.yaml
with:
distribution: otelcol
type: '[ "deb", "rpm" ]'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-goreleaser-k8s.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Continuous Integration - k8s - GoReleaser

on:
merge_group:
push:
branches: [main]
paths:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-goreleaser-otlp.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Continuous Integration - OTLP - GoReleaser

on:
merge_group:
push:
branches: [main]
paths:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Continuous Integration

on:
merge_group:
push:
branches: [main]
pull_request:
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/package-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Package Tests - Contrib

on:
schedule:
- cron: "0 2 * * *" # every day at 2am UTC

jobs:
check-goreleaser:
name: Build - Contrib - GoReleaser
uses: ./.github/workflows/base-ci-goreleaser.yaml
with:
distribution: otelcol-contrib
goos: '[ "linux" ]'
goarch: '[ "amd64" ]'
nightly: true
secrets: inherit

package-tests:
name: Linux Package tests
needs: check-goreleaser
uses: ./.github/workflows/base-package-tests.yaml
with:
distribution: otelcol-contrib
type: '[ "deb", "rpm" ]'
1 change: 1 addition & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Shellcheck lint
on:
merge_group:
push:
branches: [ main ]
pull_request:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ delete-tags:
# Used for debug only
REMOTE?[email protected]:open-telemetry/opentelemetry-collector-releases.git
.PHONY: repeat-tags
repeat-tags: delete-tags push-tags
repeat-tags: delete-tags push-tags
Loading

0 comments on commit 2ff95d7

Please sign in to comment.