-
-
Notifications
You must be signed in to change notification settings - Fork 6
feat(shared/statsd-exporter): Bump to 0.30.0 #1524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
44e711c
chore(shared/statsd-exporter): Initialize patchable
NickLarsenNZ 6841bbe
chore(shared/statsd-exporter): Build from explicit golang version
NickLarsenNZ ec9bacb
chore(shared/statsd-exporter): Build in the stackable-devel image
NickLarsenNZ 3d20338
feat(shared/statsd-exporter): Build from source using Patchable
NickLarsenNZ 5103108
Merge remote-tracking branch 'origin/main' into docker-images-statsd
NickLarsenNZ 7c1159c
chore: Remove unused script
NickLarsenNZ 59965ef
feat(shared/statsd-exporter): Bump to 0.30.0
NickLarsenNZ 031292d
chore: Add/update hadolint configs
NickLarsenNZ 9bcdf4d
Apply suggestions from code review
NickLarsenNZ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,43 +1,65 @@ | ||
| # syntax=docker/dockerfile:1.16.0@sha256:e2dd261f92e4b763d789984f6eab84be66ab4f5f08052316d8eb8f173593acf7 | ||
| # check=error=true | ||
| # check=error=true;skip=InvalidDefaultArgInFrom | ||
|
|
||
| ARG GOLANG_VERSION | ||
| FROM oci.stackable.tech/sdp/library/golang:${GOLANG_VERSION} AS golang-image | ||
|
|
||
| FROM local-image/stackable-devel AS statsd-exporter-builder | ||
|
|
||
| FROM local-image/stackable-base | ||
| ARG PRODUCT_VERSION | ||
| ARG CYCLONEDX_GOMOD_VERSION | ||
| ARG STACKABLE_USER_UID | ||
| ARG TARGETARCH | ||
| ARG TARGETOS | ||
|
|
||
| ENV CYCLONEDX_GOMOD_VERSION=$CYCLONEDX_GOMOD_VERSION | ||
| ENV GOARCH=$TARGETARCH | ||
| ENV GOOS=$TARGETOS | ||
|
|
||
| WORKDIR /statsd_exporter | ||
|
|
||
| RUN --mount=type=cache,id=go-statsd-exporter,uid=${STACKABLE_USER_UID},target=/go_cache <<EOF | ||
| RUN <<EOF | ||
| microdnf update | ||
|
|
||
| # Tar and gzip are used to unpack the statsd_exporter source | ||
| # Golang is used to build statsd_exporter | ||
| # Git is needed by the cyclonedx-gomod tool to determine the version of statsd_exporter | ||
| microdnf install \ | ||
| tar \ | ||
| gzip \ | ||
| git \ | ||
| golang | ||
| git | ||
|
|
||
| microdnf clean all | ||
| rm -rf /var/cache/yum | ||
| EOF | ||
|
|
||
| # Manually install Go since the dnf package is sometimes not recent enough | ||
| COPY --from=golang-image /usr/local/go/ /usr/local/go/ | ||
| ENV PATH="/usr/local/go/bin:${PATH}" | ||
|
|
||
| COPY --chown=${STACKABLE_USER_UID}:0 shared/statsd-exporter/stackable/patches/patchable.toml /statsd_exporter/src/shared/statsd-exporter/stackable/patches/patchable.toml | ||
| COPY --chown=${STACKABLE_USER_UID}:0 shared/statsd-exporter/stackable/patches/${PRODUCT_VERSION} /statsd_exporter/src/shared/statsd-exporter/stackable/patches/${PRODUCT_VERSION} | ||
|
|
||
| RUN --mount=type=cache,id=go-statsd-exporter,uid=${STACKABLE_USER_UID},target=/go_cache <<EOF | ||
| export GOPATH=/go_cache | ||
| # We use version 1.7.0, since a newer version of cyclonedx-gomod is not compatible with the version of Golang (>= 1.23.1) | ||
| go install github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod@v1.7.0 | ||
| go install "github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod@v${CYCLONEDX_GOMOD_VERSION}" | ||
|
|
||
| curl "https://repo.stackable.tech/repository/packages/statsd_exporter/statsd_exporter-${PRODUCT_VERSION}.src.tar.gz" | tar -xzC . | ||
| ( | ||
| cd "statsd_exporter-${PRODUCT_VERSION}" || exit | ||
| cd "$(/stackable/patchable --images-repo-root=src checkout shared/statsd-exporter ${PRODUCT_VERSION})" | ||
|
|
||
| # Create snapshot of the source code including custom patches | ||
| tar -czf /statsd_exporter/statsd-exporter-${PRODUCT_VERSION}-src.tar.gz . | ||
|
|
||
| # Unfortunately, we need to create a dummy Git repository to allow cyclonedx-gomod to determine the version of statsd_exporter | ||
| rm .git | ||
| git init | ||
| git config user.email "fake.commiter@stackable.tech" | ||
| git config user.name "Fake commiter" | ||
| git commit --allow-empty --message "Fake commit, so that we can create a tag" | ||
| git tag "v${PRODUCT_VERSION}" | ||
| go build -o ../statsd_exporter | ||
| $GOPATH/bin/cyclonedx-gomod app -json -output-version 1.5 -output ../statsd_exporter-${PRODUCT_VERSION}.cdx.json -packages -files | ||
| go build -o /statsd_exporter/statsd_exporter | ||
| $GOPATH/bin/cyclonedx-gomod app -json -output-version 1.5 -output /statsd_exporter/statsd_exporter-${PRODUCT_VERSION}.cdx.json -packages -files | ||
| ) | ||
| rm -rf "statsd_exporter-${PRODUCT_VERSION}" | ||
| # set correct groups | ||
| chmod -R g=u /statsd_exporter/ | ||
| EOF | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,14 @@ | ||
| [metadata] | ||
| "oci.stackable.tech" = { namespace = "sdp" } | ||
|
|
||
| [versions."0.29.0".local-images] | ||
| stackable-base = "1.0.0" | ||
| [versions."0.30.0".build-arguments] | ||
| # Find this in https://github.com/prometheus/statsd_exporter/blob/v0.30.0/go.mod | ||
| # You can find the latest patch version at: https://go.dev/doc/devel/release | ||
| # Mirror golang (no `v` prefix) via https://github.com/stackabletech/docker-images/actions/workflows/mirror.yaml | ||
| # Note: currently mirrored to the `sdp` project, but should probably move elsewhere. | ||
| golang-version = "1.25.11" | ||
| # We use version 1.7.0, since a newer version of cyclonedx-gomod is not compatible with the version of Golang (>= 1.23.1) | ||
| cyclonedx-gomod-version = "1.7.0" | ||
|
|
||
| [versions."0.30.0".local-images] | ||
| stackable-devel = "1.0.0" |
2 changes: 2 additions & 0 deletions
2
shared/statsd-exporter/stackable/patches/0.30.0/patchable.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| mirror = "https://github.com/stackabletech/statsd_exporter.git" | ||
| base = "4a7feb4d0ec9f1061b9e2f548810dd6efc6a294a" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| upstream = "https://github.com/prometheus/statsd_exporter.git" | ||
| default-mirror = "https://github.com/stackabletech/statsd_exporter.git" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this? Or can we use the tag/commit/ whatever we are on that is generated by patchable?
Especially important as soon as we actually start patching stuff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't quite understand. This tar happens after the patchable checkout (so after any would-be patches are applied).
Did you mean something else?
FWIW, I kept the same order as OPA:
docker-images/opa/Dockerfile
Lines 76 to 84 in 1150cac
I just removed the SDP version bits of code in between (since this is an intermediary dependency, and I'm not sure we want to have another place to remember to update SDP versions (ie: the boil config for statsd).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was referring to
That was back in the day where we downloaded and extracted a .tar.gz. But now we actually have a git repo (don't we?), so we should be able to remove this "let's init a dummy git repo" workaround.
Didn't test it though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't test it, since opa does the same thing (it probably needs its thing removed too then).
IMO, this is ready to go, and that improvement can be done across the board. I'm happy to raise it straight after.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing, happy to merge if you promise to have a look ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried the naiive way, to no avail.
Maybe we still need a tag, which then needs all that extra git stuff. Not sure it's worth it right now :/