-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
69006e4
to
dbfc338
Compare
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.
Left some suggestions. Overall I'm not super happy with moving things to src
, but I abandoned this project first so I won't be pestering about style guides :P
@@ -50,9 +48,18 @@ func DockerLikeImageInfo(baseUrl string) func(image, tag string) ([]string, erro | |||
req.Header.Set("Authorization", "Bearer "+token) | |||
} | |||
|
|||
digests := []string{} | |||
|
|||
retDigests, err := ociDigests(req) |
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.
Multiple functions mutating this request can be a bit error prone, I'd be weary of this.
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.
yes is not the best way I agree, TBH I just extended the current code to contemplate this case, didn't want to do a bigger refactor for this knowing that we will replace it soon.
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.
oh the request! you are right i didn't pay attention to that , I guess was a way to reuse auth, I will improve it Set replace the previous values , so not ideal but no bug here I think
return nil, fmt.Errorf("getting oci image digests from docker: %w", err) | ||
} | ||
|
||
digests = append(digests, retDigests...) |
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 need both OCI-formatted digests and v2 manifest digests?
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 kept both to avoid breaking changes on the non oci images.
// OCI images will not respond with the list of digest | ||
return nil, nil |
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.
Rather than calling dockerContentDigest
unconditionally and muting this error, would it be better to avoid calling dockerContentDigest
at all if OCI digests are found?
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'm not completely sure about it (is a bit blurry to me how this API works) so I followed the existing mechanism that was adding digest to the array.
if resp.Header.Get("Content-Type") != acceptHeader { | ||
return nil, nil | ||
} |
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.
Seems like this should be an error or at least a log, wouldn't it?
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.
the api return different content-type event if the accept header is set to the image one. this was a quick way to filter this responses, but I didn't want to log error since this is expected and logging this will pollute the logs.
require.NoError(t, err) | ||
require.Contains(t, digests, "sha256:7300aec653dbe8aaef96b92d2f8319a2cef8e03e99b4420ba846b46a1447ea6b") | ||
|
||
// test buildkit image https://github.com/moby/buildkit/issues/2251 |
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.
Could we split this to a second test? That way we will know which one is failing.
Co-authored-by: Roberto Santalla <roobre@users.noreply.github.com>
oh the reason for that was to have the possibility to do a go run to quickly test without having the image. |
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.
The hack Just Works ™️ but as there is a plan to decommission the canaries reroller I would prefer to just have it working that having a perfect solution.
I left a couple of comments that are worrying me a bit tho.
- uses: docker/login-action@v1 | ||
with: | ||
username: roobre | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} |
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.
- uses: docker/login-action@v1 | |
with: | |
username: roobre | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} |
- name: Build docker image | ||
run: | | ||
docker build . -t roobre/reroller:${DOCKER_IMAGE_TAG} | ||
docker tag roobre/reroller:${DOCKER_IMAGE_TAG} roobre/reroller:latest |
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.
- name: Build docker image | |
run: | | |
docker build . -t roobre/reroller:${DOCKER_IMAGE_TAG} | |
docker tag roobre/reroller:${DOCKER_IMAGE_TAG} roobre/reroller:latest | |
- name: Build docker image | |
run: | | |
docker build . -t ghcr.io/${{ github.repository }}:${DOCKER_IMAGE_TAG} | |
docker tag ghcr.io/${{ github.repository }}:${DOCKER_IMAGE_TAG} ghcr.io/${{ github.repository }}:latest |
- name: Push docker image | ||
run: | | ||
docker push roobre/reroller:${DOCKER_IMAGE_TAG} | ||
docker push roobre/reroller:latest |
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.
- name: Push docker image | |
run: | | |
docker push roobre/reroller:${DOCKER_IMAGE_TAG} | |
docker push roobre/reroller:latest | |
- name: Push docker image | |
run: | | |
docker push ghcr.io/${{ github.repository }}:${DOCKER_IMAGE_TAG} | |
docker push ghcr.io/${{ github.repository }}:latest |
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.
GitHub has an OCI registry per repo. Instead of publishing to Roobre's registry, we can still publish to the GitHub one.
This way you will neither need to upload the image to your account nor we will not need a secret to upload to new relic's registry. We will be able to archive this repository easily too.
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.
oh this is a very good one, I will do that.
|
||
go 1.16 | ||
go 1.20 |
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.
We are having issues with Go 1.20 and Alpine. We think that it is because we are compiling with CGO_ENABLED=1
but it might be more things failing. I would stick to 1.19 for now.
I will open another PR with just the changes we finally need. removing the package arrangement that I did to the go run thing |
Reroller fails to get image digests when are generated by Buildkit (OCI). Some extra details