Skip to content

Read the latest release version for the Docker image tag with the workflow token - #265

Merged
vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:ci-release-version-token
Oct 28, 2026
Merged

vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:ci-release-version-token

Conversation

@vharseko

Copy link
Copy Markdown
Member

Problem

The build-docker and build-docker-alpine jobs get the version for the image tag from an anonymous curl to api.github.com/repos/OpenIdentityPlatform/OpenIDM/releases/latest. In run 39763486259 of #264 the answer to build-docker had no "name". The step printed last release: and still passed, the tag came out empty, and build-push-action failed with tag is needed when pushing to registry. build-docker-alpine of the same run got 7.1.2.

The step does not log the answer. The likely cause is the rate limit for anonymous API calls, which the runner's IP shares with other jobs. Two more weaknesses hid the failure:

  • export var="$(...)" returns the status of export, so a failed call cannot fail the step;
  • an empty version passes the step, so the failure surfaces two steps later as a buildx error.

Fix

In both jobs the Get latest release version step:

  • calls the API through gh api ... --jq .name with GH_TOKEN: ${{ github.token }}. The jobs already have contents: read. An authenticated call has its own rate limit and does not share the runner's IP limit;
  • assigns the version without export, so a failed gh call fails the step through -e and logs its error;
  • fails with test -n when the version is empty.

Test

  • Locally gh api repos/OpenIdentityPlatform/OpenIDM/releases/latest --jq .name returns 7.1.2, the same value the old grep/cut gave.
  • In the run of this PR, both build-docker and build-docker-alpine must print last release: 7.1.2 and build the image.

…kflow token

An anonymous call to the releases API shares the rate limit of the
runner's IP with other jobs. In run 39763486259 the answer held no
"name", the version and the image tag came out empty, and
build-push-action failed with "tag is needed when pushing to
registry". Call the API through gh with GH_TOKEN, and fail the step
itself when the call fails or the version is empty.

@maximthomas maximthomas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

praise: The step now fails where the tag is lost, not two steps later in buildx.

  • git_version_last="$(gh api …)" has no export (.github/workflows/build.yml:355, :457). The step's -e therefore sees gh's exit status, and a failed call stops the step with gh's own error line.
  • test -n "$git_version_last" (:356, :458) stops an empty version before it reaches GITHUB_ENV.
  • Both jobs already hold contents: read (:323-324, :425-426), so GH_TOKEN: ${{ github.token }} reads the release without a new permission.

@maximthomas
maximthomas self-requested a review October 27, 2026 11:19

@maximthomas maximthomas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See the comment above

@vharseko
vharseko merged commit 2382dfd into OpenIdentityPlatform:master Oct 28, 2026
27 of 31 checks passed
@vharseko
vharseko deleted the ci-release-version-token branch October 28, 2026 08:35
vharseko added a commit that referenced this pull request Oct 28, 2026
… that its results no longer follow the default JDK of the runner image (#264)

Fixes #263

### Problem

The java-kotlin job of the CodeQL workflow runs with `build-mode: none`
and sets up no JDK. CodeQL infers no JDK from the project (`No specific
JDK inferred from the project being analysed; using the java on the
PATH`), so it models the JDK API on the default `java` of the runner
image. On 2026-10-19 `ubuntu-latest` moved from ubuntu-24.04 to
ubuntu-26.04, and that `java` changed from 17 to 25. Code scanning then
opened alerts for APIs deprecated only after Java 17, the version the
release is built with. The details are in #263.

### Fix

- Before `Initialize CodeQL`, the java-kotlin job sets up the JDK that
the release is built with, with the `actions/setup-java` parameters of
`release.yml`: temurin, 8 on `sustaining/6.3.x` and 17 otherwise. The
branch is taken from `github.base_ref` for a pull request and from
`github.ref_name` for a push.

The other languages do not use the step. The same change for OpenDJ is
OpenIdentityPlatform/OpenDJ#1232.

### Test

The change only takes effect in a CodeQL run, so the CodeQL run of this
PR is the test. The java-kotlin job log must show `Java version: 17...`
from `Eclipse Adoptium`, where master shows `Java version: 25.0.4.1`.

A pull request analysis only reports results on the changed lines, so it
cannot show the alerts going away. They are closed by the first analysis
of master after the merge.


### Also in this PR: the OpenDJ wait of the usecase smoke tests

The run of this PR failed all four `ui-smoke-tests (…,
samples/usecase/usecase1)` legs with `OpenDJ did not start`. The cause
has nothing to do with CodeQL. On 2026-10-21
`openidentityplatform/opendj:latest` moved to 5.2.0. Its `run.sh` no
longer logs `OpenDJ is started`, the line the `Start OpenDJ for usecase
samples` step waited for, although the server came up (`The Directory
Server has started successfully`). Every usecase run fails the same way
now, master included.

The step now waits up to 5 minutes for the health status `healthy` of
the container, the same check `build-docker` uses for the OpenIDM image.
In 5.2.0 `healthy` means the bootstrap is complete (the LDIF is imported
and the server is started again) and LDAPS answers. The 5 minutes match
the `--start-period` of the image's `HEALTHCHECK`.

Checked locally with `opendj:latest` (5.2.0) and the arguments of the
workflow: the wait ends on `healthy`, and a bind as `cn=Directory
Manager` on 1389 finds the 33 entries of `hr_data.ldif`.

The failed `build-docker` of the same run (an empty image tag from an
anonymous call to the releases API) is fixed separately in #265.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci CI/CD, build and release workflows docker

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants