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

Agents environment variables #3311

Open
3 tasks done
biolds opened this issue Feb 1, 2024 · 2 comments
Open
3 tasks done

Agents environment variables #3311

biolds opened this issue Feb 1, 2024 · 2 comments
Labels
agent enhancement improve existing features

Comments

@biolds
Copy link

biolds commented Feb 1, 2024

Hello,

I'm trying to set per agent environment variables but could not find a way to do it. I want to use them to set ip addresses to access external resources that varies by agent.
So far, I have tried without success:

  • passing --env=WOODPECKER_ENV_FILE=/etc/drone.conf to docker, like it was done with Drone
  • passing --env=WOODPECKER_ENVIRONMENT=extern_ip:1.2.3.4, but this one is server only it seems
  • passing --env=WOODPECKER_HOSTNAME=my_agent, this variable is supported by Woodpecker, but it seems like it's not available from the pipelines

Did I miss a way to pass agent specific data to the steps, or a way to identify which worker is running the test ?

Thanks for your effort on this great software!

Suggested solution

Support one of the three way I tried.

Alternative

No response

Additional context

No response

Validations

  • Checked that the feature isn't part of the next version already [https://woodpecker-ci.org/faq#which-version-of-woodpecker-should-i-use]
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
@biolds biolds added the feature add new functionality label Feb 1, 2024
@qwerty287 qwerty287 added agent enhancement improve existing features and removed feature add new functionality labels Feb 1, 2024
@silverwind
Copy link
Contributor

silverwind commented Jun 6, 2024

It's not implemented yet it seems. My proposal from #3762 is:

Support a option WOODPECKER_AGENT_ENV_FILE that works like DRONE_RUNNER_ENV_FILE which can be mounted into the agent which would make the environment variables available to all pipelines.

Alternatively, it could possibly done in the agent config ui too.

@zc-devs
Copy link
Contributor

zc-devs commented Jun 6, 2024

it could possibly done in the agent config ui too

Sounds similar to #3723, but for/per Agent.


Two approaches can be implemented at the same time:

  1. UI for global, agent, org, repo envs.
  2. Env file:
    2.1 Server's env file for global envs,
    2.2 Agent's env file for Agent's envs,
    2.3 Env file in the repo or special pipeline syntax for repo's envs,
    2.4 Seems, organization envs cannot be implemented that way.

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

No branches or pull requests

4 participants