Skip to content

feat: [TKC-2581] add testworkflow / template cloud client #307

feat: [TKC-2581] add testworkflow / template cloud client

feat: [TKC-2581] add testworkflow / template cloud client #307

Workflow file for this run

name: Build Sandbox image
on:
push:
branches:
- sandbox/**
paths-ignore:
- 'docs/**'
pull_request:
types:
- opened
env:
ALPINE_IMAGE: alpine:3.20.0
BUSYBOX_IMAGE: busybox:1.36.1-musl
jobs:
api:
if: startsWith(github.ref, 'refs/heads/sandbox/')
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: testkube-api-go-${{ hashFiles('**/go.sum') }}
- 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@v6
with:
distribution: goreleaser
version: latest
args: release -f goreleaser_files/.goreleaser-docker-build-api.yml --snapshot
env:
GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
ANALYTICS_TRACKING_ID: ${{secrets.TESTKUBE_API_GA_MEASUREMENT_ID}}
ANALYTICS_API_KEY: ${{secrets.TESTKUBE_API_GA_MEASUREMENT_SECRET}}
SLACK_BOT_CLIENT_ID: ${{secrets.TESTKUBE_SLACK_BOT_CLIENT_ID}}
SLACK_BOT_CLIENT_SECRET: ${{secrets.TESTKUBE_SLACK_BOT_CLIENT_SECRET}}
SEGMENTIO_KEY: ${{secrets.TESTKUBE_API_SEGMENTIO_KEY}}
CLOUD_SEGMENTIO_KEY: ${{secrets.TESTKUBE_API_CLOUD_SEGMENTIO_KEY}}
DOCKER_BUILDX_BUILDER: "${{ steps.buildx.outputs.name }}"
DOCKER_BUILDX_CACHE_FROM: "type=gha"
DOCKER_BUILDX_CACHE_TO: "type=gha,mode=max"
ALPINE_IMAGE: ${{ env.ALPINE_IMAGE }}
BUSYBOX_IMAGE: ${{ env.BUSYBOX_IMAGE }}
BRANCH_IDENTIFIER: ${{ env.branch_identifier }}
IMAGE_TAG_SHA: true
SANDBOX_IMAGE: true
- name: Push Docker images
run: |
docker push kubeshop/testkube-sandbox:api-server-${{ env.branch_identifier }}-${{ steps.commit.outputs.short }}
testworkflow:
if: startsWith(github.ref, 'refs/heads/sandbox/')
strategy:
matrix:
service: [testworkflow-init, testworkflow-toolkit]
include:
- service: testworkflow-init
repository: testkube-tw-init
- service: testworkflow-toolkit
repository: testkube-tw-toolkit
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: ${{ matrix.service }}-go-${{ hashFiles('**/go.sum') }}
- 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@v6
with:
distribution: goreleaser
version: latest
args: release -f goreleaser_files/.goreleaser-docker-build-${{ matrix.service }}.yml --snapshot
env:
GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
ANALYTICS_TRACKING_ID: ${{secrets.TESTKUBE_API_GA_MEASUREMENT_ID}}
ANALYTICS_API_KEY: ${{secrets.TESTKUBE_API_GA_MEASUREMENT_SECRET}}
SLACK_BOT_CLIENT_ID: ${{secrets.TESTKUBE_SLACK_BOT_CLIENT_ID}}
SLACK_BOT_CLIENT_SECRET: ${{secrets.TESTKUBE_SLACK_BOT_CLIENT_SECRET}}
SEGMENTIO_KEY: ${{secrets.TESTKUBE_API_SEGMENTIO_KEY}}
CLOUD_SEGMENTIO_KEY: ${{secrets.TESTKUBE_API_CLOUD_SEGMENTIO_KEY}}
DOCKER_BUILDX_BUILDER: "${{ steps.buildx.outputs.name }}"
DOCKER_BUILDX_CACHE_FROM: "type=gha"
DOCKER_BUILDX_CACHE_TO: "type=gha,mode=max"
ALPINE_IMAGE: ${{ env.ALPINE_IMAGE }}
BUSYBOX_IMAGE: ${{ env.BUSYBOX_IMAGE }}
BRANCH_IDENTIFIER: ${{ env.branch_identifier }}
IMAGE_TAG_SHA: true
SANDBOX_IMAGE: true
SERVICE: ${{ matrix.service }}
REPOSITORY: ${{ matrix.repository }}
- name: Push Docker images
run: |
docker push kubeshop/testkube-sandbox:${{ matrix.service }}-${{ env.branch_identifier }}-${{ steps.commit.outputs.short }}
single_executor:
if: startsWith(github.ref, 'refs/heads/sandbox/')
strategy:
matrix:
executor: [artillery, curl, example, ginkgo, k6, kubepug, postman, soapui, init, scraper, template, tracetest, zap ]
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: ${{ matrix.executor }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- 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: Release
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release -f goreleaser_files/.goreleaser-docker-build-executor.yml --snapshot
env:
GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
EXECUTOR: ${{ matrix.executor }}
DOCKER_BUILDX_BUILDER: "${{ steps.buildx.outputs.name }}"
DOCKER_BUILDX_CACHE_FROM: "type=gha"
DOCKER_BUILDX_CACHE_TO: "type=gha,mode=max"
ALPINE_IMAGE: ${{ env.ALPINE_IMAGE }}
BUSYBOX_IMAGE: ${{ env.BUSYBOX_IMAGE }}
IMAGE_TAG_SHA: true
SANDBOX_IMAGE: true
BRANCH_IDENTIFIER: ${{ env.branch_identifier }}
- name: Push Docker images
run: |
docker push kubeshop/testkube-sandbox:${{ matrix.executor }}-executor-${{ env.branch_identifier }}-${{ steps.commit.outputs.short }}
executor_jmeter:
if: startsWith(github.ref, 'refs/heads/sandbox/')
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: jmeter-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@v6
with:
distribution: goreleaser
version: latest
args: release -f goreleaser_files/.goreleaser-docker-build-executor-jmeter.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:jmeter-executor-${{ env.branch_identifier }}-${{ steps.commit.outputs.short }}
executor_jmeterd:
if: startsWith(github.ref, 'refs/heads/sandbox/')
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@v6
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-executor-${{ env.branch_identifier }}-${{ steps.commit.outputs.short }}
jmeterd_slave:
if: startsWith(github.ref, 'refs/heads/sandbox/')
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@v6
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:
if: startsWith(github.ref, 'refs/heads/sandbox/')
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@v6
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-executor-${{ env.branch_identifier }}-${{ steps.commit.outputs.short }}
executor_gradle:
if: startsWith(github.ref, 'refs/heads/sandbox/')
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: gradle-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@v6
with:
distribution: goreleaser
version: latest
args: release -f goreleaser_files/.goreleaser-docker-build-executor-gradle.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:gradle-executor-${{ env.branch_identifier }}-${{ steps.commit.outputs.short }}
executor_cypress:
if: startsWith(github.ref, 'refs/heads/sandbox/')
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: cypress-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@v6
with:
distribution: goreleaser
version: latest
args: release -f goreleaser_files/.goreleaser-docker-build-executor-cypress.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 image to the Registry
run: |
docker push kubeshop/testkube-sandbox:cypress-executor-${{ env.branch_identifier }}-${{ steps.commit.outputs.short }}
executor_playwright:
if: startsWith(github.ref, 'refs/heads/sandbox/')
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: playwright-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@v6
with:
distribution: goreleaser
version: latest
args: release -f goreleaser_files/.goreleaser-docker-build-executor-playwright.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 image to the Registry
run: |
docker push kubeshop/testkube-sandbox:playwright-executor-${{ env.branch_identifier }}-${{ steps.commit.outputs.short }}
executor_postman_node21:
if: startsWith(github.ref, 'refs/heads/sandbox/')
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: ${{ env.GO_VERSION }}
cache: false
- name: Go Cache
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: postman-node-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@v6
with:
distribution: goreleaser
version: latest
args: release -f goreleaser_files/.goreleaser-docker-build-executor-postman-node21.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 image to the Registry
run: |
docker push kubeshop/testkube-sandbox:postman-node21-executor-${{ env.branch_identifier }}-${{ steps.commit.outputs.short }}
log_server_sidecar:
if: startsWith(github.ref, 'refs/heads/sandbox/')
strategy:
matrix:
service: [ logs-server, logs-sidecar ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- 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
- name: Go Cache
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ matrix.service }}-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: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release -f ./goreleaser_files/.goreleaser-docker-build-logs-services.yml --snapshot
env:
GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
DOCKER_BUILDX_BUILDER: "${{ steps.buildx.outputs.name }}"
DOCKER_BUILDX_CACHE_FROM: "type=gha"
DOCKER_BUILDX_CACHE_TO: "type=gha,mode=max"
ALPINE_IMAGE: ${{ env.ALPINE_IMAGE }}
BUSYBOX_IMAGE: ${{ env.BUSYBOX_IMAGE }}
SERVICE: ${{ matrix.service }}
IMAGE_TAG_SHA: true
SANDBOX_IMAGE: true
BRANCH_IDENTIFIER: ${{ env.branch_identifier }}
- name: Push Docker images
run: |
docker push kubeshop/testkube-sandbox:${{ matrix.service }}-${{ env.branch_identifier }}-${{ steps.commit.outputs.short }}
dispatch:
if: startsWith(github.ref, 'refs/heads/sandbox/')
needs:
[
api,
single_executor,
executor_jmeter,
executor_maven,
executor_gradle,
executor_cypress,
executor_playwright,
log_server_sidecar,
testworkflow
]
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Repository dispatch
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ steps.app-token.outputs.token }}
repository: kubeshop/testkube-deployment
event-type: sandbox_image_update
client-payload: '{"ref_name": "${{ github.ref_name }}"}'
- 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: Output summary
run: |
echo -e "### Sandbox Environment" >> $GITHUB_STEP_SUMMARY
echo -e '```' >> $GITHUB_STEP_SUMMARY
echo -e "## URLs" >> $GITHUB_STEP_SUMMARY
echo "- Dashboard: https://dashboard.${{ env.branch_identifier }}.testkube.dev" >> $GITHUB_STEP_SUMMARY
echo "- API: https://api.${{ env.branch_identifier }}.testkube.dev" >> $GITHUB_STEP_SUMMARY
echo "- Agent: https://agent.${{ env.branch_identifier }}.testkube.dev" >> $GITHUB_STEP_SUMMARY
echo "- Storage: https://storage.${{ env.branch_identifier }}.testkube.dev" >> $GITHUB_STEP_SUMMARY
echo "- Websockets: https://websockets.${{ env.branch_identifier }}.testkube.dev" >> $GITHUB_STEP_SUMMARY
echo -e '```' >> $GITHUB_STEP_SUMMARY
pr_creation:
runs-on: ubuntu-latest
steps:
- name: Checkout
if: startsWith(github.event.pull_request.head.ref, 'sandbox/')
uses: actions/checkout@v4
- name: Get a branch name if PR is created
if: startsWith(github.event.pull_request.head.ref, 'sandbox/')
run: |
# get a branch name
branch_ref="${{ github.event.pull_request.head.ref }}"
#remove slash
branch_ref="${branch_ref#*/}"
#create env var
echo "branch_ref=$branch_ref" >> $GITHUB_ENV
- name: Render template
if: startsWith(github.event.pull_request.head.ref, 'sandbox/')
id: template
uses: chuhlomin/[email protected]
with:
template: .github/sandbox-comment-template.md
vars: |
branch_ref: ${{ env.branch_ref }}
- name: Create comment on a PR with the endpoints
if: startsWith(github.event.pull_request.head.ref, 'sandbox/')
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.CI_BOT_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.template.outputs.result }}