0
votes

I am looking for a Batch or PowerShell script to download the latest artifacts from Jfrog Artifactory repository.

I have written following shell scripts which works absolutely fine on a Linux machine.

Script:

ArtifactUrl=`curl -u **artifactoryusername**:**artifactorypassword** --silent      https://artifactorydomain/artifactory/api/storage/repositoryname/?lastModified | grep uri | awk '{ print $3 }' | sed s/\"//g | sed s/,//g`

echo $ArtifactUrl

downloadartifactUrl=`curl -u **artifactoryusername**:**artifactorypassword** --silent $ArtifactUrl| grep downloadUri | awk '{ print $3 }' | sed s/\"//g | sed s/,//g`

echo $downloadartifactUrl

curl -u **artifactoryusername**:**artifactorypassword**  -O $downloadartifactUrl

echo "Downloading Latest Artifact"

But now we got a new requirement to download the artifacts on a Windows agent and we can't install CURL over there. So we need to either use Batch or PowerShell to download the artifacts.

Please let me know if you have got any sample scripts.

1
Did you consider using the JFrog CLI? - Dror Bereznitsky

1 Answers

0
votes

you can create 2 jobs for that :

main job will run on windows and trigger the download job that will run on linux and archive the relevant artifact. once it done the main windows job will continue and copy the required artifact from the linux job.