Skip to content

Commit

Permalink
squash jackgopack4 commits
Browse files Browse the repository at this point in the history
  • Loading branch information
jackgopack4 committed Jul 30, 2024
1 parent cc3161a commit 215f699
Show file tree
Hide file tree
Showing 21 changed files with 631 additions and 397 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/base-ci-goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,30 @@ jobs:
GOARCH: arm
- GOOS: windows
GOARCH: s390x
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0

- name: Setup QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3.1.0
with:
platforms: arm64,ppc64le,linux/arm/v7,s390x

- name: Setup wixl # Required to build MSI packages for Windows
if: ${{ matrix.GOOS }} == 'windows' && (${{ matrix.GOARCH }} == '386' || ${{ matrix.GOARCH }} == 'amd64')
run: |
sudo apt-get update
sudo apt-get install -y wixl
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0

- name: Setup Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: '1.22'
check-latest: true
Expand All @@ -58,7 +64,7 @@ jobs:
run: make generate-sources

- name: Run GoReleaser for ${{ inputs.distribution }}
uses: goreleaser/goreleaser-action@5742e2a039330cbb23ebf35f046f814d4c6ff811 # v5.1.0
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
distribution: goreleaser-pro
version: latest
Expand Down
46 changes: 26 additions & 20 deletions .github/workflows/base-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,39 +32,45 @@ jobs:
GOARCH: arm
- GOOS: windows
GOARCH: s390x
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0

- uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0

- uses: anchore/sbom-action/download-syft@e8d2a6937ecead383dfe75190d104edd1f9c5751 # v0.16.0
- uses: anchore/sbom-action/download-syft@d94f46e13c6c62f59525ac9a1e147a99dc0b9bf5 # v0.17.0

- uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
- uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3.1.0
with:
platforms: arm64,ppc64le,linux/arm/v7,s390x

- uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
- uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0

- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: '1.22'
check-latest: true

- name: Setup wixl # Required to build MSI packages for Windows
if: ${{ matrix.GOOS }} == 'windows' && (${{ matrix.GOARCH }} == '386' || ${{ matrix.GOARCH }} == 'amd64')
run: |
sudo apt-get update
sudo apt-get install -y wixl
- name: Generate distribution sources
run: make generate-sources

- name: Log into Docker.io
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to GitHub Package Registry
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
Expand All @@ -74,7 +80,7 @@ jobs:
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: goreleaser/goreleaser-action@5742e2a039330cbb23ebf35f046f814d4c6ff811 # v5.1.0
- uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
distribution: goreleaser-pro
version: latest
Expand All @@ -87,15 +93,15 @@ jobs:
COSIGN_YES: true
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: artifacts-${{ inputs.distribution }}-${{ matrix.GOOS }}-${{ matrix.GOARCH }}
path: distributions/${{ inputs.distribution }}/dist/**/*
if-no-files-found: error

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

permissions:
Expand All @@ -104,26 +110,26 @@ jobs:
contents: write

steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0

- uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0

- uses: anchore/sbom-action/download-syft@e8d2a6937ecead383dfe75190d104edd1f9c5751 # v0.16.0
- uses: anchore/sbom-action/download-syft@d94f46e13c6c62f59525ac9a1e147a99dc0b9bf5 # v0.17.0

- uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
- uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3.1.0
with:
platforms: arm64,ppc64le,s390x

- uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
- uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0

- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: '1.22'
check-latest: true

- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
pattern: artifacts-${{ inputs.distribution }}-*
path: distributions/${{ inputs.distribution }}/dist
Expand All @@ -133,19 +139,19 @@ jobs:
run: ls -R distributions/${{ inputs.distribution }}/dist

- name: Log into Docker.io
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to GitHub Package Registry
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: goreleaser/goreleaser-action@5742e2a039330cbb23ebf35f046f814d4c6ff811 # v5.1.0
- uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
distribution: goreleaser-pro
version: latest
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/builder-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Builder - Release

on:
push:
tags:
- "cmd/builder/v*"

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout Releases Repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
repository: "open-telemetry/opentelemetry-collector-releases"
- name: Checkout Core Repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
repository: "open-telemetry/opentelemetry-collector"
ref: ${{ github.ref_name }}
path: ".core"
- name: List directory contents
run: ls -al
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ~1.21.5
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
distribution: goreleaser-pro
version: latest
args: release --clean -f cmd/builder/.goreleaser.yml
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ on:
jobs:
build:
name: Build
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: '1.22'
check-latest: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ jobs:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # 2.0.0
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ dist/
.idea
.generated-yaml/
.vscode
.core
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ This repository contains a set of resources that ultimately results in OpenTelem

### Distribution directory

Each distribution has its own directory at the root of this repository, such as `opentelemetry-collector`. Within each one of those, you'll find at least two files:
Each distribution has its own directory under the [`distributions`](./distributions/) folder, such as [`otelcol`](./distributions/otelcol/).
Within each one of those, you'll find at least two files:

- `Dockerfile`, determining how to build the container image for this distribution
- `manifest.yaml`, which is used with [ocb](https://github.com/open-telemetry/opentelemetry-collector/tree/main/cmd/builder) to generate the sources for the distribution.
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GO ?= go
GORELEASER ?= goreleaser

OTELCOL_BUILDER_VERSION ?= 0.101.0
OTELCOL_BUILDER_VERSION ?= 0.105.0
OTELCOL_BUILDER_DIR ?= ${HOME}/bin
OTELCOL_BUILDER ?= ${OTELCOL_BUILDER_DIR}/ocb

Expand Down Expand Up @@ -40,7 +40,7 @@ ifeq (, $(shell command -v ocb 2>/dev/null))
[ "$${machine}" != x86_64 ] || machine=amd64 ;\
echo "Installing ocb ($${os}/$${machine}) at $(OTELCOL_BUILDER_DIR)";\
mkdir -p $(OTELCOL_BUILDER_DIR) ;\
curl -sfLo $(OTELCOL_BUILDER) "https://github.com/open-telemetry/opentelemetry-collector/releases/download/cmd%2Fbuilder%2Fv$(OTELCOL_BUILDER_VERSION)/ocb_$(OTELCOL_BUILDER_VERSION)_$${os}_$${machine}" ;\
curl -sfLo $(OTELCOL_BUILDER) "https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/cmd%2Fbuilder%2Fv$(OTELCOL_BUILDER_VERSION)/ocb_$(OTELCOL_BUILDER_VERSION)_$${os}_$${machine}" ;\
chmod +x $(OTELCOL_BUILDER) ;\
}
else
Expand Down
39 changes: 39 additions & 0 deletions cmd/builder/.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
before:
hooks:
- go mod download
monorepo:
tag_prefix: cmd/builder/
dir: .core/cmd/builder
builds:
- flags:
- -trimpath
ldflags:
- -s -w -X go.opentelemetry.io/collector/cmd/builder/internal.version={{.Version}} -X go.opentelemetry.io/collector/cmd/builder/internal.date={{.Date}}
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
- ppc64le
ignore:
- goos: windows
goarch: arm64
binary: ocb
release:
github:
owner: open-telemetry
name: opentelemetry-collector-releases
header: |
### Images and binaries here: https://github.com/open-telemetry/opentelemetry-collector-releases/releases/tag/{{ .Tag }}
archives:
- format: binary
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
disable: true
26 changes: 23 additions & 3 deletions cmd/goreleaser/internal/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ import (
"path"
"strings"

"github.com/goreleaser/goreleaser/pkg/config"
"github.com/goreleaser/nfpm/v2/files"
"github.com/goreleaser/goreleaser-pro/pkg/config"
)

const ArmArch = "arm"
Expand All @@ -45,6 +44,7 @@ func Generate(dist string) config.Project {
Env: []string{"COSIGN_YES=true"},
Builds: Builds(dist),
Archives: Archives(dist),
MSI: WinPackages(dist),
NFPMs: Packages(dist),
Dockers: DockerImages(dist),
DockerManifests: DockerManifests(dist),
Expand Down Expand Up @@ -102,6 +102,26 @@ func Archive(dist string) config.Archive {
}
}

func WinPackages(dist string) []config.MSI {
return []config.MSI{
WinPackage(dist),
}
}

// Package configures goreleaser to build a Windows MSI package.
// https://goreleaser.com/customization/msi/
func WinPackage(dist string) config.MSI {
return config.MSI{
ID: dist,
Name: fmt.Sprintf("%s_{{ .Version }}_{{ .Os }}_{{ .MsiArch }}", dist),
WXS: "windows-installer.wxs",
Files: []string{
"config.yaml",
"opentelemetry.ico",
},
}
}

func Packages(dist string) (r []config.NFPM) {
return []config.NFPM{
Package(dist),
Expand All @@ -127,7 +147,7 @@ func Package(dist string) config.NFPM {
PostInstall: "postinstall.sh",
PreRemove: "preremove.sh",
},
Contents: files.Contents{
Contents: config.NFPMContents{
{
Source: fmt.Sprintf("%s.service", dist),
Destination: path.Join("/lib", "systemd", "system", fmt.Sprintf("%s.service", dist)),
Expand Down
7 changes: 7 additions & 0 deletions distributions/otelcol-contrib/.goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ partial:
project_name: opentelemetry-collector-releases
env:
- COSIGN_YES=true
msi:
- id: otelcol-contrib
name: otelcol-contrib_{{ .Version }}_{{ .Os }}_{{ .MsiArch }}
wxs: windows-installer.wxs
extra_files:
- config.yaml
- opentelemetry.ico
builds:
- id: otelcol-contrib
goos:
Expand Down
Loading

0 comments on commit 215f699

Please sign in to comment.