0

I'm writing some ansible code to update a project from gitlab so I need to first check if the host computer and the version I'm trying to install are different from one another. I find the version on Gitlab from the file at

https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/master/download?job=test

using the uri module in ansible. The file downloaded has the version number in its name. "CompanyName-VersionNumber.zip"

But this has the effect of downloading the file as well. I want to be able to check what file would be downloaded before actually downloading it so I can do a version check.

This code will be run on both windows and linux machines, so if possible something that works on both would be preferred.

George Menoutis
  • 6,894
  • 3
  • 19
  • 43
  • 1
    I think you have 1 problem there, you will have the URL stored in a variable, full URL containing the file name? Or you will point to an URL without specifying the file name, for example, you will point to www.whatever.com/filename_1.0 or you will point to www.whatever.com/filename and that last URL will download the last version of the file? Because if that's the case the approach will be different. – ikora Jan 14 '21 at 08:06
  • 1
    If I've understood you correctly, the job=test part does not contain my version number. For example, test could be "linux-x64" but the downloaded file is named "stackoverflow-1.0.0". So there is no way to get the version number from the url itself. It needs to be the file at the url. – Sancho Jimenez Jan 14 '21 at 08:22

0 Answers0