Skip to content

Commit 94e98ee

Browse files
committed
Add the opencontainers annotations to API docs
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
1 parent 1a59935 commit 94e98ee

File tree

4 files changed

+22
-9
lines changed

4 files changed

+22
-9
lines changed

controllers/ocirepository_controller.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func (r *OCIRepositoryReconciler) Reconcile(ctx context.Context, req ctrl.Reques
200200
summarize.WithReconcileError(retErr),
201201
summarize.WithIgnoreNotFound(),
202202
summarize.WithProcessors(
203-
summarize.RecordContextualError,
203+
summarize.ErrorActionHandler,
204204
summarize.RecordReconcileReq,
205205
),
206206
summarize.WithResultBuilder(sreconcile.AlwaysRequeueResultBuilder{RequeueAfter: obj.GetRequeueAfter()}),
@@ -347,7 +347,7 @@ func (r *OCIRepositoryReconciler) reconcileSource(ctx context.Context, obj *sour
347347
if err != nil {
348348
if _, ok := err.(invalidOCIURLError); ok {
349349
e := serror.NewStalling(
350-
fmt.Errorf("failed to determine the artifact address for '%s': %w", obj.Spec.URL, err),
350+
fmt.Errorf("URL validation failed for '%s': %w", obj.Spec.URL, err),
351351
sourcev1.URLInvalidReason)
352352
conditions.MarkTrue(obj, sourcev1.FetchFailedCondition, e.Reason, e.Err.Error())
353353
return sreconcile.ResultEmpty, e

docs/spec/v1beta2/ocirepositories.md

+17-4
Original file line numberDiff line numberDiff line change
@@ -484,23 +484,36 @@ specific OCIRepository, e.g.
484484
The OCIRepository reports the latest synchronized state from the OCI repository
485485
as an Artifact object in the `.status.artifact` of the resource.
486486

487+
The `.status.artifact.revision` holds the SHA256 digest of the upstream OCI artifact.
488+
489+
The `.status.artifact.metadata` holds the upstream OCI artifact metadata such as the
490+
[OpenContainers standard annotations](https://github.com/opencontainers/image-spec/blob/main/annotations.md).
491+
If the OCI artifact was created with `flux push artifact`, then the `metadata` will contain the following
492+
annotations:
493+
- `org.opencontainers.image.created` the date and time on which the artifact was built
494+
- `org.opencontainers.image.source` the URL of the Git repository containing the source files
495+
- `org.opencontainers.image.revision` the Git branch and commit SHA1 of the source files
496+
487497
The Artifact file is a gzip compressed TAR archive (`<commit sha>.tar.gz`), and
488498
can be retrieved in-cluster from the `.status.artifact.url` HTTP address.
489499

490500
#### Artifact example
491501

492502
```yaml
493-
---
494503
apiVersion: source.toolkit.fluxcd.io/v1beta2
495504
kind: OCIRepository
496505
metadata:
497506
name: <repository-name>
498507
status:
499508
artifact:
500-
checksum: e750c7a46724acaef8f8aa926259af30bbd9face2ae065ae8896ba5ee5ab832b
501-
lastUpdateTime: "2022-06-29T06:59:23Z"
509+
checksum: 9f3bc0f341d4ecf2bab460cc59320a2a9ea292f01d7b96e32740a9abfd341088
510+
lastUpdateTime: "2022-08-08T09:35:45Z"
511+
metadata:
512+
org.opencontainers.image.created: "2022-08-08T12:31:41+03:00"
513+
org.opencontainers.image.revision: 6.1.8/b3b00fe35424a45d373bf4c7214178bc36fd7872
514+
org.opencontainers.image.source: https://github.com/stefanprodan/podinfo.git
502515
path: ocirepository/<namespace>/<repository-name>/<digest>.tar.gz
503-
revision: master/363a6a8fe6a7f13e05d34c163b0ef02a777da20a
516+
revision: <digest>
504517
url: http://source-controller.<namespace>.svc.cluster.local./ocirepository/<namespace>/<repository-name>/<digest>.tar.gz
505518
```
506519

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ require (
3737
github.com/fluxcd/pkg/gitutil v0.1.0
3838
github.com/fluxcd/pkg/helmtestserver v0.7.4
3939
github.com/fluxcd/pkg/lockedfile v0.1.0
40-
github.com/fluxcd/pkg/oci v0.2.0
40+
github.com/fluxcd/pkg/oci v0.3.0
4141
github.com/fluxcd/pkg/runtime v0.16.2
4242
github.com/fluxcd/pkg/ssh v0.5.0
4343
github.com/fluxcd/pkg/testserver v0.2.0

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,8 @@ github.com/fluxcd/pkg/helmtestserver v0.7.4 h1:/Xj2+XLz7wr38MI3uPYvVAsZB9wQOq6rp
399399
github.com/fluxcd/pkg/helmtestserver v0.7.4/go.mod h1:aL5V4o8wUOMqeHMfjbVHS057E3ejzHMRVMqEbsK9FUQ=
400400
github.com/fluxcd/pkg/lockedfile v0.1.0 h1:YsYFAkd6wawMCcD74ikadAKXA4s2sukdxrn7w8RB5eo=
401401
github.com/fluxcd/pkg/lockedfile v0.1.0/go.mod h1:EJLan8t9MiOcgTs8+puDjbE6I/KAfHbdvIy9VUgIjm8=
402-
github.com/fluxcd/pkg/oci v0.2.0 h1:pvLF6iKmSj9u48Da7qlBDVIiH2NLOrbFUFE4Yr431Lc=
403-
github.com/fluxcd/pkg/oci v0.2.0/go.mod h1:c1pj9E/G5927gSa6ooACAyZe+HwjgmPk9johL7oXDHw=
402+
github.com/fluxcd/pkg/oci v0.3.0 h1:GFn6JZeg5fV2K4vsQ0s5lJFid6qrpA4RybLXL+7qUbQ=
403+
github.com/fluxcd/pkg/oci v0.3.0/go.mod h1:c1pj9E/G5927gSa6ooACAyZe+HwjgmPk9johL7oXDHw=
404404
github.com/fluxcd/pkg/runtime v0.16.2 h1:CexfMmJK+r12sHTvKWyAax0pcPomjd6VnaHXcxjUrRY=
405405
github.com/fluxcd/pkg/runtime v0.16.2/go.mod h1:OHSKsrO+T+Ym8WZRS2oidrnauWRARuE2nfm8ewevm7M=
406406
github.com/fluxcd/pkg/ssh v0.5.0 h1:jE9F2XvUXC2mgseeXMATvO014fLqdB30/VzlPLKsk20=

0 commit comments

Comments
 (0)