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

[Bug] Environment variable in action-build #41

Open
talregev opened this issue Jul 25, 2022 · 4 comments
Open

[Bug] Environment variable in action-build #41

talregev opened this issue Jul 25, 2022 · 4 comments

Comments

@talregev
Copy link

talregev commented Jul 25, 2022

Environment variable in action-build.
I want to be able to pass environment variable that I define in workflow. like secrets or other environment variable that define in:

env:
 ENV1: value1

jobs:
  create-snap:
    name: Create snap
    runs-on: ubuntu-latest
    steps:
      - name: Checkout source
        uses: actions/checkout@v3
      - name: Build snap
        uses: snapcore/action-build@v1
        env:
           ENV2: value2

I want to be able to access both envs.

Currently I cannot do it. It not take these envs.
Can you make it happen?

@sergiusens
Copy link
Collaborator

the env will apply to the runner, but snapcraft creates its own container depending on the base to execute the parts lifecycle

@talregev
Copy link
Author

talregev commented Aug 5, 2022

How I can insert the environment variable inside?

@talregev
Copy link
Author

@jhenstridge
Copy link
Collaborator

This is more of a Snapcraft problem that an issue with the action itself. Snapcraft aims to run the build in a controlled environment, so it doesn't pass through environment variables to the build (which might not make sense within the container anyway).

With that said, you're free to do whatever you want in your workflow between calling actions/checkout and snapcore/action-build. You could modify the snapcraft.yaml file to edit in your secret. Or you could write it to a file (that will be exposed to the container along with the rest of your project), and check for it there.

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

3 participants