Skip to content

Commit

Permalink
fix(ci): use xk6-sql driver and pin down versions (#1159)
Browse files Browse the repository at this point in the history
Because

- `xk6-sql` has a [new
release](https://github.com/grafana/xk6-sql/releases/tag/v1.0.0) with
breaking changes.

This commit

- Use driver modules introduced in the new release and pin down versions
to avoid unexpected behaviour.
  • Loading branch information
jvallesm authored Nov 26, 2024
1 parent a27d232 commit 321a041
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 10 deletions.
6 changes: 4 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ 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
K6_VERSION=0.55.0
XK6_VERSION=0.13.3
XK6_SQL_VERSION=1.0.0
XK6_SQL_POSTGRES_VERSION=0.1.0

# api-gateway
API_GATEWAY_IMAGE=instill/api-gateway
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/helm-integration-test-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ jobs:
- name: Install k6
run: |
go install go.k6.io/xk6/cmd/xk6@v${{ env.XK6_VERSION }}
xk6 build v${{ env.K6_VERSION }} --with github.com/grafana/[email protected] && sudo cp k6 /usr/bin
xk6 build v${{ env.K6_VERSION }} \
--with github.com/grafana/xk6-sql@v${{ env.XK6_SQL_VERSION }} \
--with github.com/grafana/xk6-sql-driver-postgres@v${{ env.XK6_SQL_POSTGRES_VERSION }} && \
sudo cp k6 /usr/bin
- name: Launch Helm Instill Core (${{ inputs.target }})
# Dummy GitHub OAuth configuration variables are inserted on
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/integration-test-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ jobs:
- name: Install k6
run: |
go install go.k6.io/xk6/cmd/xk6@v${{ env.XK6_VERSION }}
xk6 build v${{ env.K6_VERSION }} --with github.com/grafana/[email protected] && sudo cp k6 /usr/bin
xk6 build v${{ env.K6_VERSION }} \
--with github.com/grafana/xk6-sql@v${{ env.XK6_SQL_VERSION }} \
--with github.com/grafana/xk6-sql-driver-postgres@v${{ env.XK6_SQL_POSTGRES_VERSION }} && \
sudo cp k6 /usr/bin
- name: Launch Instill Core (${{ inputs.target }})
# CFG_COMPONENT_SECRETS_GITHUB* variables are injected to test OAuth
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/make-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GOLANG_VERSION }}

- name: Install k6
run: |
go install go.k6.io/xk6/cmd/xk6@v${{ env.XK6_VERSION }}
xk6 build v${{ env.K6_VERSION }} --with github.com/grafana/[email protected] && sudo cp k6 /usr/bin
xk6 build v${{ env.K6_VERSION }} \
--with github.com/grafana/xk6-sql@v${{ env.XK6_SQL_VERSION }} \
--with github.com/grafana/xk6-sql-driver-postgres@v${{ env.XK6_SQL_POSTGRES_VERSION }} && \
sudo cp k6 /usr/bin
- name: Launch Instill Core (release)
run: |
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/make-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GOLANG_VERSION }}

- name: Install k6
run: |
go install go.k6.io/xk6/cmd/xk6@v${{ env.XK6_VERSION }}
xk6 build v${{ env.K6_VERSION }} --with github.com/grafana/[email protected] && sudo cp k6 /usr/bin
xk6 build v${{ env.K6_VERSION }} \
--with github.com/grafana/xk6-sql@v${{ env.XK6_SQL_VERSION }} \
--with github.com/grafana/xk6-sql-driver-postgres@v${{ env.XK6_SQL_POSTGRES_VERSION }} && \
sudo cp k6 /usr/bin
- name: Launch Instill Core (latest)
run: |
Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ 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

ARG XK6_VERSION K6_VERSION
ARG K6_VERSION XK6_VERSION XK6_SQL_VERSION XK6_SQL_POSTGRES_VERSION
RUN go install go.k6.io/xk6/cmd/xk6@v${XK6_VERSION}
RUN xk6 build v${K6_VERSION} --with github.com/grafana/[email protected] --output /usr/bin/k6
RUN xk6 build v${K6_VERSION} \
--with github.com/grafana/xk6-sql@v${XK6_SQL_VERSION} \
--with github.com/grafana/xk6-sql-driver-postgres@v${XK6_SQL_POSTGRES_VERSION} \
--output /usr/bin/k6

# Install Helm
RUN curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ build-latest: ## Build latest images for all services
--build-arg GOLANG_VERSION=${GOLANG_VERSION} \
--build-arg K6_VERSION=${K6_VERSION} \
--build-arg XK6_VERSION=${XK6_VERSION} \
--build-arg XK6_SQL_VERSION=${XK6_SQL_VERSION} \
--build-arg XK6_SQL_POSTGRES_VERSION=${XK6_SQL_POSTGRES_VERSION} \
--build-arg CACHE_DATE="$(shell date)" \
--target latest \
-t ${INSTILL_CORE_IMAGE_NAME}:latest .; \
Expand Down Expand Up @@ -112,6 +114,8 @@ build-release: ## Build release images for all services
--build-arg GOLANG_VERSION=${GOLANG_VERSION} \
--build-arg K6_VERSION=${K6_VERSION} \
--build-arg XK6_VERSION=${XK6_VERSION} \
--build-arg XK6_SQL_VERSION=${XK6_SQL_VERSION} \
--build-arg XK6_SQL_POSTGRES_VERSION=${XK6_SQL_POSTGRES_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

0 comments on commit 321a041

Please sign in to comment.