drone-rsync icon indicating copy to clipboard operation
drone-rsync copied to clipboard

How to use environment variables in script

Open iamface opened this issue 4 years ago • 1 comments

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?

iamface avatar Apr 20 '20 23:04 iamface

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.

mjwwit avatar Apr 21 '20 09:04 mjwwit