Skip to content
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
16 changes: 14 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,26 @@ on:
branches:
- main
paths:
- 'e2e/images/**'
- 'Makefile'
- "e2e/images/**"
- "Makefile"

jobs:
validate:
name: Build
runs-on: ubuntu-latest
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
build-mount-path: /var/lib/docker/
remove-dotnet: "true"
remove-android: "true"
remove-haskell: "true"
remove-codeql: "true"
remove-docker-images: "true"
- name: Restart docker
run: sudo service docker restart

- name: Check out code
uses: actions/checkout@v1
with:
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ jobs:
name: Validate
runs-on: ubuntu-latest
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
build-mount-path: /var/lib/docker/
remove-dotnet: "true"
remove-android: "true"
remove-haskell: "true"
remove-codeql: "true"
remove-docker-images: "true"
- name: Restart docker
run: sudo service docker restart

- name: Check out code
uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion e2e/images/apache-ab/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=${BUILDPLATFORM} alpine
FROM alpine

ENV TERM linux
RUN apk --no-cache add apache2-utils
Expand Down
2 changes: 1 addition & 1 deletion e2e/images/artemis/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22 as build-env
FROM golang:1.25-alpine as build-env

WORKDIR /go/src/app
ADD cmd/ /go/src/app
Expand Down
2 changes: 1 addition & 1 deletion e2e/images/azure-eventhub-dapr/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18 as build-env
FROM golang:1.25-alpine as build-env

WORKDIR /go/src/app
ADD cmd/ /go/src/app
Expand Down
2 changes: 1 addition & 1 deletion e2e/images/azure-eventhub-golang/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.24 as build-env
FROM golang:1.25-alpine as build-env

WORKDIR /go/src/app
ADD cmd/ /go/src/app
Expand Down
2 changes: 1 addition & 1 deletion e2e/images/bound-service-account-token/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.23 as builder
FROM golang:1.25-alpine as builder

WORKDIR /workspace

Expand Down
24 changes: 20 additions & 4 deletions e2e/images/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,27 @@ set -euo pipefail

# not all images can be built as multiarch at the moment
# here is a list of images that must be multiarch for e2e tests to pass
declare -A build_as_multiarch=(
["apache-ab"]=true
["websockets"]=true
build_as_multiarch=(
"apache-ab"
"cloudevents-http"
"mysql"
"nsq"
"prometheus"
"rabbitmq"
"redis-cluster-lists"
"redis-lists"
"redis-sentinel-lists"
"websockets"
)

# Helper function to check if an element is in an array
contains_element () {
local e match="$1"
shift
for e; do [[ "$e" == "$match" ]] && return 0; done
return 1
}

DIR=$(dirname "$0")

if [[ -z "${IMAGE_TAG:-}" ]]; then
Expand All @@ -33,7 +49,7 @@ cd $DIR
if [[ "$PUSH" == true ]]; then
for IMAGE in $(find * -name Dockerfile); do
IMAGE_NAME=$(dirname $IMAGE | tr '/' '-')
if [[ "$PLATFORM" != "" && "${build_as_multiarch[$IMAGE_NAME]:-false}" == true ]]; then
if [[ "$PLATFORM" != "" ]] && contains_element "$IMAGE_NAME" "${build_as_multiarch[@]}"; then
echo "building and pushing $IMAGE_NAME from $IMAGE for $PLATFORM"
image_dir=$(dirname $IMAGE)
docker buildx build --push --platform "$PLATFORM" -t "ghcr.io/kedacore/tests-$IMAGE_NAME" ./$image_dir
Expand Down
20 changes: 9 additions & 11 deletions e2e/images/cloudevents-http/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
FROM golang:1.19 as build-env


# build stage
FROM --platform=$BUILDPLATFORM golang:1.25-alpine AS builder
ARG TARGETARCH
WORKDIR /app
COPY go.mod .
COPY server.go server.go

RUN go mod tidy
RUN go build -o /go/bin/server .
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH go build -o /app/main .

# final stage
FROM gcr.io/distroless/base
COPY --from=build-env /go/bin/server /
WORKDIR /app
COPY --from=builder /app/main /app/main
EXPOSE 8899

ENTRYPOINT ["/server"]
ENTRYPOINT ["/app/main"]
2 changes: 1 addition & 1 deletion e2e/images/external-scaler/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.23 as builder
FROM golang:1.25-alpine as builder

WORKDIR /src

Expand Down
2 changes: 1 addition & 1 deletion e2e/images/hey/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21 as build
FROM golang:1.25 as build

# Create appuser.
ENV USER=appuser
Expand Down
2 changes: 1 addition & 1 deletion e2e/images/ibmmq/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22.2 as build-env
FROM golang:1.25 as build-env

# Create MQ installation
RUN mkdir -p /opt/mqm \
Expand Down
2 changes: 1 addition & 1 deletion e2e/images/metrics-api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.17 as build-env
FROM golang:1.25-alpine as build-env


WORKDIR /app
Expand Down
2 changes: 1 addition & 1 deletion e2e/images/mongodb/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.17 as build-env
FROM golang:1.25-alpine as build-env

WORKDIR /workspace
COPY go.mod go.mod
Expand Down
2 changes: 1 addition & 1 deletion e2e/images/mssql/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.24 as build-env
FROM golang:1.25-alpine as build-env

WORKDIR /go/src/app
COPY go.mod .
Expand Down
20 changes: 10 additions & 10 deletions e2e/images/mysql/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM golang:1.18 as build-env

WORKDIR /go/src/app
COPY go.mod .
COPY cmd/ /go/src/app

RUN go mod tidy
RUN go build -o /go/bin/app
# build stage
FROM --platform=$BUILDPLATFORM golang:1.25-alpine AS builder
ARG TARGETARCH
WORKDIR /app
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH go build -o /app/main ./cmd/main.go

# final stage
FROM gcr.io/distroless/base
COPY --from=build-env /go/bin/app /
CMD ["/app"]
WORKDIR /app
COPY --from=builder /app/main /app/main
ENTRYPOINT ["/app/main"]
11 changes: 10 additions & 1 deletion e2e/images/mysql/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,13 @@ module github.com/tbickford/simple-mysql-processor

go 1.18

require github.com/go-sql-driver/mysql v1.5.0 // indirect
require (
github.com/docker/distribution v2.8.3+incompatible
github.com/go-sql-driver/mysql v1.5.0
)

require (
github.com/gorilla/mux v1.8.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
)
19 changes: 19 additions & 0 deletions e2e/images/mysql/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,21 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2 changes: 1 addition & 1 deletion e2e/images/nats-jetstream/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.23 as build-env
FROM golang:1.25-alpine as build-env

WORKDIR /go/src/app
COPY go.mod .
Expand Down
23 changes: 12 additions & 11 deletions e2e/images/nsq/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM golang:1.22
WORKDIR /cmd

COPY go.mod go.sum ./
RUN go mod download

COPY *.go ./

RUN CGO_ENABLED=0 GOOS=linux go build -o cmd .

ENTRYPOINT ["./cmd"]
# build stage
FROM --platform=$BUILDPLATFORM golang:1.25-alpine AS builder
ARG TARGETARCH
WORKDIR /app
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH go build -o /app/main .

# final stage
FROM gcr.io/distroless/base
WORKDIR /app
COPY --from=builder /app/main /app/main
ENTRYPOINT ["/app/main"]
2 changes: 1 addition & 1 deletion e2e/images/postgresql/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.17 as build-env
FROM golang:1.25-alpine as build-env

WORKDIR /go/src/app
ADD cmd/ /go/src/app
Expand Down
19 changes: 8 additions & 11 deletions e2e/images/prometheus/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
FROM golang:1.19 as builder

WORKDIR /workspace

COPY go.mod go.mod
COPY go.sum go.sum
COPY main.go main.go

RUN go build -o prometheusapp main.go
FROM --platform=$BUILDPLATFORM golang:1.25-alpine AS builder
ARG TARGETARCH
WORKDIR /app
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH go build -o /app/main .

# final stage
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
WORKDIR /
COPY --from=builder /workspace/prometheusapp .
COPY --from=builder /app/main /app/main
# 65532 is numeric for nonroot
USER 65532:65532

ENTRYPOINT ["/prometheusapp"]
ENTRYPOINT ["/app/main"]
27 changes: 20 additions & 7 deletions e2e/images/rabbitmq/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
FROM golang:1.12.1 as builder
# build stage
FROM --platform=$BUILDPLATFORM golang:1.25-alpine AS builder
ARG TARGETARCH
WORKDIR /app

# Copy the code from the host and compile it
WORKDIR $GOPATH/src/github.com/kedacore/sample-go-rabbitmq
# Copy go.mod and go.sum files to leverage Docker cache
COPY go.mod go.sum ./
RUN go mod download

# Copy the rest of the source code
COPY . .

RUN CGO_ENABLED=0 GOOS=linux go install ./...
# Build the binaries for send and receive
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH go build -o /app/send ./cmd/send
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH go build -o /app/receive ./cmd/receive

FROM scratch
COPY --from=builder /go/bin/receive /go/bin/send /usr/local/bin/
CMD ["receive"]
# final stage
FROM alpine:latest
WORKDIR /app
COPY --from=builder /app/send /app/send
COPY --from=builder /app/receive /app/receive

# By default, the image won't do anything.
# The user will specify which binary to run.
CMD ["/app/receive"]
17 changes: 0 additions & 17 deletions e2e/images/rabbitmq/Gopkg.lock

This file was deleted.

30 changes: 0 additions & 30 deletions e2e/images/rabbitmq/Gopkg.toml

This file was deleted.

5 changes: 5 additions & 0 deletions e2e/images/rabbitmq/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/kedacore/test-tools/e2e/images/rabbitmq

go 1.23.4

require github.com/streadway/amqp v1.1.0
2 changes: 2 additions & 0 deletions e2e/images/rabbitmq/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/streadway/amqp v1.1.0 h1:py12iX8XSyI7aN/3dUT8DFIDJazNJsVJdxNVEpnQTZM=
github.com/streadway/amqp v1.1.0/go.mod h1:WYSrTEYHOXHd0nwFeUXAe2G2hRnQT+deZJJf88uS9Bg=
Loading