Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enabled CGO for Macos otelcol contrib #626

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/base-ci-goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
goarch:
required: true
type: string
cgo:
required: true
type: string

jobs:
check-goreleaser:
Expand All @@ -32,7 +35,7 @@ jobs:
GOARCH: arm
- GOOS: windows
GOARCH: s390x
runs-on: ubuntu-22.04
runs-on: ${{ ( matrix.GOOS == 'darwin' && contains( fromJSON( inputs.cgo), 'darwin')) && 'macos-14' || 'ubuntu-22.04' }}

steps:
- name: Checkout
Expand All @@ -41,6 +44,7 @@ jobs:
fetch-depth: 0

- name: Setup QEMU
if: ${{ runner.os != 'macOS' }} # docker/setup-qemu-action action is not available on macos
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
with:
platforms: arm64,ppc64le,linux/arm/v7,s390x
Expand All @@ -53,6 +57,7 @@ jobs:

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
if: ${{ runner.os != 'macOS' }} # docker is not available on macos

- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/base-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
goarch:
required: true
type: string
cgo:
required: true
type: string

jobs:
prepare:
Expand All @@ -32,7 +35,7 @@ jobs:
GOARCH: arm
- GOOS: windows
GOARCH: s390x
runs-on: ubuntu-22.04
runs-on: ${{ ( matrix.GOOS == 'darwin' && contains( fromJSON( inputs.cgo), 'darwin')) && 'macos-14' || 'ubuntu-22.04' }}

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
Expand All @@ -44,10 +47,12 @@ jobs:
- uses: anchore/sbom-action/download-syft@ab9d16d4b419c9d1a02df5213fa0ebe965ca5a57 # v0.17.1

- uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
if: ${{ runner.os != 'macOS' }} # docker/setup-qemu-action action is not available on macos
with:
platforms: arm64,ppc64le,linux/arm/v7,s390x

- uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
pureklkl marked this conversation as resolved.
Show resolved Hide resolved
if: ${{ runner.os != 'macOS' }}

- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-goreleaser-contrib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
distribution: otelcol-contrib
goos: '[ "linux", "windows", "darwin" ]'
goarch: '[ "386", "amd64", "arm64", "ppc64le", "arm", "s390x" ]'
cgo: '[ "darwin" ]'
secrets: inherit

package-tests:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-goreleaser-core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
distribution: otelcol
goos: '[ "linux", "windows", "darwin" ]'
goarch: '[ "386", "amd64", "arm64", "ppc64le", "arm", "s390x" ]'
cgo: '[]'
secrets: inherit

package-tests:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-goreleaser-k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ jobs:
distribution: otelcol-k8s
goos: '[ "linux" ]'
goarch: '[ "amd64", "arm64", "ppc64le", "s390x" ]'
cgo: '[]'
secrets: inherit
1 change: 1 addition & 0 deletions .github/workflows/release-contrib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ jobs:
distribution: otelcol-contrib
goos: '[ "linux", "windows", "darwin" ]'
goarch: '[ "386", "amd64", "arm64", "ppc64le", "arm", "s390x" ]'
cgo: '[ "darwin" ]'
secrets: inherit
permissions: write-all
1 change: 1 addition & 0 deletions .github/workflows/release-core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ jobs:
distribution: otelcol
goos: '[ "linux", "windows", "darwin" ]'
goarch: '[ "386", "amd64", "arm64", "ppc64le", "arm", "s390x" ]'
cgo: '[]'
secrets: inherit
permissions: write-all
1 change: 1 addition & 0 deletions .github/workflows/release-k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ jobs:
distribution: otelcol-k8s
goos: '[ "linux" ]'
goarch: '[ "amd64", "arm64", "ppc64le", "s390x" ]'
cgo: '[]'
secrets: inherit
permissions: write-all
25 changes: 18 additions & 7 deletions distributions/otelcol-contrib/.goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ msi:
builds:
- id: otelcol-contrib
goos:
- darwin
- linux
- windows
goarch:
Expand All @@ -27,12 +26,6 @@ builds:
goarm:
- "7"
ignore:
- goos: darwin
goarch: "386"
- goos: darwin
goarch: arm
- goos: darwin
goarch: s390x
- goos: windows
goarch: arm
- goos: windows
Expand All @@ -48,10 +41,28 @@ builds:
- -trimpath
env:
- CGO_ENABLED=0
- id: otelcol-contrib-cgo
goos:
- darwin
goarch:
- amd64
- arm64
dir: _build
binary: otelcol-contrib
ldflags:
- -s
- -w
flags:
- -trimpath
- -buildmode=pie
env:
- CGO_LDFLAGS='-fstack-protector'
- CGO_ENABLED=1
archives:
- id: otelcol-contrib
builds:
- otelcol-contrib
- otelcol-contrib-cgo
name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}'
nfpms:
- package_name: otelcol-contrib
Expand Down
Loading