Skip to content

Commit 1ef2cf1

Browse files
committed
fix pipeline
try to move nightly check to distro release pipelines enable otelcol windows re-enable container manifests try disabling image manifests fix env var remove quotes switch to env var for ephermal tag try to exchange latest image tag when building nightly enable container images with personal user only keep a single pre-release add nightly setup to contrib build-only config remove otelcol and otelcol-contrib dockers see if otelcol-contrib works restore otelcol dockers
1 parent d1118a9 commit 1ef2cf1

File tree

10 files changed

+298
-248
lines changed

10 files changed

+298
-248
lines changed

.github/workflows/base-release.yaml

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ on:
1616
required: false
1717
type: string
1818
default: ubuntu-24.04
19+
nightly:
20+
required: false
21+
type: string
22+
default: false
1923

2024
env:
2125
# renovate: datasource=github-tags depName=goreleaser-pro packageName=goreleaser/goreleaser-pro
@@ -74,7 +78,7 @@ jobs:
7478

7579
- name: Set GORELEASER_PREVIOUS_TAG in actual release
7680
id: prev-tag
77-
if: ${{ !contains(github.ref, '-nightly') }}
81+
if: inputs.nightly != 'true'
7882
# find previous tag by filtering out nightly tags and choosing the
7983
# second to last tag (last one is the current release)
8084
run: |
@@ -83,7 +87,7 @@ jobs:
8387
8488
- name: Set nightly enabled
8589
id: nightly-check
86-
if: contains(github.ref, '-nightly')
90+
if: inputs.nightly == 'true'
8791
run: |
8892
echo "NIGHTLY_FLAG=--nightly" >> "$GITHUB_OUTPUT"
8993
@@ -92,18 +96,18 @@ jobs:
9296
env:
9397
DISTRIBUTIONS: ${{ inputs.distribution }}
9498

95-
# - name: Log into Docker.io
96-
# uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
97-
# with:
98-
# username: ${{ secrets.DOCKER_USERNAME }}
99-
# password: ${{ secrets.DOCKER_PASSWORD }}
100-
#
101-
# - name: Login to GitHub Package Registry
102-
# uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
103-
# with:
104-
# registry: ghcr.io
105-
# username: ${{ github.repository_owner }}
106-
# password: ${{ secrets.GITHUB_TOKEN }}
99+
- name: Log into Docker.io
100+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
101+
with:
102+
username: ${{ secrets.DOCKER_USERNAME }}
103+
password: ${{ secrets.DOCKER_PASSWORD }}
104+
105+
- name: Login to GitHub Package Registry
106+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
107+
with:
108+
registry: ghcr.io
109+
username: ${{ github.repository_owner }}
110+
password: ${{ secrets.GITHUB_TOKEN }}
107111

108112
- name: Create artifacts directory to store build artifacts
109113
if: inputs.distribution == 'otelcol-contrib'
@@ -227,18 +231,18 @@ jobs:
227231
shell: bash
228232
run: ls -R distributions/${{ inputs.distribution }}/dist
229233

230-
# - name: Log into Docker.io
231-
# uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
232-
# with:
233-
# username: ${{ secrets.DOCKER_USERNAME }}
234-
# password: ${{ secrets.DOCKER_PASSWORD }}
235-
#
236-
# - name: Login to GitHub Package Registry
237-
# uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
238-
# with:
239-
# registry: ghcr.io
240-
# username: ${{ github.repository_owner }}
241-
# password: ${{ secrets.GITHUB_TOKEN }}
234+
- name: Log into Docker.io
235+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
236+
with:
237+
username: ${{ secrets.DOCKER_USERNAME }}
238+
password: ${{ secrets.DOCKER_PASSWORD }}
239+
240+
- name: Login to GitHub Package Registry
241+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
242+
with:
243+
registry: ghcr.io
244+
username: ${{ github.repository_owner }}
245+
password: ${{ secrets.GITHUB_TOKEN }}
242246

243247
- uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0
244248
with:

.github/workflows/release-contrib.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,32 @@ on:
55
tags: ["v*"]
66

77
jobs:
8+
prepare:
9+
name: Prepare
10+
runs-on: ubuntu-latest
11+
outputs:
12+
NIGHTLY: ${{ steps.nightly-check.outputs.NIGHTLY }}
13+
steps:
14+
- name: Set nightly enabled
15+
id: nightly-check
16+
if: contains(github.ref, '-nightly')
17+
run: |
18+
echo "NIGHTLY=true" >> "$GITHUB_OUTPUT"
819
release:
920
name: Release Contrib
21+
needs: [prepare]
1022
uses: ./.github/workflows/base-release.yaml
1123
with:
1224
distribution: otelcol-contrib
1325
goos: '[ "linux", "darwin" ]'
1426
goarch: '[ "386", "amd64", "arm64", "ppc64le", "arm", "s390x" ]'
27+
nightly: ${{ needs.prepare.outputs.NIGHTLY }}
1528
secrets: inherit
1629
permissions: write-all
1730
release-windows:
1831
name: Release Contrib (Windows)
32+
needs: [prepare]
33+
if: needs.prepare.outputs.NIGHTLY != 'true'
1934
uses: ./.github/workflows/base-release.yaml
2035
with:
2136
distribution: otelcol-contrib

.github/workflows/release-core.yaml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,37 @@ on:
55
tags: ["v*"]
66

77
jobs:
8+
prepare:
9+
name: Prepare
10+
runs-on: ubuntu-latest
11+
outputs:
12+
NIGHTLY: ${{ steps.nightly-check.outputs.NIGHTLY }}
13+
steps:
14+
- name: Set nightly enabled
15+
id: nightly-check
16+
if: contains(github.ref, '-nightly')
17+
run: |
18+
echo "NIGHTLY=true" >> "$GITHUB_OUTPUT"
819
release:
920
name: Release Core
21+
needs: [prepare]
1022
uses: ./.github/workflows/base-release.yaml
1123
with:
1224
distribution: otelcol
1325
goos: '[ "linux", "darwin" ]'
1426
goarch: '[ "386", "amd64", "arm64", "ppc64le", "arm", "s390x" ]'
27+
nightly: ${{ needs.prepare.outputs.NIGHTLY }}
28+
secrets: inherit
29+
permissions: write-all
30+
release-windows:
31+
name: Release Core (Windows)
32+
needs: [prepare]
33+
if: needs.prepare.outputs.NIGHTLY != 'true'
34+
uses: ./.github/workflows/base-release.yaml
35+
with:
36+
distribution: otelcol
37+
goos: '[ "windows" ]'
38+
goarch: '[ "386", "amd64" ]'
39+
runner_os: windows-2022
1540
secrets: inherit
1641
permissions: write-all
17-
# release-windows:
18-
# name: Release Core (Windows)
19-
# uses: ./.github/workflows/base-release.yaml
20-
# with:
21-
# distribution: otelcol
22-
# goos: '[ "windows" ]'
23-
# goarch: '[ "386", "amd64" ]'
24-
# runner_os: windows-2022
25-
# secrets: inherit
26-
# permissions: write-all

cmd/goreleaser/internal/configure.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ const (
3535
k8sDistro = "otelcol-k8s"
3636
otlpDistro = "otelcol-otlp"
3737
ebpfProfilerDistro = "otelcol-ebpf-profiler"
38-
dockerHub = "otel"
39-
ghcr = "ghcr.io/open-telemetry/opentelemetry-collector-releases"
38+
dockerHub = "mowies"
39+
ghcr = "ghcr.io/mowies/opentelemetry-collector-releases"
4040
binaryNamePrefix = "otelcol"
4141
imageNamePrefix = "opentelemetry-collector"
4242
)
@@ -127,7 +127,7 @@ var (
127127
&fullBuildConfig{targetOS: "darwin", targetArch: darwinArchs},
128128
&fullBuildConfig{targetOS: "windows", targetArch: winArchs},
129129
}
130-
}).WithBinArchive().Build()
130+
}).WithBinArchive().WithNightlyConfig().Build()
131131

132132
// k8s distro
133133
k8sDist = newDistributionBuilder(k8sDistro).WithConfigFunc(func(d *distribution) {
@@ -327,7 +327,7 @@ func (b *distributionBuilder) nightly() config.Nightly {
327327
VersionTemplate: "{{ incpatch .Version}}-nightly.{{ .Now.Format \"200601021504\" }}",
328328
TagName: "nightly",
329329
PublishRelease: true,
330-
KeepSingleRelease: false,
330+
KeepSingleRelease: true,
331331
}
332332
}
333333

@@ -441,6 +441,7 @@ func (d *distribution) BuildProject() config.Project {
441441
"COSIGN_YES=true",
442442
"LD_FLAGS=" + ldFlags,
443443
"BUILD_FLAGS=-trimpath",
444+
"CONTAINER_IMAGE_EPHEMERAL_TAG={{ if .IsNightly }}nightly{{ else }}latest{{ end }}",
444445
}
445446
if d.goTags != "" {
446447
env = append(env, "GO_TAGS="+d.goTags)
@@ -475,7 +476,7 @@ func (d *distribution) BuildProject() config.Project {
475476
}
476477

477478
func newContainerImageManifests(dist, os string, archs []string, opts containerImageOptions) []config.DockerManifest {
478-
tags := []string{`{{ .Version }}`, "latest"}
479+
tags := []string{`{{ .Version }}`, "{{ .Env.CONTAINER_IMAGE_EPHEMERAL_TAG }}"}
479480
if os == "windows" {
480481
for i, tag := range tags {
481482
tags[i] = fmt.Sprintf("%s-%s-%s", tag, os, opts.winVersion)
@@ -570,7 +571,7 @@ func dockerImageWithOS(dist, os, arch string, opts containerImageOptions) config
570571
imageTemplates = append(
571572
imageTemplates,
572573
fmt.Sprintf("%s/%s:{{ .Version }}-%s", prefix, imageName(dist), osArch.imageTag()),
573-
fmt.Sprintf("%s/%s:latest-%s", prefix, imageName(dist), osArch.imageTag()),
574+
fmt.Sprintf("%s/%s:{{ .Env.CONTAINER_IMAGE_EPHEMERAL_TAG }}-%s", prefix, imageName(dist), osArch.imageTag()),
574575
)
575576
}
576577

distributions/otelcol-contrib/.goreleaser-build.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ env:
44
- COSIGN_YES=true
55
- LD_FLAGS=-s -w
66
- BUILD_FLAGS=-trimpath
7+
- CONTAINER_IMAGE_EPHEMERAL_TAG={{ if .IsNightly }}nightly{{ else }}latest{{ end }}
78
- CGO_ENABLED=0
89
release:
910
replace_existing_artifacts: true
@@ -58,3 +59,8 @@ monorepo:
5859
tag_prefix: v
5960
partial:
6061
by: target
62+
nightly:
63+
version_template: '{{ incpatch .Version}}-nightly.{{ .Now.Format "200601021504" }}'
64+
tag_name: nightly
65+
publish_release: true
66+
keep_single_release: true

0 commit comments

Comments
 (0)