Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variables from remote includes not populated after 4.56.0 #1467

Closed
xurizaemon opened this issue Jan 12, 2025 · 3 comments
Closed

Variables from remote includes not populated after 4.56.0 #1467

xurizaemon opened this issue Jan 12, 2025 · 3 comments

Comments

@xurizaemon
Copy link

xurizaemon commented Jan 12, 2025

Minimal .gitlab-ci.yml illustrating the issue

Sorry, not sure I can provide a minimal .gitlab-ci.yml, but I can provide steps to reproduce! This includes a git repo you can repro with ... due to the use of remote includes and Drupal gitlab_templates repo repo, it's not minimal!

Here's a quick test process :)

  1. Clone a Drupal contrib module with Gitlab CI configuration (and by the way: thanks so much for this amazing tool, which the Drupal community is using more and more)
  2. Use gitlab-ci-local with support for Drupal's Gitlab CI configuration (docs)

Process to reproduce as above

cd /tmp
git clone [email protected]:project/menu_breadcrumb.git
cd menu_breadcrumb 

gitlab-ci-local --remote-variables [email protected]:project/gitlab_templates=includes/include.drupalci.variables.yml=main --variable="_GITLAB_TEMPLATES_REPO=project/gitlab_templates"

With v4.55.0, the above step will run the CI pipeline as expected.

With v4.56.0, the above steps will fail as the environment variables for the default container are not present. Instead of the pipeline, we will see: Error: Command failed with exit code 1: docker pull drupalci/php--:. The correct image reference generated correctly should be eg drupalci/php-8.3-ubuntu-apache:production (depending on module configuration), and v4.55.0 does this as expected.

$ gitlab-ci-local --remote-variables [email protected]:project/gitlab_templates=includes/include.drupalci.variables.yml=main --variable="_GITLAB_TEMPLATES_REPO=project/gitlab_templates"
parsing and downloads finished in 5.24 s.
json schema validated in 466 ms
deprecation - composer                   starting drupalci/php--: (.pre)
Error: Command failed with exit code 1: docker pull drupalci/php--:
invalid reference format
    at makeError (/snapshot/firecow-gitlab-ci-local/node_modules/execa/lib/error.js:60:11)
    at <anonymous> (/snapshot/firecow-gitlab-ci-local/node_modules/execa/index.js:118:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async i (/snapshot/firecow-gitlab-ci-local/src/job.ts:1003:13)
    at async Ut.pullImage (/snapshot/firecow-gitlab-ci-local/src/job.ts:1016:13)
    at async Ut.start (/snapshot/firecow-gitlab-ci-local/src/job.ts:531:13)
    at async <anonymous> (/snapshot/firecow-gitlab-ci-local/node_modules/p-map/index.js:57:22)

Expected behavior

Pipeline executes

Host information

Ubuntu
gitlab-ci-local 4.55.0, 4.56.0

Containerd binary

Docker

Additional context

I see some issues which may be related, including a PR, but I'm not sure if that's the one.

Possibly that PR fixes the issue, but I am not able to tell if it's the same issue or fix based on the PR description, so I thought best to provide steps to reproduce.

This has been observed by other Drupal folks on (presumably) other Drupal projects, eg this thread in Drupal Slack.

@ANGkeith
Copy link
Collaborator

ANGkeith commented Jan 12, 2025

This fix #1415 is probably why your stuff broke..

I am not sure why your ssh and https host have a different hostname,

image

Adding this should probably fix your issue

# https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes/include.drupalci.variables.yml?ref_type=heads#L287-290
      - if: $CI_SERVER_HOST == "git.drupal.org"

because internally, gcl uses the git remote -v to populate the CI_SERVER_HOST


it's not minimal!

indeed! 😅

@ANGkeith
Copy link
Collaborator

ANGkeith commented Jan 12, 2025

on a side note, i have never used --remote-variables (i'll need to read up a little), but it looks like you might not need it

@xurizaemon
Copy link
Author

xurizaemon commented Jan 13, 2025

Thanks, I was able to confirm that this proposed change fixes the issue.

Thanks @ANGkeith!

Related issue in Drupal: gitlab_templates#3499267.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants