diff --git a/.github/workflows/sandbox.yaml b/.github/workflows/sandbox.yaml index 50febe51007..284346413a4 100644 --- a/.github/workflows/sandbox.yaml +++ b/.github/workflows/sandbox.yaml @@ -288,167 +288,175 @@ jobs: - name: Push Docker images run: | docker push kubeshop/testkube-sandbox:jmeter-${{ env.branch_identifier }}-${{ steps.commit.outputs.short }} - # -# executor_jmeterd: -# runs-on: ubuntu-latest -# steps: -# - name: Free Disk Space (Ubuntu) -# uses: jlumbroso/free-disk-space@main -# with: -# # this might remove tools that are actually needed, -# # if set to "true" but frees about 6 GB -# tool-cache: false -# -# - name: Checkout -# uses: actions/checkout@v4 -# -# - name: Set up Docker Buildx -# id: buildx -# uses: docker/setup-buildx-action@v3 -# -# - name: Set-up Go -# uses: actions/setup-go@v5 -# with: -# go-version: stable -# cache: false -# -# - name: Go Cache -# uses: actions/cache@v4 -# with: -# path: | -# ~/go/pkg/mod -# ~/.cache/go-build -# key: jmeterd-go-${{ hashFiles('**/go.sum') }} -# restore-keys: | -# ${{ runner.os }}-go- -# -# - name: Login to DockerHub -# uses: docker/login-action@v3 -# with: -# username: ${{ secrets.DOCKERHUB_USERNAME }} -# password: ${{ secrets.DOCKERHUB_TOKEN }} -# -# - id: commit -# uses: prompt/actions-commit-hash@v3 -# -# - name: Release -# uses: goreleaser/goreleaser-action@v5 -# with: -# distribution: goreleaser -# version: latest -# args: release -f goreleaser_files/.goreleaser-docker-build-executor-jmeterd.yml --clean --snapshot -# env: -# GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }} -# DOCKER_BUILDX_BUILDER: "${{ steps.buildx.outputs.name }}" -# DOCKER_BUILDX_CACHE_FROM: "type=gha" -# DOCKER_BUILDX_CACHE_TO: "type=gha,mode=max" -# IMAGE_TAG_SHA: true -# -# - name: Push Docker images -# run: | -# docker push kubeshop/testkube-jmeterd-executor:${{ steps.commit.outputs.short }} -# -# jmeterd_slave: -# runs-on: ubuntu-latest -# steps: -# - name: Free Disk Space (Ubuntu) -# uses: jlumbroso/free-disk-space@main -# with: -# # this might remove tools that are actually needed, -# # if set to "true" but frees about 6 GB -# tool-cache: false -# -# - name: Checkout -# uses: actions/checkout@v4 -# -# - name: Set up Docker Buildx -# id: buildx -# uses: docker/setup-buildx-action@v3 -# -# - name: Docker Cache -# uses: actions/cache@v4 -# with: -# path: /tmp/.buildx-cache -# key: ${{ runner.os }}-buildx-${{ github.sha }} -# restore-keys: | -# ${{ runner.os }}-buildx- -# -# - id: commit -# uses: prompt/actions-commit-hash@v3 -# -# - name: Login to DockerHub -# uses: docker/login-action@v3 -# with: -# username: ${{ secrets.DOCKERHUB_USERNAME }} -# password: ${{ secrets.DOCKERHUB_TOKEN }} -# -# - name: Build and push -# uses: docker/build-push-action@v5 -# with: -# context: . -# file: ./contrib/executor/jmeterd/build/slaves/Dockerfile -# push: true -# tags: kubeshop/testkube-jmeterd-slave:${{ steps.commit.outputs.short }} -# platforms: linux/amd64,linux/arm64 -# -# executor_maven: -# runs-on: ubuntu-latest -# steps: -# - name: Free Disk Space (Ubuntu) -# uses: jlumbroso/free-disk-space@main -# with: -# # this might remove tools that are actually needed, -# # if set to "true" but frees about 6 GB -# tool-cache: false -# -# - name: Checkout -# uses: actions/checkout@v4 -# -# - name: Set up Docker Buildx -# id: buildx -# uses: docker/setup-buildx-action@v3 -# -# - name: Set-up Go -# uses: actions/setup-go@v5 -# with: -# go-version: stable -# cache: false -# -# - name: Go Cache -# uses: actions/cache@v4 -# with: -# path: | -# ~/go/pkg/mod -# ~/.cache/go-build -# key: maven-go-${{ hashFiles('**/go.sum') }} -# restore-keys: | -# ${{ runner.os }}-go- -# -# - name: Login to DockerHub -# uses: docker/login-action@v3 -# with: -# username: ${{ secrets.DOCKERHUB_USERNAME }} -# password: ${{ secrets.DOCKERHUB_TOKEN }} -# -# - id: commit -# uses: prompt/actions-commit-hash@v3 -# -# - name: Release -# uses: goreleaser/goreleaser-action@v5 -# with: -# distribution: goreleaser -# version: latest -# args: release -f goreleaser_files/.goreleaser-docker-build-executor-maven.yml --snapshot -# env: -# GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }} -# DOCKER_BUILDX_BUILDER: "${{ steps.buildx.outputs.name }}" -# DOCKER_BUILDX_CACHE_FROM: "type=gha" -# DOCKER_BUILDX_CACHE_TO: "type=gha,mode=max" -# IMAGE_TAG_SHA: true -# -# - name: Push Docker images -# run: | -# docker push kubeshop/testkube-maven-executor:${{ steps.commit.outputs.short }} + + executor_jmeterd: + runs-on: ubuntu-latest + steps: + + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + + - name: Set-up Go + uses: actions/setup-go@v5 + with: + go-version: stable + cache: false + + - name: Go Cache + uses: actions/cache@v4 + with: + path: | + ~/go/pkg/mod + ~/.cache/go-build + key: jmeterd-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - id: commit + uses: prompt/actions-commit-hash@v3 + + - name: Get branch name + run: | + # Extract everything after the first slash + branch_identifier=$(echo "$GITHUB_REF_NAME" | cut -d'/' -f2-) + + # Replace slashes with dashes using sed + echo branch_identifier=$(echo "$branch_identifier" | sed 's/\//-/g') >> $GITHUB_ENV + + - name: Release + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: latest + args: release -f goreleaser_files/.goreleaser-docker-build-executor-jmeterd.yml --snapshot + env: + GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }} + DOCKER_BUILDX_BUILDER: "${{ steps.buildx.outputs.name }}" + DOCKER_BUILDX_CACHE_FROM: "type=gha" + DOCKER_BUILDX_CACHE_TO: "type=gha,mode=max" + IMAGE_TAG_SHA: true + SANDBOX_IMAGE: true + BRANCH_IDENTIFIER: ${{ env.branch_identifier }} + + - name: Push Docker images + run: | + docker push kubeshop/testkube-sandbox:jmeterd-${{ env.branch_identifier }}-${{ steps.commit.outputs.short }} + + jmeterd_slave: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker Cache + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - id: commit + uses: prompt/actions-commit-hash@v3 + + - name: Get branch name + run: | + # Extract everything after the first slash + branch_identifier=$(echo "$GITHUB_REF_NAME" | cut -d'/' -f2-) + + # Replace slashes with dashes using sed + echo branch_identifier=$(echo "$branch_identifier" | sed 's/\//-/g') >> $GITHUB_ENV + + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: ./contrib/executor/jmeterd/build/slaves/Dockerfile + push: true + tags: kubeshop/testkube-sanbox:jmeterd-slave-${{ env.branch_identifier }}-${{ steps.commit.outputs.short }} + platforms: linux/amd64,linux/arm64 + + executor_maven: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + + - name: Set-up Go + uses: actions/setup-go@v5 + with: + go-version: stable + cache: false + + - name: Go Cache + uses: actions/cache@v4 + with: + path: | + ~/go/pkg/mod + ~/.cache/go-build + key: maven-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - id: commit + uses: prompt/actions-commit-hash@v3 + + - name: Get branch name + run: | + # Extract everything after the first slash + branch_identifier=$(echo "$GITHUB_REF_NAME" | cut -d'/' -f2-) + + # Replace slashes with dashes using sed + echo branch_identifier=$(echo "$branch_identifier" | sed 's/\//-/g') >> $GITHUB_ENV + + - name: Release + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: latest + args: release -f goreleaser_files/.goreleaser-docker-build-executor-maven.yml --snapshot + env: + GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }} + DOCKER_BUILDX_BUILDER: "${{ steps.buildx.outputs.name }}" + DOCKER_BUILDX_CACHE_FROM: "type=gha" + DOCKER_BUILDX_CACHE_TO: "type=gha,mode=max" + IMAGE_TAG_SHA: true + SANDBOX_IMAGE: true + BRANCH_IDENTIFIER: ${{ env.branch_identifier }} + + - name: Push Docker images + run: | + docker push kubeshop/testkube-sandbox:maven-${{ env.branch_identifier }}-${{ steps.commit.outputs.short }} # # executor_gradle: # runs-on: ubuntu-latest @@ -705,8 +713,6 @@ jobs: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Set up QEMU uses: docker/setup-qemu-action@v3 diff --git a/goreleaser_files/.goreleaser-docker-build-executor-jmeterd.yml b/goreleaser_files/.goreleaser-docker-build-executor-jmeterd.yml index bdbbb20eb90..f1ffb6b2545 100644 --- a/goreleaser_files/.goreleaser-docker-build-executor-jmeterd.yml +++ b/goreleaser_files/.goreleaser-docker-build-executor-jmeterd.yml @@ -12,6 +12,8 @@ env: - DOCKER_BUILDX_CACHE_TO={{ if index .Env "DOCKER_BUILDX_CACHE_TO" }}{{ .Env.DOCKER_BUILDX_CACHE_TO }}{{ else }}type=inline{{ end }} # Build image with commit sha tag - IMAGE_TAG_SHA={{ if index .Env "IMAGE_TAG_SHA" }}{{ .Env.IMAGE_TAG_SHA }}{{ else }}{{ end }} + - DOCKER_IMAGE_TITLE={{ if index .Env "SANDBOX_IMAGE" }}testkube-sandbox{{ else }}testkube-jmeterd{{ end }} + - DOCKER_IMAGE_URL={{ if index .Env "SANDBOX_IMAGE" }}https://hub.docker.com/r/kubeshop/testkube-sandbox{{ else }}https://hub.docker.com/r/kubeshop/testkube-jmeterd-executor{{ end }} builds: - id: "linux" main: "./contrib/executor/jmeterd/cmd/agent" @@ -32,8 +34,11 @@ dockers: image_templates: - "{{ if .Env.IMAGE_TAG_SHA }}{{ .Env.DOCKER_REPO }}/testkube-jmeterd-executor:{{ .ShortCommit }}{{ end }}" - "{{ if not .Env.IMAGE_TAG_SHA }}{{ .Env.DOCKER_REPO }}/testkube-jmeterd-executor:{{ .Version }}-amd64{{ end }}" + - "{{ if .Env.SANDBOX_IMAGE }}{{ .Env.DOCKER_REPO }}/testkube-sandbox:jmeterd-{{ .Env.BRANCH_IDENTIFIER }}-{{ .ShortCommit }}{{ end }}" build_flag_templates: - "--platform=linux/amd64" + - "--label=org.opencontainers.image.title={{ .Env.DOCKER_IMAGE_TITLE }}" + - "--label=org.opencontainers.image.url={{ .Env.DOCKER_IMAGE_URL }}" - "--label=org.opencontainers.image.title={{ .ProjectName }}" - "--label=org.opencontainers.image.created={{ .Date}}" - "--label=org.opencontainers.image.revision={{ .FullCommit }}" diff --git a/goreleaser_files/.goreleaser-docker-build-executor-maven.yml b/goreleaser_files/.goreleaser-docker-build-executor-maven.yml index e8b2c3c1f8c..2a83c5710f1 100644 --- a/goreleaser_files/.goreleaser-docker-build-executor-maven.yml +++ b/goreleaser_files/.goreleaser-docker-build-executor-maven.yml @@ -11,6 +11,9 @@ env: - DOCKER_BUILDX_CACHE_FROM={{ if index .Env "DOCKER_BUILDX_CACHE_FROM" }}{{ .Env.DOCKER_BUILDX_CACHE_FROM }}{{ else }}type=registry{{ end }} - DOCKER_BUILDX_CACHE_TO={{ if index .Env "DOCKER_BUILDX_CACHE_TO" }}{{ .Env.DOCKER_BUILDX_CACHE_TO }}{{ else }}type=inline{{ end }} - IMAGE_TAG_SHA={{ if index .Env "IMAGE_TAG_SHA" }}{{ .Env.IMAGE_TAG_SHA }}{{ else }}{{ end }} + - DOCKER_IMAGE_TITLE={{ if index .Env "SANDBOX_IMAGE" }}testkube-sandbox{{ else }}testkube-maven{{ end }} + - DOCKER_IMAGE_URL={{ if index .Env "SANDBOX_IMAGE" }}https://hub.docker.com/r/kubeshop/testkube-sandbox{{ else }}https://hub.docker.com/r/kubeshop/testkube-maven-executor{{ end }} + builds: - id: "linux" @@ -122,9 +125,12 @@ dockers: image_templates: - "{{ if not .Env.IMAGE_TAG_SHA }}{{ .Env.DOCKER_REPO }}/testkube-maven-executor:{{ .Version }}-jdk18-amd64{{ end }}" - "{{ if .Env.IMAGE_TAG_SHA }}{{ .Env.DOCKER_REPO }}/testkube-maven-executor:{{ .ShortCommit }}{{ end }}" + - "{{ if .Env.SANDBOX_IMAGE }}{{ .Env.DOCKER_REPO }}/testkube-sandbox:maven-{{ .Env.BRANCH_IDENTIFIER }}-{{ .ShortCommit }}{{ end }}" + build_flag_templates: - "--platform=linux/amd64" - - "--label=org.opencontainers.image.title={{ .ProjectName }}" + - "--label=org.opencontainers.image.title={{ .Env.DOCKER_IMAGE_TITLE }}" + - "--label=org.opencontainers.image.url={{ .Env.DOCKER_IMAGE_URL }}" - "--label=org.opencontainers.image.created={{ .Date}}" - "--label=org.opencontainers.image.revision={{ .FullCommit }}" - "--builder={{ .Env.DOCKER_BUILDX_BUILDER }}"