Skip to content
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

Built image digest is stored in the build status #3533

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 50 additions & 20 deletions dev_guide/builds.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1650,6 +1650,7 @@ This displays information such as:
* The build source
* The strategy
* The output destination
* Digest of the image in destination registry
* How the build was created

If the build uses the Docker or Source strategy, the `oc describe` output also
Expand Down Expand Up @@ -2432,7 +2433,7 @@ sample-build-3 Source Git@689d111 Completed 17 seconds ago 5s
[[build-output]]
== Build Output

Docker and Source builds result in the creation of a new container image. The image
Docker and source builds result in the creation of a new container image. The image
is then pushed to the registry specified in the `output` section of the
`Build` specification.

Expand All @@ -2448,28 +2449,30 @@ at the end of the build.
====
[source,yaml]
----
output:
to:
kind: "ImageStreamTag"
name: "sample-image:latest"
spec:
output:
to:
kind: "ImageStreamTag"
name: "sample-image:latest"
----
====

.Output to a Docker Push Specification
====
[source,yaml]
----
output:
to:
kind: "DockerImage"
name: "my-registry.mycompany.com:5000/myimages/myimage:tag"
spec:
output:
to:
kind: "DockerImage"
name: "my-registry.mycompany.com:5000/myimages/myimage:tag"
----
====

[[output-image-environment-variables]]
=== Output Image Environment Variables

Docker and Source builds set the following environment variables on output
Docker and source builds set the following environment variables on output
images:

[options="header"]
Expand All @@ -2496,7 +2499,7 @@ images:
[[output-image-labels]]
=== Output Image Labels

Docker and Source builds set the following labels on output images:
Docker and source builds set the following labels on output images:

[options="header"]
|===
Expand Down Expand Up @@ -2529,15 +2532,42 @@ list of custom labels that will be applied to each image built from the BuildCon
====
[source,yaml]
----
output:
to:
kind: "ImageStreamTag"
name: "my-image:latest"
imageLabels:
- name: "vendor"
value: "MyCompany"
- name: "authoritative-source-url"
value: "registry.mycompany.com"
spec:
output:
to:
kind: "ImageStreamTag"
name: "my-image:latest"
imageLabels:
- name: "vendor"
value: "MyCompany"
- name: "authoritative-source-url"
value: "registry.mycompany.com"
----
====

[[output-image-digest]]
=== Output Image Digest

Built images can be uniquely identified by their
link:++https://docs.docker.com/registry/spec/api/#/content-digests++[digest], which can
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the ++ before and after the URL

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without ++ asciibinder mis-parses the URL, probably because it contains #. Is there another way to escape it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mmilata Interesting. I've not seen that before. @adellape @vikram-redhat Do you know a workaround, or do you think the ++ can be accepted? Not sure if this will impact how the docs build. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahardin-rh I'm not sure of another workaround. I think only the Customer Portal build would potentially have an issue; worth checking with Lee on. @vikram-redhat Can you look into that?

I'd be inclined to merge this but mark for follow-up before it gets downstream.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vikram-redhat bump ^^

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahardin-rh - interesting. I haven't seen this issue before either. But from memory, if asciibinder is miss-parsing the URL due to the hash, you could just take the 'link' off. Can you try that and see if it fixes it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore my previous comment. Discussed with Lee. He has suggested using $$ instead of ++.

later be used to
link:++https://docs.docker.com/engine/reference/commandline/pull/#/pull-an-image-by-digest-immutable-identifier++[pull the image]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. Please remove the ++ before and after the URL.

regardless of its current tag.

Docker and source builds store the digest in
`Build.status.output.to.imageDigest` after the image is pushed to registry.
The digest is computed by the registry. Therefore, it may not always be present
(for example, when the registry did not return a digest, or when the builder
image did not understand its format).

.Built Image Digest After a Successful Push to the Registry
====
[source,yaml]
----
status:
output:
to:
imageDigest: sha256:29f5d56d12684887bdfa50dcd29fc31eea4aaf4ad3bec43daf19026a7ce69912
----
====

Expand Down