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

[chore] Split core and contrib workflows #477

Merged
merged 5 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
name: Continuous Integration - GoReleaser
name: Reusable GoReleaser CI workflow

on:
push:
branches: [main]
paths:
- ".goreleaser.yaml"
- "distributions/otelcol/manifest.yaml"
- "distributions/otelcol-contrib/manifest.yaml"
pull_request:
branches: [main]
paths:
- ".goreleaser.yaml"
- "distributions/otelcol/manifest.yaml"
- "distributions/otelcol-contrib/manifest.yaml"
workflow_call:
inputs:
distribution:
required: true
type: string

jobs:
check-goreleaser:
name: Check GoReleaser Configuration
name: Check GoReleaser Configuration for ${{ inputs.distribution }}
strategy:
matrix:
GOOS: [linux, windows, darwin]
GOARCH: ["386", amd64, arm64, ppc64le, arm, s390x]
GOOS: [ linux, windows, darwin ]
GOARCH: [ "386", amd64, arm64, ppc64le, arm, s390x ]
exclude:
- GOOS: darwin
GOARCH: "386"
Expand Down Expand Up @@ -59,13 +52,13 @@ jobs:
- name: Generate the sources
run: make generate-sources

- name: Run GoReleaser
- name: Run GoReleaser for ${{ inputs.distribution }}
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser-pro
version: latest
args: --snapshot --clean --skip-sign --skip-sbom --timeout 2h --split
args: --snapshot --clean --skip-sign --skip-sbom --timeout 2h --split --id ${{ inputs.distribution }}
env:
GOOS: ${{ matrix.GOOS }}
GOARCH: ${{ matrix.GOARCH }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
name: Release
name: Reusable release workflow

on:
push:
tags: ["v*"]
workflow_call:
inputs:
distribution:
required: true
type: string

jobs:
prepare:
name: Prepare ${{ inputs.distribution }} Release
strategy:
matrix:
GOOS: [linux, windows, darwin]
Expand Down Expand Up @@ -70,7 +74,7 @@ jobs:
with:
distribution: goreleaser-pro
version: latest
args: release --clean --split --timeout 2h
args: release --clean --split --timeout 2h --id $ {{ inputs.distribution }}
env:
GOOS: ${{ matrix.GOOS }}
GOARCH: ${{ matrix.GOARCH }}
Expand All @@ -84,7 +88,7 @@ jobs:
path: dist/*/*

release:
name: Release
name: ${{ inputs.distribution }} Release
runs-on: ubuntu-20.04
needs: prepare

Expand Down Expand Up @@ -133,7 +137,7 @@ jobs:
with:
distribution: goreleaser-pro
version: latest
args: continue --merge --timeout 2h
args: continue --merge --timeout 2h --id ${{ inputs.distribution }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COSIGN_YES: true
jpkrohling marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/ci-goreleaser-contrib.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Continuous Integration - Contrib - GoReleaser

on:
push:
branches: [main]
paths:
- ".goreleaser.yaml"
- "distributions/otelcol-contrib/manifest.yaml"
pull_request:
branches: [main]
paths:
- ".goreleaser.yaml"
- "distributions/otelcol-contrib/manifest.yaml"

jobs:
check-goreleaser:
name: Continuous Integration - Contrib - GoReleaser
uses: ./.github/workflows/base-ci-goreleaser.yaml
with:
distribution: otelcol-contrib
secrets: inherit
22 changes: 22 additions & 0 deletions .github/workflows/ci-goreleaser-core.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Continuous Integration - Core - GoReleaser

on:
push:
branches: [main]
paths:
- ".goreleaser.yaml"
- "distributions/otelcol/manifest.yaml"
pull_request:
branches: [main]
paths:
- ".goreleaser.yaml"
- "distributions/otelcol/manifest.yaml"


jobs:
check-goreleaser:
name: Continuous Integration - Core - GoReleaser
uses: ./.github/workflows/base-ci-goreleaser.yaml
with:
distribution: otelcol
secrets: inherit
14 changes: 14 additions & 0 deletions .github/workflows/release-contrib.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Release Contrib

on:
push:
tags: ["v*"]

jobs:
release:
name: Release Contrib
uses: ./.github/workflows/base-release.yaml
with:
distribution: otelcol-contrib
secrets: inherit
permissions: write-all
14 changes: 14 additions & 0 deletions .github/workflows/release-core.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Release Core

on:
push:
tags: ["v*"]

jobs:
release:
name: Release Core
uses: ./.github/workflows/base-release.yaml
with:
distribution: otelcol
secrets: inherit
permissions: write-all
48 changes: 36 additions & 12 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ nfpms:
checksum:
name_template: '{{ .ProjectName }}_checksums.txt'
dockers:
- goos: linux
- ids:
- otelcol
goos: linux
goarch: "386"
dockerfile: distributions/otelcol/Dockerfile
image_templates:
Expand All @@ -156,7 +158,9 @@ dockers:
- --label=org.opencontainers.image.version={{.Version}}
- --label=org.opencontainers.image.source={{.GitURL}}
use: buildx
- goos: linux
- ids:
- otelcol
goos: linux
goarch: amd64
dockerfile: distributions/otelcol/Dockerfile
image_templates:
Expand All @@ -175,7 +179,9 @@ dockers:
- --label=org.opencontainers.image.version={{.Version}}
- --label=org.opencontainers.image.source={{.GitURL}}
use: buildx
- goos: linux
- ids:
- otelcol
goos: linux
goarch: arm
goarm: "7"
dockerfile: distributions/otelcol/Dockerfile
Expand All @@ -195,7 +201,9 @@ dockers:
- --label=org.opencontainers.image.version={{.Version}}
- --label=org.opencontainers.image.source={{.GitURL}}
use: buildx
- goos: linux
- ids:
- otelcol
goos: linux
goarch: arm64
dockerfile: distributions/otelcol/Dockerfile
image_templates:
Expand All @@ -214,7 +222,9 @@ dockers:
- --label=org.opencontainers.image.version={{.Version}}
- --label=org.opencontainers.image.source={{.GitURL}}
use: buildx
- goos: linux
- ids:
- otelcol
goos: linux
goarch: ppc64le
dockerfile: distributions/otelcol/Dockerfile
image_templates:
Expand All @@ -233,7 +243,9 @@ dockers:
- --label=org.opencontainers.image.version={{.Version}}
- --label=org.opencontainers.image.source={{.GitURL}}
use: buildx
- goos: linux
- ids:
- otelcol
goos: linux
goarch: s390x
dockerfile: distributions/otelcol/Dockerfile
image_templates:
Expand All @@ -252,7 +264,9 @@ dockers:
- --label=org.opencontainers.image.version={{.Version}}
- --label=org.opencontainers.image.source={{.GitURL}}
use: buildx
- goos: linux
- ids:
- otelcol-contrib
goos: linux
goarch: "386"
dockerfile: distributions/otelcol-contrib/Dockerfile
image_templates:
Expand All @@ -271,7 +285,9 @@ dockers:
- --label=org.opencontainers.image.version={{.Version}}
- --label=org.opencontainers.image.source={{.GitURL}}
use: buildx
- goos: linux
- ids:
- otelcol-contrib
goos: linux
goarch: amd64
dockerfile: distributions/otelcol-contrib/Dockerfile
image_templates:
Expand All @@ -290,7 +306,9 @@ dockers:
- --label=org.opencontainers.image.version={{.Version}}
- --label=org.opencontainers.image.source={{.GitURL}}
use: buildx
- goos: linux
- ids:
- otelcol-contrib
goos: linux
goarch: arm
goarm: "7"
dockerfile: distributions/otelcol-contrib/Dockerfile
Expand All @@ -310,7 +328,9 @@ dockers:
- --label=org.opencontainers.image.version={{.Version}}
- --label=org.opencontainers.image.source={{.GitURL}}
use: buildx
- goos: linux
- ids:
- otelcol-contrib
goos: linux
goarch: arm64
dockerfile: distributions/otelcol-contrib/Dockerfile
image_templates:
Expand All @@ -329,7 +349,9 @@ dockers:
- --label=org.opencontainers.image.version={{.Version}}
- --label=org.opencontainers.image.source={{.GitURL}}
use: buildx
- goos: linux
- ids:
- otelcol-contrib
goos: linux
goarch: ppc64le
dockerfile: distributions/otelcol-contrib/Dockerfile
image_templates:
Expand All @@ -348,7 +370,9 @@ dockers:
- --label=org.opencontainers.image.version={{.Version}}
- --label=org.opencontainers.image.source={{.GitURL}}
use: buildx
- goos: linux
- ids:
- otelcol-contrib
goos: linux
goarch: s390x
dockerfile: distributions/otelcol-contrib/Dockerfile
image_templates:
Expand Down
3 changes: 3 additions & 0 deletions cmd/goreleaser/internal/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ func DockerImage(imagePrefixes []string, dist, arch, armVersion string) config.D
Goos: "linux",
Goarch: arch,
Goarm: armVersion,
IDs: []string{
dist,
},
}
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/open-telemetry/opentelemetry-collector-releases

go 1.21

toolchain go1.21.3
toolchain go1.21.7

require (
github.com/goreleaser/goreleaser v1.24.0
Expand Down