Skip to content

Commit

Permalink
[chore] Split core and contrib workflows (#477)
Browse files Browse the repository at this point in the history
* Split core and contrib workflows

* Use reusable workflows

* Fix bad merge

* Fix bad merge
  • Loading branch information
TylerHelmuth committed Feb 19, 2024
1 parent e516602 commit 491aecf
Show file tree
Hide file tree
Showing 9 changed files with 133 additions and 38 deletions.
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
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

0 comments on commit 491aecf

Please sign in to comment.