Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into vsukhin/feature/webho…
Browse files Browse the repository at this point in the history
…ok-payload-object-field
  • Loading branch information
vsukhin committed Mar 24, 2023
2 parents d3a9f19 + b7c9baa commit 828e71b
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 110 deletions.
42 changes: 12 additions & 30 deletions .github/workflows/docker-build-stage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,28 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Docker meta for Testkube operator
id: meta_testkube_operator
uses: docker/metadata-action@v3
with:
images: kubeshop/testkube-operator
tags: |
type=sha
- name: Build
uses: docker/bake-action@v1
with:
files: |
docker-bake.hcl
${{ steps.meta_testkube_operator.outputs.bake-file }}
targets: build
push: true

- name: Output commit sha
id: github_sha
run: echo "::set-output name=sha_short::${GITHUB_SHA::7}"

- name: Docker meta for Testkube certificate image
id: meta_testkube_certificate
uses: docker/metadata-action@v3
- name: Build images with GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
images: kubeshop/testkube-certificate
tags: |
type=sha
distribution: goreleaser
version: latest
args: release -f .goreleaser-stage.yaml --snapshot
env:
GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }}

- name: Push Docker images
run: |
docker push kubeshop/testkube-operator:${{ steps.github_sha.outputs.sha_short }}
#Trigger Helm repo workflow to deploy Dashboard to Stage cluster
- name: Repository Dispatch
Expand All @@ -59,4 +41,4 @@ jobs:
token: ${{ secrets.CI_BOT_TOKEN }}
repository: kubeshop/helm-charts
event-type: trigger-workflow-operator
client-payload: '{"image_tag_operator": "sha-${{ steps.github_sha.outputs.sha_short }}"}'
client-payload: '{"image_tag_operator": "${{ steps.github_sha.outputs.sha_short }}"}'
47 changes: 11 additions & 36 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Docker images building and pushing
name: Docker images building and pushing with GoReleaser
on:
push:
tags:
Expand All @@ -11,48 +11,23 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Docker meta for Testkube operator
id: meta_testkube_operator
uses: docker/metadata-action@v3
with:
images: kubeshop/testkube-operator
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Build
uses: docker/bake-action@v1
with:
files: |
docker-bake.hcl
${{ steps.meta_testkube_operator.outputs.bake-file }}
targets: build
push: true

- name: Docker meta for Testkube certificate
id: meta_testkube_certificate
uses: docker/metadata-action@v3
- name: Release
uses: goreleaser/goreleaser-action@v4
with:
images: kubeshop/testkube-certificate
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
distribution: goreleaser
version: latest
args: release -f .goreleaser.yml
env:
GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
23 changes: 23 additions & 0 deletions .goreleaser-stage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
project_name: testkube-operator
builds:
- id: "linux"
env: [CGO_ENABLED=0]
goos:
- linux
goarch:
- amd64
mod_timestamp: "{{ .CommitTimestamp }}"
dockers:
- dockerfile: Dockerfile
use: buildx
goos: linux
goarch: amd64
image_templates:
- "kubeshop/testkube-operator:{{ .ShortCommit }}"
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"


56 changes: 56 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
project_name: testkube-operator
builds:
- id: "linux"
env: [CGO_ENABLED=0]
goos:
- linux
goarch:
- amd64
- arm64
mod_timestamp: "{{ .CommitTimestamp }}"
dockers:
- dockerfile: Dockerfile
use: buildx
goos: linux
goarch: amd64
image_templates:
- "kubeshop/testkube-operator:{{ .ShortCommit }}-amd64"
- "kubeshop/testkube-operator:{{ .Version }}-amd64"
- "kubeshop/testkube-operator:latest-amd64"
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"

- dockerfile: Dockerfile
use: buildx
goos: linux
goarch: arm64
image_templates:
- "kubeshop/testkube-operator:{{ .ShortCommit }}-arm64v8"
- "kubeshop/testkube-operator:{{ .Version }}-arm64v8"
- "kubeshop/testkube-operator:latest-arm64v8"
build_flag_templates:
- "--platform=linux/arm64/v8"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"

docker_manifests:
- name_template: kubeshop/testkube-operator:{{ .ShortCommit }}
image_templates:
- kubeshop/testkube-operator:{{ .ShortCommit }}-amd64
- kubeshop/testkube-operator:{{ .ShortCommit }}-arm64v8
- name_template: kubeshop/testkube-operator:{{ .Version }}
image_templates:
- kubeshop/testkube-operator:{{ .Version }}-amd64
- kubeshop/testkube-operator:{{ .Version }}-arm64v8
- name_template: kubeshop/testkube-operator:latest
image_templates:
- kubeshop/testkube-operator:latest-amd64
- kubeshop/testkube-operator:latest-arm64v8


34 changes: 2 additions & 32 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,3 @@
# Build the manager binary
FROM --platform=$BUILDPLATFORM golang:1.18 as builder

ENV CGO_ENABLED=0
ENV GOOS=linux

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download

# Copy the go source
COPY main.go main.go
COPY apis/ apis/
COPY controllers/ controllers/
COPY pkg/ pkg/
COPY utils/ utils/

ARG TARGETOS TARGETARCH
# Build
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -a -o manager main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY --from=builder /workspace/manager .
USER 65532:65532

FROM alpine
COPY testkube-operator /manager
ENTRYPOINT ["/manager"]
12 changes: 0 additions & 12 deletions docker-bake.hcl

This file was deleted.

0 comments on commit 828e71b

Please sign in to comment.