Skip to content

Commit dedd951

Browse files
authored
fix: Remove second k6 binary for gsm (#1274)
Now that we have a more recent k6 version in xk6-sm[1] we can consolidate. This change requires updating xk6-sm to the latest release. [1]: grafana/xk6-sm#106
1 parent 3a0b7ca commit dedd951

File tree

5 files changed

+6
-29
lines changed

5 files changed

+6
-29
lines changed

Diff for: Dockerfile

+1-3
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ ARG HOST_DIST=$TARGETOS-$TARGETARCH
2323

2424
RUN adduser -D -u 12345 -g 12345 sm
2525

26-
ADD --chown=sm:sm --chmod=0500 https://github.com/grafana/xk6-sm/releases/download/v0.4.0/sm-k6-${TARGETOS}-${TARGETARCH} /usr/local/bin/sm-k6
27-
ADD --chown=sm:sm --chmod=0500 https://github.com/grafana/xk6-sm/releases/download/v0.4.0/sm-k6-${TARGETOS}-${TARGETARCH}-gsm /usr/local/bin/sm-k6-gsm
26+
ADD --chown=sm:sm --chmod=0500 https://github.com/grafana/xk6-sm/releases/download/v0.5.2/sm-k6-${TARGETOS}-${TARGETARCH} /usr/local/bin/sm-k6
2827
COPY --chown=sm:sm --chmod=0500 --from=setcapper /usr/local/bin/synthetic-monitoring-agent /usr/local/bin/synthetic-monitoring-agent
2928
COPY --chown=sm:sm scripts/pre-stop.sh /usr/local/lib/synthetic-monitoring-agent/pre-stop.sh
3029
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
@@ -40,7 +39,6 @@ RUN adduser -D -u 12345 -g 12345 sm
4039

4140
COPY --from=release --chown=sm:sm /usr/local/bin/synthetic-monitoring-agent /usr/local/bin/synthetic-monitoring-agent
4241
COPY --from=release --chown=sm:sm /usr/local/bin/sm-k6 /usr/local/bin/sm-k6
43-
COPY --from=release --chown=sm:sm /usr/local/bin/sm-k6-gsm /usr/local/bin/sm-k6-gsm
4442
COPY --from=release /usr/local/lib/synthetic-monitoring-agent/pre-stop.sh /usr/local/lib/synthetic-monitoring-agent/pre-stop.sh
4543
COPY --from=release /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
4644

Diff for: Dockerfile.build

+1-3
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ ARG HOST_DIST=$TARGETOS-$TARGETARCH
2323

2424
RUN adduser -D -u 12345 -g 12345 sm
2525

26-
ADD --chown=sm:sm --chmod=0500 https://github.com/grafana/xk6-sm/releases/download/v0.4.0/sm-k6-${TARGETOS}-${TARGETARCH} /usr/local/bin/sm-k6
27-
ADD --chown=sm:sm --chmod=0500 https://github.com/grafana/xk6-sm/releases/download/v0.4.0/sm-k6-${TARGETOS}-${TARGETARCH}-gsm /usr/local/bin/sm-k6-gsm
26+
ADD --chown=sm:sm --chmod=0500 https://github.com/grafana/xk6-sm/releases/download/v0.5.2/sm-k6-${TARGETOS}-${TARGETARCH} /usr/local/bin/sm-k6
2827
COPY --chown=sm:sm --chmod=0500 --from=setcapper /usr/local/bin/synthetic-monitoring-agent /usr/local/bin/synthetic-monitoring-agent
2928
COPY --chown=sm:sm scripts/pre-stop.sh /usr/local/lib/synthetic-monitoring-agent/pre-stop.sh
3029
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
@@ -40,7 +39,6 @@ RUN adduser -D -u 12345 -g 12345 sm
4039

4140
COPY --from=release --chown=sm:sm /usr/local/bin/synthetic-monitoring-agent /usr/local/bin/synthetic-monitoring-agent
4241
COPY --from=release --chown=sm:sm /usr/local/bin/sm-k6 /usr/local/bin/sm-k6
43-
COPY --from=release --chown=sm:sm /usr/local/bin/sm-k6-gsm /usr/local/bin/sm-k6-gsm
4442
COPY --from=release /usr/local/lib/synthetic-monitoring-agent/pre-stop.sh /usr/local/lib/synthetic-monitoring-agent/pre-stop.sh
4543
COPY --from=release /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
4644

Diff for: internal/k6runner/local.go

+1-12
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,7 @@ func (r Local) Run(ctx context.Context, script Script, secretStore SecretStore)
7575
return nil, fmt.Errorf("cannot write temporary script file: %w", err)
7676
}
7777

78-
executable := r.k6path
79-
// TODO(d0ugal): This is a short-term hack to use a different k6 binary when
80-
// secrets are configured. This should be removed when the default binary has been updated
81-
if secretStore.IsConfigured() {
82-
executable = r.k6path + "-gsm"
83-
logger.Info().
84-
Str("k6_path", r.k6path).
85-
Str("k6_gsm_path", executable).
86-
Msg("Using k6-gsm binary for secrets")
87-
}
88-
89-
k6Path, err := exec.LookPath(executable)
78+
k6Path, err := exec.LookPath(r.k6path)
9079
if err != nil {
9180
return nil, fmt.Errorf("cannot find k6 executable: %w", err)
9281
}

Diff for: scripts/make/sm-k6.mk

+3-9
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,14 @@ define sm-k6
88
$(DISTDIR)/$(1)-$(2)/sm-k6:
99
mkdir -p "$(DISTDIR)/$(1)-$(2)"
1010
# Renovate updates the following line. Keep its syntax as it is.
11-
curl -sSL https://github.com/grafana/xk6-sm/releases/download/v0.4.0/sm-k6-$(1)-$(2) -o "$$@"
11+
curl -sSL https://github.com/grafana/xk6-sm/releases/download/v0.5.2/sm-k6-$(1)-$(2) -o "$$@"
1212
chmod +x "$$@"
1313

14-
$(DISTDIR)/$(1)-$(2)/sm-k6-gsm:
15-
mkdir -p "$(DISTDIR)/$(1)-$(2)"
16-
# Renovate updates the following line. Keep its syntax as it is.
17-
curl -sSL https://github.com/grafana/xk6-sm/releases/download/v0.4.0/sm-k6-$(1)-$(2)-gsm -o "$$@"
18-
chmod +x "$$@"
19-
20-
sm-k6: $(DISTDIR)/$(1)-$(2)/sm-k6 $(DISTDIR)/$(1)-$(2)/sm-k6-gsm
14+
sm-k6: $(DISTDIR)/$(1)-$(2)/sm-k6
2115
endef
2216

2317
$(foreach BUILD_PLATFORM,$(XK6_PLATFORMS), \
2418
$(eval $(call sm-k6,$(word 1,$(subst /, ,$(BUILD_PLATFORM))),$(word 2,$(subst /, ,$(BUILD_PLATFORM))))))
2519

2620
.PHONY: sm-k6-native
27-
sm-k6-native: $(DISTDIR)/$(HOST_OS)-$(HOST_ARCH)/sm-k6 $(DISTDIR)/$(HOST_OS)-$(HOST_ARCH)/sm-k6-gsm
21+
sm-k6-native: $(DISTDIR)/$(HOST_OS)-$(HOST_ARCH)/sm-k6

Diff for: scripts/package/nfpm.yaml.template

-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,5 @@ contents:
2323
# Copy k6 as sm-k6 to prevent clashing with k6 if it's installed.
2424
- src: {{.DISTDIR}}/{{.Os}}-{{.Arch}}/sm-k6
2525
dst: /usr/bin/sm-k6
26-
- src: {{.DISTDIR}}/{{.Os}}-{{.Arch}}/sm-k6-gsm
27-
dst: /usr/bin/sm-k6-gsm
2826
rpm:
2927
deb:

0 commit comments

Comments
 (0)