- Issue created by @fjgarlin
- 🇪🇸Spain fjgarlin
I introduced a new variable for this altogether instead of relying on CI_SERVER_URL.
The MR is ready for review. The downstream pipelines are running: https://git.drupalcode.org/project/gitlab_templates/-/pipelines/495616
Note that we don't have any external integration to run this on, but given that we are hardcoding the URL to the correct value, it should just work.
- 🇬🇧United Kingdom jonathan1055
This all looks good. Updated the IS with the actual new variable.
-
fjgarlin →
committed e42f0658 on main
Issue #3524073 by fjgarlin, heddn, jonathan1055: Fix CI_SERVER_URL usage...
-
fjgarlin →
committed e42f0658 on main
- 🇪🇸Spain fjgarlin
This was merged and a new tag was made, which is as well the new default-ref for all contrib.
Automatically closed - issue fixed for 2 weeks with no activity.
- 🇬🇧United Kingdom jonathan1055
@fjgarlin Please could you re-open this issue. Now that we have changed the
get-file-via-curl.shscript to use the new$DRUPALORG_CI_SERVER_URLthis variable should really be displayed in the log when there is a curl failure. I just tried to trigger manually a Composer job from a pipeline first run a week ago, and the new curl script failed. I think it was because the variable$DRUPALORG_CI_SERVER_URLdid not exist in Gitlab Templates then, but when downloading thegitlab_templates/scripts/get-file-via-curl.shit gets the latest version, which is using the new variable. See this job logI know it's an edge-case, and probably will not happen often, but it would be better to display all of the variables values used, then it is clearer to see what happened.
- 🇬🇧United Kingdom jonathan1055
jonathan1055 → changed the visibility of the branch main to hidden.
- Merge request !366#3524073 Show DRUPALORG_CI_SERVER_URL in message → (Merged) created by jonathan1055
- 🇬🇧United Kingdom jonathan1055
I've made the change, and doing some testing in GTD.
In the
d7-composerbranch the I set_CURL_TEMPLATES_REPO: ''which did not cause a problem in the composer job, because we re-calculate if it is blank. The build.env file has_CURL_TEMPLATES_REPO=issue/gitlab_templates-3524073 _CURL_TEMPLATES_REF=3524073-drupalorg-ci-server-url GITLAB_TEMPLATES_VERSION=3524073-drupalorg-ci-server-url (branch)which is what we expect. But the subsequent phpcs job fails, the value of
_CURL_TEMPLATES_REPOseems to have been lost when the script executes# REPO and REF need be non-blank to ensure that the curl will give an easily detectable return code. _CURL_TEMPLATES_REPO=${_CURL_TEMPLATES_REPO:-repo-is-blank} _CURL_TEMPLATES_REF=${_CURL_TEMPLATES_REF:-ref-is-blank}and we get the url with
https://git.drupalcode.org/repo-is-blank/at the start. This is problem 1, but more serious is the fact that the curl command still does not give a failed return code even when it fails. See this d7-composer phpcs log. The command is deemed to be a success and we don't get anything in$EXIT_CODEso there is no message when we'd like there to be one.Any ideas?
- 🇬🇧United Kingdom jonathan1055
In d10-theme the intended failure works, and we get the message with the updated output.
https://git.drupalcode.org/project/gitlab_templates_downstream/-/jobs/54...For error 1, where
$_CURL_TEMPLATES_REPObeing empty in the phpcs job even though the value is written tobuild.env, maybe this is due to the variable hierarchy? It could be that if the variable is defined in the custom .gitlab-ci.yml (or in this case the downstream 'trigger' job) then this takes precedence ov the value inbuild.env. If that is it, then it's fine.For error 2, I'm goint to try again without making the variable non-blank, to see if that effects the exit code.
- 🇪🇸Spain fjgarlin
Well, for problem 1, I'd say that we change the logic from
# REPO and REF need be non-blank to ensure that the curl will give an easily detectable return code. _CURL_TEMPLATES_REPO=${_CURL_TEMPLATES_REPO:-repo-is-blank} _CURL_TEMPLATES_REF=${_CURL_TEMPLATES_REF:-ref-is-blank}to
if [[ $_CURL_TEMPLATES_REPO == "" || $_CURL_TEMPLATES_REF == "" ]]; then echo "Error message goes here..." exit 1; fi - 🇪🇸Spain fjgarlin
And yeah, according to https://docs.gitlab.com/ci/variables/#cicd-variable-precedence, pipelines variables (3) have precedence over "dotenv" reports (7).
- 🇬🇧United Kingdom jonathan1055
Thanks for that suggestion, yes I think it is better to detect empty variables and fail directly, rather than try to let the curl fail. I've pushed a change, and set
EXIT_CODEand then the same exit block displays all the values. I used -1 so that we do not clash with any actual curl exit codes which are all positiveHere's the test in d7-composer which has the blank value
https://git.drupalcode.org/project/gitlab_templates_downstream/-/jobs/54...Ready for review.
- 🇪🇸Spain fjgarlin
The solution looks good.
I think it's ready for final clean up and RTBC. NW for now until the clean up happens.
- 🇬🇧United Kingdom jonathan1055
Debug and test lines removed, ready for final review.
This is actually a good improvement to check the variables for blank first, it makes it more reliable to fail if anything is empty. - 🇪🇸Spain fjgarlin
Agree. Easier to read and no need to make assumptions, just fail if not all inputs needed are present.
-
fjgarlin →
committed facc6003 on main authored by
jonathan1055 →
Issue #3524073 by jonathan1055, fjgarlin, heddn: Fix CI_SERVER_URL usage...
-
fjgarlin →
committed facc6003 on main authored by
jonathan1055 →
- 🇬🇧United Kingdom jonathan1055
Thanks. To verify, I have just re-run the 'next minor' job that I linked to in #10 and it now does exactly as intended. The output is clearer, and we can see that the problem was caused by
DRUPALORG_CI_SERVER_URLbeing empty.https://git.drupalcode.org/project/scheduler/-/jobs/5459742#L38
Automatically closed - issue fixed for 2 weeks with no activity.