keycloak / keycloak-quickstarts

Apache License 2.0
1.94k stars 972 forks source link

GH action builds in custom tags or in 'latest' branch always use nightly builds #512

Open mposolda opened 10 months ago

mposolda commented 10 months ago

Describe the bug

For example when looking at the quickstart tag for 22.0.5 [1] and corresponding build [2], I can see that in Get Keycloak step, it mentions:

Downloading nightly Keycloak release

This is not correct as the tag should use Keycloak 22.0.5 tag instead of the nightly Keycloak release. Same issue exists for example for latest branch. Only main branch should use nightly Keycloak release.

[1] https://github.com/keycloak/keycloak-quickstarts/tree/22.0.5 [2] https://github.com/keycloak/keycloak-quickstarts/actions/runs/6625526057/job/17996668081

Cause

It looks there are some mistakes in prepare-local-server.sh and run-tests.sh scripts. Namely in checks like this:

if [[ ( -n "$GITHUB_BASE_REF" &&  "$GITHUB_BASE_REF" == "latest" ) ]] || [[ ( -n "$QUICKSTART_BRANCH" && "$QUICKSTART_BRANCH" != "main" ) ]]; then
 ... do something here ...

When running the GH actions build, The QUICKSTART_BRANCH is not set. And the variable GITHUB_BASE_REF is set only when running the PR build (According to [3]). When running the manually triggered build (or nightly build) with latest branch, it doesn't work as GITHUB_BASE_REF is not set. Also it doesn't work with any tag builds.

[3] https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables

Version

22.0.5

Expected behavior

The non-PR builds triggered on latest branch or on tags should use proper Keycloak server version instead of the "nightly". Should be fixed in both prepare-local-server.sh and run-tests.sh.

Actual behavior

GH actions are always using nightly Keycloak build. Only exception is when someone send PR against latest branch (which people should not do anyway).

How to Reproduce?

No response

Anything else?

No response

mposolda commented 10 months ago

Adding to 24 for now. Will be nice if we fix it, but strictly a blocker.