-
Notifications
You must be signed in to change notification settings - Fork 15
Make the notary version detectable #37
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1 @@ | ||
| .jq-template.awk | ||
| .template-helper-functions.jq |
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,3 +1,31 @@ | ||||||
| FROM golang:1.19-alpine{{ .alpine }} AS build | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps #36 should just be closed and its changes included in this PR? |
||||||
|
|
||||||
| RUN apk add --no-cache git make | ||||||
|
|
||||||
| ENV NOTARYPKG github.com/theupdateframework/notary | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This must match what is in the go manifest which in version 0.7.0 is still that one as per: https://github.com/notaryproject/notary/blob/b0b6bfdd4933081e8d5ae026b24e8337311dd598/go.mod#L1 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They are the same repo, theupdateframework/notary redirects to notaryproject/notary, as your link shows.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, but this is used in the Go modules, so it has to match what Go thinks the module name is 🙃
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly! It's confusing I know
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Careful; the module wasn't renamed yet in the current release though (still uses i.e. |
||||||
| ENV TAG v{{ .version }} | ||||||
|
|
||||||
| ENV GOFLAGS -mod=vendor | ||||||
|
|
||||||
| WORKDIR /go/src/$NOTARYPKG | ||||||
| RUN set -eux; \ | ||||||
| git clone -b "$TAG" --depth 1 "https://$NOTARYPKG.git" .; \ | ||||||
| # In case the version in file doens't match the tag (like in 0.7.0) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this mean?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When version 0.7.0 was release, the main file used in the code to determine the version wasn't bumped. This is the 0.7.0 commit where the version is wrong. https://github.com/notaryproject/notary/blob/b0b6bfdd4933081e8d5ae026b24e8337311dd598/NOTARY_VERSION |
||||||
| echo "${TAG//v/}" > NOTARY_VERSION; \ | ||||||
| # https://github.com/notaryproject/notary/pull/1635 | ||||||
| git fetch --depth 2 origin efc35b02698644af16f6049c7b585697352451b8; \ | ||||||
| git -c user.name=foo -c user.email=foo@example.com cherry-pick -x efc35b02698644af16f6049c7b585697352451b8; \ | ||||||
| # https://github.com/notaryproject/notary/issues/1602 (rough cherry-pick of ca095023296d2d710ad9c6dec019397d46bf8576) | ||||||
| go get github.com/dvsekhvalnov/jose2go@v0.0.0-20200901110807-248326c1351b; \ | ||||||
| go mod vendor; \ | ||||||
| # TODO remove for the next release of Notary (which should include efc35b02698644af16f6049c7b585697352451b8 & ca095023296d2d710ad9c6dec019397d46bf8576) | ||||||
| # Make the version detectable by scanners | ||||||
| sed -i -r -E 's|(version.NotaryVersion=\$\(NOTARY_VERSION\))|\1 -X $(NOTARY_PKG)/version.Version=$(NOTARY_VERSION)|' Makefile; \ | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I'd avoid using a regular expression special character,
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not the special character? I've seen it done like this many time There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How would you use the special character? How would you escape it?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I usually use Perhaps you meant
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I usually use |
||||||
| make SKIPENVCHECK=1 PREFIX=. ./bin/static/notary-server ./bin/static/notary-signer; \ | ||||||
| cp -vL ./bin/static/notary-server ./bin/static/notary-signer /; \ | ||||||
| /notary-server --version; \ | ||||||
| /notary-signer --version; | ||||||
|
|
||||||
| FROM alpine:{{ .alpine }} | ||||||
|
|
||||||
| RUN adduser -D -H -g "" notary | ||||||
|
|
@@ -12,7 +40,7 @@ ENV INSTALLDIR /notary/{{ env.variant }} | |||||
| ENV PATH=$PATH:${INSTALLDIR} | ||||||
| WORKDIR ${INSTALLDIR} | ||||||
|
|
||||||
| COPY --from=notary:{{ .version }}-builder /notary-{{ env.variant }} /notary.spdx.json ./ | ||||||
| COPY --from=build /notary-{{ env.variant }} ./ | ||||||
| RUN ./notary-{{ env.variant }} --version | ||||||
|
|
||||||
| COPY ./{{ env.variant }}-config.json . | ||||||
|
|
||||||
This file was deleted.
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.
Why is the builder variant being removed?
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.
docker-library/official-images#15568 (comment)