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

How to use environment variables in script #25

Open
iamface opened this issue Apr 20, 2020 · 1 comment
Open

How to use environment variables in script #25

iamface opened this issue Apr 20, 2020 · 1 comment

Comments

@iamface
Copy link

iamface commented Apr 20, 2020

I'm having issues utilizing the script area and using an environment variable within. I'm trying to use my TARGET variable which I have set and using for this plugin. I would also like to use it in a script after the rsync is complete.

image: drillster/drone-rsync
    environment:
      RSYNC_KEY:
        from_secret: key
      RSYNC_USER:
        from_secret: user
      TARGET:
        from_secret: target
    settings:
      hosts:
        from_secret: host
      source: artifact.tar.gz
      target:
        from_secret: target
      script:
        - cd $${TARGET}
        - ls -al

This does not change directories, but simply runs ls -al at the root. Am I using the variable incorrectly?

@mjwwit
Copy link
Collaborator

mjwwit commented Apr 21, 2020

The script part of the plugin runs on a remote host. Therefore it doesn't share the environment of the build. I'm trying to think of a way to do this, but I'm coming up blank so far...
I think something has to be built for this to work, somehow passing a number of environment variables to the remote host.

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