Skip to content

Commit

Permalink
ci: jmeterd executor and slave (#4371)
Browse files Browse the repository at this point in the history
* add jmeterd ci
  • Loading branch information
ypoplavs authored Sep 15, 2023
1 parent 4be8ad2 commit be3eb0c
Show file tree
Hide file tree
Showing 7 changed files with 404 additions and 5 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/docker-build-api-executors-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,98 @@ jobs:
DOCKER_BUILDX_CACHE_FROM: "type=gha"
DOCKER_BUILDX_CACHE_TO: "type=gha,mode=max"

executor_jmeterd:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v2

- uses: sigstore/[email protected]
- uses: anchore/sbom-action/[email protected]

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

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

- name: Go Cache
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Push README to Dockerhub
uses: christian-korneck/update-container-description-action@v1
env:
DOCKER_USER: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PASS: ${{ secrets.DOCKERHUB_TOKEN }}
with:
destination_container_repo: "kubeshop/testkube-jmeterd-executor"
provider: dockerhub
short_description: 'Testkube jmeterd executor'
readme_file: "./contrib/executor/jmeterd/README.md"

- name: Release
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release -f goreleaser_files/.goreleaser-docker-build-executor-jmeterd.yml
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"

jmeterd_slave:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

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

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

- name: Docker Cache
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v1
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:${{ github.event.release.tag_name }},kubeshop/testkube-jmeterd-slave:latest
platforms: linux/amd64,linux/arm64

executor_maven:
runs-on: ubuntu-latest
steps:
Expand Down
89 changes: 88 additions & 1 deletion .github/workflows/docker-build-develop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,93 @@ jobs:
run: |
docker push kubeshop/testkube-jmeter-executor:${{ steps.github_sha.outputs.sha_short }}
executor_jmeterd:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v2

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

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

- name: Go Cache
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- id: commit
uses: prompt/actions-commit-hash@v3

- name: Release
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release -f goreleaser_files/.goreleaser-docker-build-executor-jmeterd-commit-only.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"

- name: Push Docker images
run: |
docker push kubeshop/testkube-jmeterd-executor:${{ steps.commit.outputs.short }}
jmeterd_slave:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

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

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

- name: Docker Cache
uses: actions/cache@v2
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@v1
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 }}

executor_maven:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -367,7 +454,7 @@ jobs:
docker push kubeshop/testkube-playwright-executor:${{ steps.github_sha.outputs.sha_short }}
workflow_dispatch:
needs: [api, single_executor, executor_jmeter, executor_maven, executor_gradle, executor_cypress, executor_playwright]
needs: [api, single_executor, executor_jmeter, executor_jmeterd, jmeterd_slave, executor_maven, executor_gradle, executor_cypress, executor_playwright]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
90 changes: 88 additions & 2 deletions .github/workflows/docker-build-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ jobs:
run: |
docker push kubeshop/testkube-jmeter-executor:${{ steps.github_sha.outputs.sha_short }}
executor_maven:
executor_jmeterd:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -199,6 +199,92 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- id: commit
uses: prompt/actions-commit-hash@v3

- name: Release
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release -f goreleaser_files/.goreleaser-docker-build-executor-jmeterd-commit-only.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"

- name: Push Docker images
run: |
docker push kubeshop/testkube-jmeterd-executor:${{ steps.commit.outputs.short }}
jmeterd_slave:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

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

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

- name: Docker Cache
uses: actions/cache@v2
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@v1
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 }}

executor_maven:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

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

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

- name: Go Cache
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Get commit sha
id: github_sha
run: echo "::set-output name=sha_short::${GITHUB_SHA::7}"
Expand Down Expand Up @@ -367,7 +453,7 @@ jobs:
docker push kubeshop/testkube-playwright-executor:${{ steps.github_sha.outputs.sha_short }}
workflow_dispatch:
needs: [ api, single_executor, executor_jmeter, executor_maven, executor_gradle, executor_cypress, executor_playwright ]
needs: [ api, single_executor, executor_jmeter, executor_jmeterd, jmeterd_slave, executor_maven, executor_gradle, executor_cypress, executor_playwright ]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion contrib/executor/jmeterd/build/agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ RUN microdnf update -y && microdnf install -y ca-certificates git && microdnf cl
ENV ENTRYPOINT_CMD="/executor_entrypoint.sh"
WORKDIR /root/
COPY ./contrib/executor/jmeterd/scripts/entrypoint.sh /executor_entrypoint.sh
COPY scripts/jmeter-master.sh /executor_entrypoint_master.sh
COPY ./contrib/executor/jmeterd/scripts/jmeter-master.sh /executor_entrypoint_master.sh

ENTRYPOINT ["/bin/runner"]
2 changes: 1 addition & 1 deletion contrib/executor/jmeterd/build/slaves/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ FROM kubeshop/jmeter:5.5
EXPOSE 1099 60001
ENV SSL_DISABLED true

COPY ./scripts/jmeter-slaves.sh /jmeter_slaves_entrypoint.sh
COPY ./contrib/executor/jmeterd/scripts/jmeter-slaves.sh /jmeter_slaves_entrypoint.sh
RUN chmod +x /jmeter_slaves_entrypoint.sh
ENTRYPOINT /jmeter_slaves_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
env:
# Goreleaser always uses the docker buildx builder with name "default"; see
# https://github.com/goreleaser/goreleaser/pull/3199
# To use a builder other than "default", set this variable.
# Necessary for, e.g., GitHub actions cache integration.
- DOCKER_BUILDX_BUILDER={{ if index .Env "DOCKER_BUILDX_BUILDER" }}{{ .Env.DOCKER_BUILDX_BUILDER }}{{ else }}default{{ end }}
# Setup to enable Docker to use, e.g., the GitHub actions cache; see
# https://docs.docker.com/build/building/cache/backends/
# https://github.com/moby/buildkit#export-cache
- 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 }}

builds:
- id: "linux"
main: "./contrib/executor/jmeterd/cmd/agent"
binary: "jmeterd"
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
- arm64
mod_timestamp: "{{ .CommitTimestamp }}"
dockers:
- dockerfile: "./contrib/executor/jmeterd/build/agent/Dockerfile"
use: buildx
goos: linux
goarch: amd64
image_templates:
- "kubeshop/testkube-jmeterd-executor:{{ .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 }}"
- "--label=org.opencontainers.image.version={{ .Version }}"
- "--builder={{ .Env.DOCKER_BUILDX_BUILDER }}"
- "--cache-to={{ .Env.DOCKER_BUILDX_CACHE_TO }}"
- "--cache-from={{ .Env.DOCKER_BUILDX_CACHE_FROM }}"
extra_files:
- ./contrib/executor/jmeterd/scripts/entrypoint.sh
- ./contrib/executor/jmeterd/scripts/jmeter-master.sh


release:
disable: true

snapshot:
name_template: '{{ .ShortCommit }}'
Loading

0 comments on commit be3eb0c

Please sign in to comment.