Closed asaf closed 7 years ago
@asaf Please check you have permission to create folder.
@appleboy yea i do, I can sftp using the same credentials and create folders.
Apologies, I had one missing level folder in the tree,
Now I see:
drone-scp error: ssh: unexpected packet in response to channel open: <nil>
ssh: unexpected packet in response to channel open: <nil>
Can you try another server out? I can't reproduce this error on my machine.
It seems like my ssh server sometimes return connection reset due to some mixture between pass/key auths, not sure, seems like it has nothing to do with this plugin :-)
Unrelated to this issue, before I close it, I was wondering,
The artifact created by our 'Makefile' is always static name, while I'd like to publish an artifact with a name such as app_TAG
Is that possible? I can't see a way to rename the source file,
Thanks for the quick responses :-)
@asaf
You can user GIT tag on Makefile. Try ${DRONE_TAG}
variable. Find all variables on http://readme.drone.io/usage/environment-reference/
@appleboy yea that will work too, i was wondering if I can just do target/newFileName (but it seems that target is just the folder name)
Maybe it makes more sense to let the artifact generate step to take care of the name instead of making the transfer plugin rename the file.
Thanks @appleboy :-)
great work btw,
@asaf You can try drone-ssh plugin https://github.com/appleboy/drone-ssh. What is your scenario? Why did you need to change the file name?
There are two options to publish artifacts with tag name.
DRONE_TAG
to the final artifactso that's fine, i'll modify the Makefile to generate the correct artifact name with TAG postfix and make the SCP plugin just send it as is.
Thanks
@appleboy back to this, looking at the makefile of this project, $VERSION is a dynamic calculated makefile variable which may contain tag
or commit id
,
I was wondering if it's possible to somehow make the SCP plugin aware of this variable in order to push the generated file via SCP,
Thanks.
@asaf
You can try the following example:
pipeline:
+ clone:
+ image: plugins/git
+ tags: true
scp_staging:
image: appleboy/drone-scp
pull: true
host: xxxx
port: xxx
username: xxxx
target: /home/deploy/drone/${DRONE_TAG}
source:
- release.tar.gz
when:
branch: master
status: [ success ]
if you push tag, the ${DRONE_TAG} will be the v1.0
format.
if you push the commit, the ${DRONE_TAG} will be the {latest_tag}_{number_of_previous_tag}_{commit_id}
I added this step to the pipeline, DRONE_TAG doesn't exist
@asaf My apologies. You can refer to Makefile of Gorush project. https://github.com/appleboy/gorush/blob/master/Makefile#L22-L26
Thanks.
@appleboy That's what I've meant, lets say you do have a Makefile that calculates the version,
How do I make the SCP plugin aware of this 'VERSION' variable available in the Makefile?
I tried to export the VERSION from Makefile and access it in the .drone.yml file as ${VERSION} but it doesn't work.
Thanks.
One way is creating multiple tasks as following:
scp_tag:
.....
target: /home/deploy/drone/${DRONE_TAG}
source:
- release.tar.gz
when:
event: [ tag ]
status: [ success ]
scp_master:
.....
target: /home/deploy/drone/${DRONE_BRANCH}-${DRONE_COMMIT_SHA:0:7}
source:
- release.tar.gz
when:
branch: master
status: [ success ]
Another way is implementing this feature to support VERSION
variable but you need to tell me what format of VERSION
variable clearly.
@appleboy yea that will work, I don't think we should make the SCP plugin aware of a specific versioning template,
I'll try to talk with Drone folks, maybe there is a way to read exported variables from Makefile,
Does it make sense to support wildcards in this SCP plugin in source field?
such as release*.tar.gz
? that would just pick up any file that matches the criteria,
Thanks
@asaf
I create another issue to track wildcards feature
. I think we should close this issue.
Thanks.
@appleboy yes indeed, closing, thanks!
Hey,
I'm trying to use this plugin but I get:
I guess it fails to create the folder, any clue?
Thanks