Skip to content

Commit

Permalink
feat(ci): build k6 with sql plugin (#1085)
Browse files Browse the repository at this point in the history
Because

- A dependency on the `xk6` SQL plugin was introduced in
instill-ai/pipeline-backend#629

This commit

- Builds container for integration tests with `xk6` build + SQL plugin
- Removes unnecessary `K6_VERSION` injection to backend images (tests
are run from this repo's `Dockerfile`)

---------

Co-authored-by: Ping-Lin Chang <[email protected]>
  • Loading branch information
jvallesm and pinglin authored Sep 5, 2024
1 parent e6b6ea6 commit cac94c9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
4 changes: 3 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ COMPOSE_DOCKER_CLI_BUILD=1
MAX_DATA_SIZE=12

# version
ALPINE_VERSION=3.16
ALPINE_VERSION=3.18
UBUNTU_VERSION=20.04 # for model-backend

GOLANG_VERSION=1.22.5
KRAKEND_CE_VERSION=2.6.2
ARTIVC_VERSION=0.10.0
K6_VERSION=0.44.0
XK6_VERSION=0.11.0

# api-gateway
API_GATEWAY_IMAGE=instill/api-gateway
Expand Down
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
ARG ALPINE_VERSION
FROM alpine:${ALPINE_VERSION} AS base
FROM golang:alpine${ALPINE_VERSION} AS base

RUN apk add --update docker docker-compose docker-cli-compose docker-cli-buildx openrc containerd git bash make wget vim curl openssl util-linux

# Install k6
ARG TARGETARCH K6_VERSION
ADD https://github.com/grafana/k6/releases/download/v${K6_VERSION}/k6-v${K6_VERSION}-linux-$TARGETARCH.tar.gz k6-v${K6_VERSION}-linux-$TARGETARCH.tar.gz
RUN tar -xf k6-v${K6_VERSION}-linux-$TARGETARCH.tar.gz --strip-components 1 -C /usr/bin
ARG XK6_VERSION K6_VERSION
RUN go install go.k6.io/xk6/cmd/xk6@v${XK6_VERSION}
RUN xk6 build v${K6_VERSION} --with github.com/grafana/xk6-sql --output /usr/bin/k6

# Install Helm
RUN curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash

# Install Kubectl
ARG TARGETARCH
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/${TARGETARCH}/kubectl
RUN chmod +x ./kubectl
RUN mv ./kubectl /usr/local/bin

ARG ALPINE_VERSION
FROM alpine:${ALPINE_VERSION} AS latest

COPY --from=base /etc /etc
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ build-latest: ## Build latest images for all Instill Core components
--build-arg ALPINE_VERSION=${ALPINE_VERSION} \
--build-arg GOLANG_VERSION=${GOLANG_VERSION} \
--build-arg K6_VERSION=${K6_VERSION} \
--build-arg XK6_VERSION=${XK6_VERSION} \
--build-arg CACHE_DATE="$(shell date)" \
--target latest \
-t ${INSTILL_CORE_IMAGE_NAME}:latest .; \
Expand All @@ -108,6 +109,7 @@ build-release: ## Build release images for all Instill Core components
--build-arg ALPINE_VERSION=${ALPINE_VERSION} \
--build-arg GOLANG_VERSION=${GOLANG_VERSION} \
--build-arg K6_VERSION=${K6_VERSION} \
--build-arg XK6_VERSION=${XK6_VERSION} \
--build-arg CACHE_DATE="$(shell date)" \
--build-arg API_GATEWAY_VERSION=${API_GATEWAY_VERSION} \
--build-arg MGMT_BACKEND_VERSION=${MGMT_BACKEND_VERSION} \
Expand Down
5 changes: 1 addition & 4 deletions docker-compose-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ services:
args:
SERVICE_NAME: ${MGMT_BACKEND_HOST}
GOLANG_VERSION: ${GOLANG_VERSION}
K6_VERSION: ${K6_VERSION}

pipeline_backend:
profiles:
Expand All @@ -46,7 +45,6 @@ services:
args:
SERVICE_NAME: ${PIPELINE_BACKEND_HOST}
GOLANG_VERSION: ${GOLANG_VERSION}
K6_VERSION: ${K6_VERSION}

model_backend:
profiles:
Expand All @@ -62,7 +60,6 @@ services:
args:
SERVICE_NAME: ${MODEL_BACKEND_HOST}
GOLANG_VERSION: ${GOLANG_VERSION}
K6_VERSION: ${K6_VERSION}
UBUNTU_VERSION: ${UBUNTU_VERSION}
ARTIVC_VERSION: ${ARTIVC_VERSION}

Expand Down Expand Up @@ -92,6 +89,7 @@ services:
dockerfile: Dockerfile.playwright
args:
TEST_USER: "root"

artifact_backend:
profiles:
- all
Expand All @@ -106,4 +104,3 @@ services:
args:
SERVICE_NAME: ${ARTIFACT_BACKEND_HOST}
GOLANG_VERSION: ${GOLANG_VERSION}
K6_VERSION: ${K6_VERSION}

0 comments on commit cac94c9

Please sign in to comment.