From c6385cc93f0ce9f4f457afcfdbc3074fd98340c3 Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Wed, 18 Nov 2026 16:04:56 +0100 Subject: [PATCH 1/3] docs(dockerimage): document age filtering Describe the age spec of the dockerimage resource, how a tag is dated, and that reproducibly built images without a creation annotation, such as gcr.io/distroless, can't be filtered by age. Signed-off-by: Giovanni Toraldo --- .../docs/plugins/resource/docker_image.adoc | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/content/en/docs/plugins/resource/docker_image.adoc b/content/en/docs/plugins/resource/docker_image.adoc index 493e71496..741fe4206 100644 --- a/content/en/docs/plugins/resource/docker_image.adoc +++ b/content/en/docs/plugins/resource/docker_image.adoc @@ -77,6 +77,43 @@ Accepted forms: * `windows/amd64` * `linux/arm/v7` +== Age + +`age` limits a source to tags created within a time window, and makes a condition fail for a tag outside it. With `minimum: 7d`, a source passes over a tag published yesterday and returns the previous one. + +[source,yaml] +---- +sources: + updatecli: + kind: dockerimage + spec: + image: ghcr.io/updatecli/updatecli + architecture: amd64 + versionfilter: + kind: semver + age: + minimum: 7d +---- + +A tag is dated by the first of these that is set: + +. the `org.opencontainers.image.created` annotation of the image index +. the `org.opencontainers.image.created` annotation of the image manifest +. the `created` field of the image configuration + +Remarks: + +* When an architecture is set, the image for that platform is dated. A source dates the first platform of the list, a condition checks every one. +* Each tag costs requests to the registry, so a source checks at most 20 tags, in the order the version filter prefers them. +* A source is skipped, not failed, when every matching tag is outside the window or none of them has a date. + +[IMPORTANT] +==== +Reproducible builds set the creation date to the Unix epoch, 1970-01-01, and Updatecli treats that as no date. Unless such an image carries the `org.opencontainers.image.created` annotation, it can't be filtered by age: a source with `age` set skips it every time. + +The `gcr.io/distroless` images are in this case. Leave `age` unset for them. +==== + == Authentication Depending on the Docker Registry, authentication may be required. The way to retrieve the token depends on the registry. From 324c8a36deca9e027f190d422f68c40457c135d8 Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Thu, 26 Nov 2026 12:22:42 +0100 Subject: [PATCH 2/3] docs(dockerimage): align age section with the merged behavior Document the platform checks, the refused latest filter, the skip cases and the publisher-set date caveat. --- .../docs/plugins/resource/docker_image.adoc | 12 ++- .../en/docs/plugins/resource/gitcommit.adoc | 94 +++++-------------- 2 files changed, 32 insertions(+), 74 deletions(-) diff --git a/content/en/docs/plugins/resource/docker_image.adoc b/content/en/docs/plugins/resource/docker_image.adoc index 741fe4206..c9ce4e6f2 100644 --- a/content/en/docs/plugins/resource/docker_image.adoc +++ b/content/en/docs/plugins/resource/docker_image.adoc @@ -79,7 +79,7 @@ Accepted forms: == Age -`age` limits a source to tags created within a time window, and makes a condition fail for a tag outside it. With `minimum: 7d`, a source passes over a tag published yesterday and returns the previous one. +`age` limits a source to tags created within a time window, and makes a condition fail for a tag outside it. With `minimum: 7d`, a source passes over a tag created yesterday and returns the previous one. [source,yaml] ---- @@ -103,9 +103,15 @@ A tag is dated by the first of these that is set: Remarks: -* When an architecture is set, the image for that platform is dated. A source dates the first platform of the list, a condition checks every one. +* A tag is dated for every platform of `architectures`, and must exist and be inside the window for all of them. This holds for a source and a condition alike. Without a platform, an image index is dated by its `linux/amd64` image, or else its first image. +* A source needs a version filter that orders tags, such as `semver`. Registries list tags alphabetically, so the `latest` kind with the `latest` pattern is refused. * Each tag costs requests to the registry, so a source checks at most 20 tags, in the order the version filter prefers them. -* A source is skipped, not failed, when every matching tag is outside the window or none of them has a date. +* A source is skipped, not failed, when every matching tag is outside the window, none of them has a date, none of them is supported (schema1 images are not), or the registry fails to answer for a tag after answering for a preferred one. It fails when the registry fails for the first tag. + +[IMPORTANT] +==== +The date is set by the publisher when the image is built, not by the registry when the tag is pushed. An image built long before its release, such as a promoted or retagged one, looks older than it is and can pass a `minimum` age on its first day. A malicious image can also claim any date, so unlike the age filter for npm or PyPI, it is not a protection against a compromised release. +==== [IMPORTANT] ==== diff --git a/content/en/docs/plugins/resource/gitcommit.adoc b/content/en/docs/plugins/resource/gitcommit.adoc index 7c48b2c0f..eed12c087 100644 --- a/content/en/docs/plugins/resource/gitcommit.adoc +++ b/content/en/docs/plugins/resource/gitcommit.adoc @@ -1,15 +1,13 @@ --- title: "Git Commit" -description: "Retrieve the latest commit hash of a Git branch, or check that a commit exists" +description: "Retrieve the latest commit hash from a Git branch" lead: "kind: gitcommit" -date: 2026-07-29T10:00:00+02:00 -lastmod: 2026-07-29T10:00:00+02:00 +date: 2026-07-16T09:30:00+07:00 draft: false images: [] menu: docs: parent: "plugin-resource" -weight: 110 toc: true plugins: - source @@ -23,91 +21,45 @@ plugins: [cols="1^,1^,1^",options=header] |=== | source | condition | target -| ✔ | ✔ | ✗ +| ✔ | ✔ | ✘ |=== -== Description +The Git Commit "source" returns the latest commit hash referenced by a Git branch. -The `gitcommit` resource works with commit hashes rather than versions (useful for pinning an action, a submodule, or a base image to an exact commit instead of a moving branch). +The Git Commit "condition" checks that a commit exists in a repository. +The commit hash defaults to the source output and can be overridden with `spec.hash`. +Abbreviated hashes are supported. -**source**:: -Returns the latest commit hash of `branch`, or of the repository's current `HEAD` when `branch` is unset. +The target stage is not supported because commit hashes are immutable values. -**condition**:: -Checks that a commit exists in the repository (`hash` when set, otherwise the source output). +== Repository selection -**target**:: -Not supported - a target fails with `target not supported for the Git Commit resource`. Updatecli commits through an link:/docs/core/scm/[scm], not through this resource. +Both the source and the condition select a repository in the following order: -NOTE: This resource is newer than the JSON schema bundled with the website, so the parameter table below may be empty until the schema is regenerated. The parameters are listed in full underneath. +. The repository configured by `spec.url` is cloned. +. Otherwise, `spec.path` selects an existing local repository. +. Otherwise, the working directory from `scmid` is used. + +When `spec.branch` is omitted, the current `HEAD` commit is returned. +When it is set, Updatecli resolves the local branch first and then its `origin` remote-tracking branch. +The lookup does not check out the branch or modify the working tree. == Parameters {{< resourceparameters "sources" "gitcommit" >}} -[cols="1,3",options=header] -|=== -| Name | Description -| `url` | The repository to clone, e.g. `git@github.com:updatecli/updatecli.git` or `https://github.com/updatecli/updatecli.git`. -| `path` | A local repository path to read instead of cloning. -| `branch` | Source only. The branch whose latest commit is returned. Defaults to the repository's current `HEAD`. -| `hash` | Condition only. The commit being checked. Defaults to the source output. -| `depth` | Limits how many commits are fetched. `0`, the default, means no limit. -| `username` / `password` | Credentials for the HTTP protocol. -|=== - -== Choosing the repository - -Three things can say where the repository is, and they override each other in a fixed order, `url`, then `path`, then the `scmid`: - -[cols="1,3",options=header] -|=== -| Set | Result -| `url` | The repository is cloned, **overriding both `path` and any attached scm**. -| `path` | That local directory is used, overriding the attached scm. -| neither | The working directory of the `scmid`. -|=== - -Setting `url` or `path` alongside an `scmid` is allowed but logs a warning naming what was overridden, for example `URL setting value "..." is overriding the scm configuration (value "...")`. - -With none of the three, the run fails with a message that lists the options: - -[source,text] ----- -unknown Git working directory. Did you specify one of `spec.URL`, `scmid` or `spec.path`? ----- - -[WARNING] +[NOTE] ==== -`depth` is a shallow clone. A commit older than the fetched history is simply not there, so a condition can report a perfectly real commit as missing. Leave `depth` unset when checking a hash that may be old. +YAML parses an unquoted all-digit value as a number. +Quote `spec.hash` when the commit hash only contains digits. ==== == Example -Pin a dependency to the exact commit currently at the tip of `main`: +The following manifest shows SCM, URL, and local-path inputs. [source,yaml] ---- -sources: - latestCommit: - name: Get the latest commit of updatecli/updatecli - kind: gitcommit - spec: - url: https://github.com/updatecli/updatecli.git - branch: main - -targets: - pin: - name: Pin the action to that commit - kind: file - sourceid: latestCommit - spec: - file: .github/workflows/updatecli.yaml - matchpattern: 'updatecli/updatecli-action@([0-9a-f]{40})' - replacepattern: 'updatecli/updatecli-action@{{ source "latestCommit" }}' +# updatecli.yaml +{{}} ---- - -== Links - -* link:/docs/plugins/resource/gitbranch/[The `gitbranch` resource] - to find a branch name -* link:/docs/plugins/resource/gittag/[The `gittag` resource] - to find a tag From 382d667d09f61372fe9e182c0943dfaeef01e75e Mon Sep 17 00:00:00 2001 From: Giovanni Toraldo Date: Thu, 26 Nov 2026 12:22:50 +0100 Subject: [PATCH 3/3] chore: restore gitcommit.adoc --- .../en/docs/plugins/resource/gitcommit.adoc | 94 ++++++++++++++----- 1 file changed, 71 insertions(+), 23 deletions(-) diff --git a/content/en/docs/plugins/resource/gitcommit.adoc b/content/en/docs/plugins/resource/gitcommit.adoc index eed12c087..7c48b2c0f 100644 --- a/content/en/docs/plugins/resource/gitcommit.adoc +++ b/content/en/docs/plugins/resource/gitcommit.adoc @@ -1,13 +1,15 @@ --- title: "Git Commit" -description: "Retrieve the latest commit hash from a Git branch" +description: "Retrieve the latest commit hash of a Git branch, or check that a commit exists" lead: "kind: gitcommit" -date: 2026-07-16T09:30:00+07:00 +date: 2026-07-29T10:00:00+02:00 +lastmod: 2026-07-29T10:00:00+02:00 draft: false images: [] menu: docs: parent: "plugin-resource" +weight: 110 toc: true plugins: - source @@ -21,45 +23,91 @@ plugins: [cols="1^,1^,1^",options=header] |=== | source | condition | target -| ✔ | ✔ | ✘ +| ✔ | ✔ | ✗ |=== -The Git Commit "source" returns the latest commit hash referenced by a Git branch. +== Description -The Git Commit "condition" checks that a commit exists in a repository. -The commit hash defaults to the source output and can be overridden with `spec.hash`. -Abbreviated hashes are supported. +The `gitcommit` resource works with commit hashes rather than versions (useful for pinning an action, a submodule, or a base image to an exact commit instead of a moving branch). -The target stage is not supported because commit hashes are immutable values. +**source**:: +Returns the latest commit hash of `branch`, or of the repository's current `HEAD` when `branch` is unset. -== Repository selection +**condition**:: +Checks that a commit exists in the repository (`hash` when set, otherwise the source output). -Both the source and the condition select a repository in the following order: +**target**:: +Not supported - a target fails with `target not supported for the Git Commit resource`. Updatecli commits through an link:/docs/core/scm/[scm], not through this resource. -. The repository configured by `spec.url` is cloned. -. Otherwise, `spec.path` selects an existing local repository. -. Otherwise, the working directory from `scmid` is used. - -When `spec.branch` is omitted, the current `HEAD` commit is returned. -When it is set, Updatecli resolves the local branch first and then its `origin` remote-tracking branch. -The lookup does not check out the branch or modify the working tree. +NOTE: This resource is newer than the JSON schema bundled with the website, so the parameter table below may be empty until the schema is regenerated. The parameters are listed in full underneath. == Parameters {{< resourceparameters "sources" "gitcommit" >}} -[NOTE] +[cols="1,3",options=header] +|=== +| Name | Description +| `url` | The repository to clone, e.g. `git@github.com:updatecli/updatecli.git` or `https://github.com/updatecli/updatecli.git`. +| `path` | A local repository path to read instead of cloning. +| `branch` | Source only. The branch whose latest commit is returned. Defaults to the repository's current `HEAD`. +| `hash` | Condition only. The commit being checked. Defaults to the source output. +| `depth` | Limits how many commits are fetched. `0`, the default, means no limit. +| `username` / `password` | Credentials for the HTTP protocol. +|=== + +== Choosing the repository + +Three things can say where the repository is, and they override each other in a fixed order, `url`, then `path`, then the `scmid`: + +[cols="1,3",options=header] +|=== +| Set | Result +| `url` | The repository is cloned, **overriding both `path` and any attached scm**. +| `path` | That local directory is used, overriding the attached scm. +| neither | The working directory of the `scmid`. +|=== + +Setting `url` or `path` alongside an `scmid` is allowed but logs a warning naming what was overridden, for example `URL setting value "..." is overriding the scm configuration (value "...")`. + +With none of the three, the run fails with a message that lists the options: + +[source,text] +---- +unknown Git working directory. Did you specify one of `spec.URL`, `scmid` or `spec.path`? +---- + +[WARNING] ==== -YAML parses an unquoted all-digit value as a number. -Quote `spec.hash` when the commit hash only contains digits. +`depth` is a shallow clone. A commit older than the fetched history is simply not there, so a condition can report a perfectly real commit as missing. Leave `depth` unset when checking a hash that may be old. ==== == Example -The following manifest shows SCM, URL, and local-path inputs. +Pin a dependency to the exact commit currently at the tip of `main`: [source,yaml] ---- -# updatecli.yaml -{{}} +sources: + latestCommit: + name: Get the latest commit of updatecli/updatecli + kind: gitcommit + spec: + url: https://github.com/updatecli/updatecli.git + branch: main + +targets: + pin: + name: Pin the action to that commit + kind: file + sourceid: latestCommit + spec: + file: .github/workflows/updatecli.yaml + matchpattern: 'updatecli/updatecli-action@([0-9a-f]{40})' + replacepattern: 'updatecli/updatecli-action@{{ source "latestCommit" }}' ---- + +== Links + +* link:/docs/plugins/resource/gitbranch/[The `gitbranch` resource] - to find a branch name +* link:/docs/plugins/resource/gittag/[The `gittag` resource] - to find a tag