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

ci: add dev builds for otelcol sidecar #626

Merged
merged 1 commit into from
Dec 14, 2023
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
34 changes: 33 additions & 1 deletion .github/workflows/dev_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
LATEST_TAG: "main"

jobs:
build-sidecar:
build-fluentbit-sidecar:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -54,6 +54,38 @@ jobs:
run: make build-push-multiplatform TAG=${{ env.SIDECAR_IMAGE_ECR }}:${{ env.LATEST_TAG }}
working-directory: ./sidecar/fluentbit

build-otelcol-sidecar:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache-dependency-path: |
sidecar/otelcol/.otelcol-builder.yaml
sidecar/otelcol/.goreleaser.yaml
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: USERNAME
password: ${{ secrets.CR_PAT }}
- name: Log in to AWS Public ECR
run: make login-ecr
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_TAILING_SIDECAR_DEV }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_TAILING_SIDECAR_DEV }}
- name: Build and push otelcol sidecar image
run: |
make install-builder
make release-dev
working-directory: ./sidecar/otelcol

build-operator:
runs-on: ubuntu-20.04
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ jobs:
with:
go-version: '1.21'
cache-dependency-path: |
.otelcol-builder.yaml
.goreleaser.yaml
sidecar/otelcol/.otelcol-builder.yaml
sidecar/otelcol/.goreleaser.yaml
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
Expand Down
36 changes: 26 additions & 10 deletions sidecar/otelcol/.goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ version: 1

project_name: otelcol-sidecar

env:
- GHCR_IMAGE={{ if index .Env "GHCR_IMAGE" }}{{ .Env.GHCR_IMAGE }}{{ else }}ghcr.io/sumologic/tailing-sidecar-otel{{ end }}
- ECR_IMAGE={{ if index .Env "ECR_IMAGE" }}{{ .Env.ECR_IMAGE }}{{ else }}public.ecr.aws/sumologic/tailing-sidecar-otel{{ end }}

before:
hooks:
- make generate-sources VERSION={{ .Version }}
Expand All @@ -30,17 +34,21 @@ archives:

dockers:
- image_templates:
- "ghcr.io/sumologic/tailing-sidecar-otel:{{ .Version }}-amd64"
- "ghcr.io/sumologic/tailing-sidecar-otel:latest-amd64"
- "{{ .Env.ECR_IMAGE }}:{{ .Version }}-amd64"
- "{{ .Env.ECR_IMAGE }}:main-amd64"
- "{{ .Env.GHCR_IMAGE }}:{{ .Version }}-amd64"
- "{{ .Env.GHCR_IMAGE }}:main-amd64"
use: buildx
goarch: amd64
build_flag_templates:
- "--platform=linux/amd64"
extra_files:
- "config.yaml"
- image_templates:
- "ghcr.io/sumologic/tailing-sidecar-otel:{{ .Version }}-arm64"
- "ghcr.io/sumologic/tailing-sidecar-otel:latest-arm64"
- "{{ .Env.ECR_IMAGE }}:{{ .Version }}-arm64"
- "{{ .Env.ECR_IMAGE }}:main-arm64"
- "{{ .Env.GHCR_IMAGE }}:{{ .Version }}-arm64"
- "{{ .Env.GHCR_IMAGE }}:main-arm64"
use: buildx
goarch: arm64
build_flag_templates:
Expand All @@ -49,14 +57,22 @@ dockers:
- "config.yaml"

docker_manifests:
- name_template: "ghcr.io/sumologic/tailing-sidecar-otel:{{ .Version }}"
- name_template: "{{ .Env.GHCR_IMAGE }}:{{ .Version }}"
image_templates:
- "{{ .Env.GHCR_IMAGE }}:{{ .Version }}-amd64"
- "{{ .Env.GHCR_IMAGE }}:{{ .Version }}-arm64"
- name_template: "{{ .Env.GHCR_IMAGE }}:main"
image_templates:
- "{{ .Env.GHCR_IMAGE }}:main-amd64"
- "{{ .Env.GHCR_IMAGE }}:main-arm64"
- name_template: "{{ .Env.ECR_IMAGE }}:{{ .Version }}"
image_templates:
- "ghcr.io/sumologic/tailing-sidecar-otel:{{ .Version }}-amd64"
- "ghcr.io/sumologic/tailing-sidecar-otel:{{ .Version }}-arm64"
- name_template: "ghcr.io/sumologic/tailing-sidecar-otel:latest"
- "{{ .Env.ECR_IMAGE }}:{{ .Version }}-amd64"
- "{{ .Env.ECR_IMAGE }}:{{ .Version }}-arm64"
- name_template: "{{ .Env.ECR_IMAGE }}:main"
image_templates:
- "ghcr.io/sumologic/tailing-sidecar-otel:latest-amd64"
- "ghcr.io/sumologic/tailing-sidecar-otel:latest-arm64"
- "{{ .Env.ECR_IMAGE }}:main-amd64"
- "{{ .Env.ECR_IMAGE }}:main-arm64"

# we only want to build and publish docker images
release:
Expand Down
14 changes: 14 additions & 0 deletions sidecar/otelcol/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,20 @@ endif
build: ensure-correct-builder-version install-goreleaser
@$(GORELEASER) release --snapshot --clean

.PHONY: release-dev
release-dev: TAG = $(shell git describe --tags --always)
release-dev: ensure-correct-builder-version install-goreleaser
git tag "$(TAG)"
GORELEASER_CURRENT_TAG=$(TAG) \
ECR_IMAGE=public.ecr.aws/sumologic/tailing-sidecar-otel-dev \
GHCR_IMAGE=ghcr.io/sumologic/tailing-sidecar-otel \
make release
git tag -d "$(TAG)"

.PHONY: release
release: ensure-correct-builder-version install-goreleaser
@$(GORELEASER) release --clean

.PHONY: generate-sources
generate-sources:
$(BUILDER) \
Expand Down
Loading