Until now, I have always been working with public repositories, where everything is smooth and easy. However, I would like to now switch to private repos.
I saw this answer related to github repos. Unfortunately, it seems like it doesn't work the same for gitlab. In particular, the ?access_token=${settings.accessToken}
does not seem to be recognized well by gitlab.
How should I proceed with my gitlab access token? What I was able to figure out until now (but I find this a little bit crap), is that I should replace
baseUrl: https://www.my-gitlab.com/my-company/my-project/my-repo/-/raw/master
onInstall:
- cmd:
- curl -fsSL ${baseUrl}/my-folder/my-script.sh | /bin/sh
- wget ${baseUrl}/my-folder/my-script.sh -O my-script.sh
with
globals:
GITLAB_API_URL: http://www.my-gitlab.com/api/v4/projects/my-project-id/repository/files
onInstall:
- cmd:
- curl -H "PRIVATE-TOKEN: ${settings.accessToken}" -fsSL ${globals.GITLAB_API_URL}/my-folder%2Fmy-script.sh/raw?ref=master | /bin/sh
- wget --header="PRIVATE-TOKEN: ${settings.accessToken}" ${globals.GITLAB_API_URL}/my-folder%2Fmy-script.sh/raw?ref=master -O my-script.sh
But I find the above replacement a bit complicated. I'm pretty sure there must be something equivalent to what is done with github on gitlab. Also, the above replacement does not quite work. For example, the call
curl -H "PRIVATE-TOKEN: ${settings.accessToken}" -fsSL ${globals.GITLAB_API_URL}/my-folder%2Fmy-script.sh/raw?ref=master | /bin/sh
with ${settings.accessToken}
and ${globals.GITLAB_API_URL}
replaced with the relevant values, works fine on my development PC; however, when that command runs on jelastic, I get the error
/bin/bash: line 1: {curl -H \"PRIVATE-TOKEN:<my-token>\" -fsSL http://www.my-gitlab.com/api/v4/projects/my-project-id/repository/files/my-folder/my-script.sh/raw?ref=master | /bin/sh}: No such file or directory","nodeid":63261,"exitStatus":127,"out":""}
I have no clue why that does not work and I guess using the gitlab api is not the right way to get my stuff done with curl
and wget
. Also, I have no clue how to get stuff like this working:
onInstall:
install:
jps: ${baseUrl}/jelastic/tools.jps?access_token=${settings.accessToken}
Can someone help?