-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: run linux package tests nightly against latest contrib main (#666)
* run package tests nightly against latest main Signed-off-by: Moritz Wiesinger <[email protected]> * try again Signed-off-by: Moritz Wiesinger <[email protected]> * add mkdir for all distros Signed-off-by: Moritz Wiesinger <[email protected]> * start with adding goreleaser generation code Signed-off-by: Moritz Wiesinger <[email protected]> * generate rest of goreleaser config Signed-off-by: Moritz Wiesinger <[email protected]> * make generate-goreleaser - only reorders things Signed-off-by: Moritz Wiesinger <[email protected]> * polishing Signed-off-by: Moritz Wiesinger <[email protected]> * trigger build * rename files Signed-off-by: Moritz Wiesinger <[email protected]> * rename agai Signed-off-by: Moritz Wiesinger <[email protected]> * remove push trigger Signed-off-by: Moritz Wiesinger <[email protected]> * rename jobs, use pinned ubuntu version Signed-off-by: Moritz Wiesinger <[email protected]> * remove curly braces, refactoring Signed-off-by: Moritz Wiesinger <[email protected]> * minor polishing and refactoring Signed-off-by: Moritz Wiesinger <[email protected]> * remove trigger on PR Signed-off-by: Moritz Wiesinger <[email protected]> * minor refactoring Signed-off-by: Moritz Wiesinger <[email protected]> * renaming Signed-off-by: Moritz Wiesinger <[email protected]> * minor refactoring Signed-off-by: Moritz Wiesinger <[email protected]> * revert beauty changes for separate PR Signed-off-by: Moritz Wiesinger <[email protected]> * rename input variable and add description Signed-off-by: Moritz Wiesinger <[email protected]> * rename build step flag Signed-off-by: Moritz Wiesinger <[email protected]> * add conditional Signed-off-by: Moritz Wiesinger <[email protected]> * better conditionals and namin Signed-off-by: Moritz Wiesinger <[email protected]> * fix workflow reference Signed-off-by: Moritz Wiesinger <[email protected]> * more naming fixes Signed-off-by: Moritz Wiesinger <[email protected]> * enable package test workflow again for debugging Signed-off-by: Moritz Wiesinger <[email protected]> * fix more naming Signed-off-by: Moritz Wiesinger <[email protected]> * refactoring Signed-off-by: Moritz Wiesinger <[email protected]> * use target template variable Signed-off-by: Moritz Wiesinger <[email protected]> * add go386 variable to filenames Signed-off-by: Moritz Wiesinger <[email protected]> * fix template variable Signed-off-by: Moritz Wiesinger <[email protected]> * add goarm64 variable Signed-off-by: Moritz Wiesinger <[email protected]> * adapt goreleaser generator Signed-off-by: Moritz Wiesinger <[email protected]> * line breaks Signed-off-by: Moritz Wiesinger <[email protected]> * prefix nightly steps Signed-off-by: Moritz Wiesinger <[email protected]> * add missing quotes Signed-off-by: Moritz Wiesinger <[email protected]> * try to use target template var again Signed-off-by: Moritz Wiesinger <[email protected]> * try to use target env var more Signed-off-by: Moritz Wiesinger <[email protected]> * revert name template field Signed-off-by: Moritz Wiesinger <[email protected]> * remove debug change Signed-off-by: Moritz Wiesinger <[email protected]> --------- Signed-off-by: Moritz Wiesinger <[email protected]>
- Loading branch information
Showing
12 changed files
with
233 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" ]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,22 +42,32 @@ const ( | |
var ( | ||
ImagePrefixes = []string{DockerHub, GHCR} | ||
Architectures = []string{"386", "amd64", "arm", "arm64", "ppc64le", "s390x"} | ||
ArmVersions = []string{"7"} | ||
DefaultConfigDists = map[string]bool{CoreDistro: true, ContribDistro: true} | ||
MSIWindowsDists = map[string]bool{CoreDistro: true, ContribDistro: true, OTLPDistro: true} | ||
K8sDockerSkipArchs = map[string]bool{"arm": true, "386": true} | ||
K8sGoos = []string{"linux"} | ||
K8sArchs = []string{"amd64", "arm64", "ppc64le", "s390x"} | ||
) | ||
|
||
func Generate(dist string) config.Project { | ||
func GenerateContribBuildOnly(dist string, buildOrRest bool) config.Project { | ||
return config.Project{ | ||
ProjectName: "opentelemetry-collector-releases", | ||
Builds: Builds(dist, buildOrRest), | ||
Version: 2, | ||
Monorepo: config.Monorepo{ | ||
TagPrefix: "v", | ||
}, | ||
} | ||
} | ||
|
||
func Generate(dist string, buildOrRest bool) config.Project { | ||
return config.Project{ | ||
ProjectName: "opentelemetry-collector-releases", | ||
Checksum: config.Checksum{ | ||
NameTemplate: fmt.Sprintf("{{ .ProjectName }}_%v_checksums.txt", dist), | ||
}, | ||
Env: []string{"COSIGN_YES=true"}, | ||
Builds: Builds(dist), | ||
Builds: Builds(dist, buildOrRest), | ||
Archives: Archives(dist), | ||
MSI: WinPackages(dist), | ||
NFPMs: Packages(dist), | ||
|
@@ -73,37 +83,41 @@ func Generate(dist string) config.Project { | |
} | ||
} | ||
|
||
func Builds(dist string) []config.Build { | ||
func Builds(dist string, buildOrRest bool) []config.Build { | ||
return []config.Build{ | ||
Build(dist), | ||
Build(dist, buildOrRest), | ||
} | ||
} | ||
|
||
// Build configures a goreleaser build. | ||
// https://goreleaser.com/customization/build/ | ||
func Build(dist string) config.Build { | ||
var goos []string | ||
var archs []string | ||
var ignore []config.IgnoredBuild | ||
var armVersions []string | ||
func Build(dist string, buildOrRest bool) config.Build { | ||
goos := []string{"darwin", "linux", "windows"} | ||
archs := Architectures | ||
|
||
if dist == ContribDistro && !buildOrRest { | ||
// only return build config for contrib build file | ||
return config.Build{ | ||
ID: dist, | ||
Builder: "prebuilt", | ||
PreBuilt: config.PreBuiltOptions{ | ||
Path: "artifacts/otelcol-contrib_{{ .Target }}" + | ||
"/otelcol-contrib{{- if eq .Os \"windows\" }}.exe{{ end }}", | ||
}, | ||
Goos: goos, | ||
Goarch: archs, | ||
Goarm: ArmVersions(dist), | ||
Dir: "_build", | ||
Binary: dist, | ||
Ignore: IgnoreBuildCombinations(dist), | ||
} | ||
} | ||
|
||
if dist == K8sDistro { | ||
goos = K8sGoos | ||
archs = K8sArchs | ||
ignore = make([]config.IgnoredBuild, 0) | ||
armVersions = make([]string, 0) | ||
} else { | ||
goos = []string{"darwin", "linux", "windows"} | ||
archs = Architectures | ||
ignore = []config.IgnoredBuild{ | ||
{Goos: "darwin", Goarch: "386"}, | ||
{Goos: "darwin", Goarch: "arm"}, | ||
{Goos: "darwin", Goarch: "s390x"}, | ||
{Goos: "windows", Goarch: "arm"}, | ||
{Goos: "windows", Goarch: "arm64"}, | ||
{Goos: "windows", Goarch: "s390x"}, | ||
} | ||
armVersions = ArmVersions | ||
} | ||
|
||
return config.Build{ | ||
ID: dist, | ||
Dir: "_build", | ||
|
@@ -115,12 +129,33 @@ func Build(dist string) config.Build { | |
}, | ||
Goos: goos, | ||
Goarch: archs, | ||
Goarm: armVersions, | ||
Ignore: ignore, | ||
Goarm: ArmVersions(dist), | ||
Ignore: IgnoreBuildCombinations(dist), | ||
} | ||
} | ||
|
||
func Archives(dist string) (r []config.Archive) { | ||
func IgnoreBuildCombinations(dist string) []config.IgnoredBuild { | ||
if dist == K8sDistro { | ||
return nil | ||
} | ||
return []config.IgnoredBuild{ | ||
{Goos: "darwin", Goarch: "386"}, | ||
{Goos: "darwin", Goarch: "arm"}, | ||
{Goos: "darwin", Goarch: "s390x"}, | ||
{Goos: "windows", Goarch: "arm"}, | ||
{Goos: "windows", Goarch: "arm64"}, | ||
{Goos: "windows", Goarch: "s390x"}, | ||
} | ||
} | ||
|
||
func ArmVersions(dist string) []string { | ||
if dist == K8sDistro { | ||
return nil | ||
} | ||
return []string{"7"} | ||
} | ||
|
||
func Archives(dist string) []config.Archive { | ||
return []config.Archive{ | ||
Archive(dist), | ||
} | ||
|
@@ -138,7 +173,7 @@ func Archive(dist string) config.Archive { | |
|
||
func WinPackages(dist string) []config.MSI { | ||
if _, ok := MSIWindowsDists[dist]; !ok { | ||
return []config.MSI{} | ||
return nil | ||
} | ||
return []config.MSI{ | ||
WinPackage(dist), | ||
|
@@ -160,9 +195,9 @@ func WinPackage(dist string) config.MSI { | |
} | ||
} | ||
|
||
func Packages(dist string) (r []config.NFPM) { | ||
func Packages(dist string) []config.NFPM { | ||
if dist == K8sDistro { | ||
return []config.NFPM{} | ||
return nil | ||
} | ||
return []config.NFPM{ | ||
Package(dist), | ||
|
@@ -191,21 +226,17 @@ func Package(dist string) config.NFPM { | |
}) | ||
} | ||
return config.NFPM{ | ||
ID: dist, | ||
Builds: []string{dist}, | ||
Formats: []string{"deb", "rpm"}, | ||
|
||
ID: dist, | ||
Builds: []string{dist}, | ||
Formats: []string{"deb", "rpm"}, | ||
License: "Apache 2.0", | ||
Description: fmt.Sprintf("OpenTelemetry Collector - %s", dist), | ||
Maintainer: "The OpenTelemetry Collector maintainers <[email protected]>", | ||
Overrides: map[string]config.NFPMOverridables{ | ||
"rpm": { | ||
Dependencies: []string{ | ||
"/bin/sh", | ||
}, | ||
Dependencies: []string{"/bin/sh"}, | ||
}, | ||
}, | ||
|
||
NFPMOverridables: config.NFPMOverridables{ | ||
PackageName: dist, | ||
Scripts: config.NFPMScripts{ | ||
|
@@ -219,16 +250,14 @@ func Package(dist string) config.NFPM { | |
} | ||
|
||
func DockerImages(dist string) []config.Docker { | ||
r := make([]config.Docker, 0) | ||
var r []config.Docker | ||
for _, arch := range Architectures { | ||
if dist == K8sDistro { | ||
if _, ok := K8sDockerSkipArchs[arch]; ok { | ||
continue | ||
} | ||
if dist == K8sDistro && K8sDockerSkipArchs[arch] { | ||
continue | ||
} | ||
switch arch { | ||
case ArmArch: | ||
for _, vers := range ArmVersions { | ||
for _, vers := range ArmVersions(dist) { | ||
r = append(r, DockerImage(dist, arch, vers)) | ||
} | ||
default: | ||
|
@@ -302,7 +331,7 @@ func DockerManifest(prefix, version, dist string) config.DockerManifest { | |
} | ||
switch arch { | ||
case ArmArch: | ||
for _, armVers := range ArmVersions { | ||
for _, armVers := range ArmVersions(dist) { | ||
dockerArchTag := strings.ReplaceAll(archName(arch, armVers), "/", "") | ||
imageTemplates = append( | ||
imageTemplates, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.