Skip to content

chore(k6): build xk6-kafka v2 against k6 v2.2.0 - #393

Merged
mostafa merged 7 commits into
mainfrom
chore/k6-v2-0-0-upgrade
Aug 30, 2026
Merged

chore(k6): build xk6-kafka v2 against k6 v2.2.0#393
mostafa merged 7 commits into
mainfrom
chore/k6-v2-0-0-upgrade

Conversation

@mostafa

@mostafa mostafa commented May 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • migrate extension imports to go.k6.io/k6/v2/... and pin go.k6.io/k6/v2 v2.2.0 (latest k6 release)
  • keep the existing Go module path github.com/mostafa/xk6-kafka/v2 — no v3 major bump
  • update CI smoke/integration and local xk6 builds to k6 v2.2.0
  • document that xk6-kafka v2.x now targets k6 v2.x

Test plan

  • go test ./... -run=^$
  • CGO_ENABLED=1 xk6 build v2.2.0 --with github.com/mostafa/xk6-kafka/v2=.

mostafa added 3 commits May 16, 2026 08:06
Switch the extension and CI smoke builds to k6 v2.0.0 and update imports to the new go.k6.io/k6/v2 module path required by k6 v2.
Add a compatibility policy section clarifying that the first xk6-kafka release requiring k6 v2 should be published as v3.0.0, while v2.x remains the maintenance line for k6 v1 users.
Move the Go module path and xk6 build/install references from /v2 to /v3 so k6 v2-compatible releases are published on the v3 major line.
@yorugac

yorugac commented Jun 9, 2026

Copy link
Copy Markdown

Hi @mostafa 👋 Hope you're doing well!

FYI, we recently encountered this issue with Docker image:

$ docker run --entrypoint sh mostafamoradian/xk6-kafka:2.0.0 -c "ls -l && k6 version"
total 0
sh: k6: not found

$ docker run --entrypoint sh mostafamoradian/xk6-kafka:1.3.0 -c "ls -l && k6 version"
total 0
k6 v1.6.1 (go1.26.1, linux/amd64)
Extensions:
  github.com/mostafa/xk6-kafka (devel), k6/x/kafka [js]

So Docker image v2 of the extension is basically unusable, at least by grafana/k6-operator, and there were issues with custom builds similar to what is described here. Do you think this problem would be solved by this PR?

@mostafa

mostafa commented Jun 9, 2026

Copy link
Copy Markdown
Owner Author

Hey @yorugac, 👋

I am good and hope you are as well. I believe this PR fixes it: #396

I haven't released a new version yet, since I released v2.0.0 (because of migration to confluent-kafka-go) that builds against k6 v1.x.x. Moving to k6 v2.x.x breaks the contract, hence I should move to v3. 😢 (which I am sure you already know.)

All in all, do you think it'd be a good idea to cut a new release of xk6-kafka (namely v2.1.0) before migration to k6 v2 or just merging this and releasing xk6-kafka v3.0.0? I am honestly not sure anymore, as I wasn't expecting a k6 v2 right after xk6-kafka v2.

However, if I do that, it'll leave xk6-kafka v2 in a broken state regarding the Docker image. So, I'll release a new version before migration to k6 v2.

@sonarqubecloud

sonarqubecloud Bot commented Jun 9, 2026

Copy link
Copy Markdown

@yorugac

yorugac commented Jun 9, 2026

Copy link
Copy Markdown

Oh I see. Good to hear that issue is probably solved by the Dockerfile fix in #396. And it's indeed a case of a bad timing with all the major releases happening simultaneously 😂

All in all, do you think it'd be a good idea to cut a new release of xk6-kafka (namely v2.1.0) before migration to k6 v2 or just merging this and releasing xk6-kafka v3.0.0?

Yes, I think it totally makes sense to have both 2.1.0 and then 3.0.0 👍 As you said, leaving v2 in a broken state is not a good idea. With 2.1.0, people can still run k6 v1 + xk6-kafka with confluent lib if, for example, they need more time to switch to k6 v2. (Though k6 v2 is not actually breaking that much, from user perspective; but nevertheless.)

FYI, k6 has a schedule of major releases once a year, it's in the official docs too. Given that v1 happened in May 2025, it's now reasonable to expect a major release in spring approx. Just in case it's helpful for future planning.

LMK if you need any other info or help! And looking forward for the new releases 🙂

@yorugac

yorugac commented Jun 9, 2026

Copy link
Copy Markdown

@mostafa, Btw, I don't think there's a requirement to have a major release for the extension during k6 v2 switch, unless there are additional factors specific for this extension. For example, here:
https://github.com/grafana/xk6-faker/releases/tag/v0.5.0
k6 v2 support was added without a major release. It's a matter of convention in the extension itself, I think. So maybe for xk6-kafka, that move doesn't require v3 at all? Above, I assumed it's a requirement of xk6-kafka to bump major version for that change: is that so?

@mostafa

mostafa commented Jun 9, 2026

Copy link
Copy Markdown
Owner Author

@yorugac Well, that's an example of release planning strategy and major version bump usually means backward incompatibility, hence the xk6-kafka major version upgrade. However, I read the changelog and I don't see major breaking changes that might heavily affect xk6-kafka. So, I am with you on no major version bump in xk6-kafka.

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@sagarkancharla19

Copy link
Copy Markdown
Contributor

@mostafa fix the coverage and resolve conflicts.

@PkAIR

PkAIR commented Aug 28, 2026

Copy link
Copy Markdown

Hey @mostafa 👋 Hope you're doing well!

Just wanted to check in on this one - are you still planning to take the k6 v2.0.0 migration across the finish line? Looks like it's mostly there (checks are green apart from the small coverage dip, and merge conflicts to resolve), so I'd love to know if it's still on your roadmap. Happy to help if there's anything I can do!

Keep the xk6-kafka v2 module path and build against k6 v2.2.0
instead of introducing a v3 major line.
@mostafa mostafa changed the title chore(k6): migrate xk6-kafka to v2.0.0 chore(k6): build xk6-kafka v2 against k6 v2.2.0 Aug 30, 2026
golangci-lint v2.13 replaced exhaustruct, so default: all started
failing on incomplete struct literals that were already ignored.
CI was installing latest v2.13.2 while mise.lock stays on v2.12.2,
so gofmt disagreed on a hanging multi-value return.
@mostafa
mostafa merged commit 2a081e9 into main Aug 30, 2026
10 checks passed
@mostafa
mostafa deleted the chore/k6-v2-0-0-upgrade branch August 30, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants