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

Add variable for host absolute path #1468

Closed
atli-c opened this issue Jan 13, 2025 · 1 comment · Fixed by #1471
Closed

Add variable for host absolute path #1468

atli-c opened this issue Jan 13, 2025 · 1 comment · Fixed by #1471

Comments

@atli-c
Copy link
Collaborator

atli-c commented Jan 13, 2025

Is your feature request related to a problem? Please describe.
I need the absolute path to project directory as it is on the host OS (not as seen within container).

When developing I use containers that are bind-mounted which require absolute path to the source code. Deployment of those containers are run in a CI job with image: …. I.e. deployment is run in a container where CI_PROJECT_DIR points to /gcl-builds which is absolute path within the container, not on my machine (the host OS)

Describe the solution you'd like
A new variable with absolute path. Possible names:

  • HOST_CI_PROJECT_DIR
  • LOCAL_CI_PROJECT_DIR

Describe alternatives you've considered
Workaround:

job-supplying-full-path:
  # No image. "shell" executor
  script:
    - echo "LOCAL_WORKING_DIR=$PWD" | tee .full-path-on-host-os.env
  artifacts:
    reports:
      dotenv: .full-path-on-host-os.env
job-requiring-full-path:
  image: busybox  # Runs in container - "docker" executor
  needs:
    - job-supplying-full-path
  variables:
    LOCAL_PWD: $PWD  # This does not work. Empty value.
  script:
    - echo "Container '$CI_PROJECT_DIR'"
    - echo "Container '$PWD'"
    - echo "Variable workaround? '$LOCAL_PWD'"
    - echo "Variable via other job '$LOCAL_WORKING_DIR'"

Output from 'job-requiring-full-path':

Container '/gcl-builds'
Container '/gcl-builds'
Variable workaround? ''
Variable via other job '/home/example/src/project'

Additional context
If the value of new variable is problematic (information leak?) then maybe the variable could be opt-in to limit info-leak? Like with the @ annotation.

@firecow
Copy link
Owner

firecow commented Jan 13, 2025

This would be very useful, when deploying services locally to minikube what needs mounting

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

Successfully merging a pull request may close this issue.

2 participants