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

CI_WORKSPACE variable doesn't work with string substitution #3982

Open
2 of 3 tasks
june128 opened this issue Jul 26, 2024 · 4 comments
Open
2 of 3 tasks

CI_WORKSPACE variable doesn't work with string substitution #3982

june128 opened this issue Jul 26, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@june128
Copy link

june128 commented Jul 26, 2024

Component

server, agent

Describe the bug

Using the CI_WORKSPACE variable using string substitution in an entrypoint doesn't work. Other variables like e.g. CI do work.

Steps to reproduce

  1. Define a workflow containing the following steps:
    - name: test-1
      image: debian
      entrypoint:
        - /bin/bash
        - -c
        - echo hello${CI}
    - name: test-2
      image: debian
      entrypoint:
        - /bin/bash
        - -c
        - echo hello${CI_WORKSPACE}
  2. Run the workflow
  3. Observe the output in the Web interface

Expected behavior

The output being:

  • for test-1: hellowoodpecker
  • for test-2: hello<FULLWORKSPACEPATH>

What's actually being output:

  • for test-1: hellowoodpecker
  • for test-2: hello

System Info

{"source":"https://github.com/woodpecker-ci/woodpecker","version":"2.7.0"}

Additional context

Woodpecker running on NixOS. Config available here.

Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Checked that the bug isn't fixed in the next version already [https://woodpecker-ci.org/faq#which-version-of-woodpecker-should-i-use]
@june128 june128 added the bug Something isn't working label Jul 26, 2024
@june128
Copy link
Author

june128 commented Jul 26, 2024

Okay, tested a bit more andCI_WORKSPACE just doesn't work with string substitution it seems.
Having the following commands in a CI step:

- echo "hi $CI_WORKSPACE $CI"
- echo "hi ${CI_WORKSPACE} ${CI}"

results in the following output:

+ echo "hi $CI_WORKSPACE $CI"
hi /base/src woodpecker
+ echo "hi  woodpecker"
hi  woodpecker

@june128 june128 changed the title CI_WORKSPACE variable doesn't work with string substitution in entrypoint CI_WORKSPACE variable doesn't work with string substitution Jul 26, 2024
@6543
Copy link
Member

6543 commented Jul 26, 2024

Ah ... yes there are different env variables, some are already available while parsing, others on runntime.

Rather than a bug we should update the docs ...

@zc-devs
Copy link
Contributor

zc-devs commented Jul 26, 2024

#3983 (comment)

@june128
Copy link
Author

june128 commented Jul 26, 2024

@6543 Ye fair enough. I guess as with #3983 updating the docs would be a good idea and having this issue be considered a feature request then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants