hey guys, in the deployment pull step can I get th...
# ask-community
r
hey guys, in the deployment pull step can I get the access token from a prefect block to authenticate with gitlab? https://docs.prefect.io/2.10.18/concepts/deployments-ux/#the-pull-action:~:text=Below%20is%20an%20exa[…]requirements.txt%20file%20after%20cloning%3A
c
You can store it as a secret, I’d need to check if gitlab credentials are supported yet
r
Is secret the same as variable?
c
regarding your second question - that depends onwhat kind of infrastructure
yes
r
thanks for getting back to me btw
c
A secret is a block type
r
oh gotcha, I'll take a look
for the second question, what do you mean by it depends on kind of infra?
c
The short answer - previously, you could only load specifically prefect.block.secrets for the token, which was unintuitive if you had a gitlab credential or github credential
I think that was recently merged, but I don’t recall if that applied to all credential types
r
thanks I'll try it out
c
The docs should now show using credentials fields in lieu of secrets
r
oh very cool thank you
sorry @Christopher Boyd, one more question. Am I configuring this correctly in the pull step?
it's not working it's asking me to authenticate every time
however, if I did it myself with that access token, I'm able to clone my repo without issue, just doing it through prefect, it's not working. I think it's because it's not grabbing the credentials but not sure? Anyway I can see the url request it's sending to gitlab to see if it's correct?
c
If you could humor me and try as a secret instead of a credential:
Copy code
"{{ prefect.blocks.secret.<your secret here> }}"
r
will do thank you
c
the credentials issue was one I reported, and only pretty recently merged in - I haven’t actually had the chance to test myself using the credentials so I couldn’t verify
If it’s a still an issue I can follow up on it; one other note, is that different SCM’s have different token requirements; for example when I tested using bitbucket, I had to set my token to literally like:
x-token-auth:<token>
or
<user>:<token>
so that was quite literally stored in the secret
r
I'm getting this error after changing to secret
this is my pull step
what you suggested work, for gitlab it needs to be oauth2:<token>
i need to place that in the gitlab-credentials block
1
catjam 1
c
Hi I think i’m having a similar issue using version
2.11.0
. I’m able to get this to work using the
access_token
key but not
credentials
. Also, I can only get it to work using a secret block, not a gitlab-credentials block. Would you please confirm whether or not you’re seeing the same results? works:
Copy code
access_token: "{{ prefect.blocks.secret.gitlab-access-token }}"
doesn’t work:
Copy code
credentials: "{{ prefect.blocks.secret.gitlab-access-token }}"
credentials: "{{ prefect.blocks.gitlab-credentials.gitlab-credential }}"
c
Yo uneed to use a newer version
c
I was using version 2.11.0, which is the latest version right?
Copy code
prefect --version
08:33:04.337 | DEBUG   | prefect.profiles - Using profile 'dev'
2.11.0
c
Ah I missed that , for some reason I mistook what you posted - let me look closer
c
thank you!
e
Hi - I'm getting similar issue with git_clone and using gitlab credentials block. Tried both 2.11.0 and 2.11.1 version. It's also tricky to debug as it only returns an exit code which is generic. if we can log more details on error it would be much more easier. This is my flow run if that helps https://app.prefect.cloud/account/f6a834fb-85a2-4b18-9a99-21b9e534559f/workspace/2e7c[…]e0c1/flow-runs/flow-run/a4910da7-2db4-41c6-a1d2-774c50bd0fbb
@Christopher Boyd I've figured it out - for gitlab the token needs to be prefixed with
oauth2:
. Ronald has pointed this out above. Would help someone if we can add this info to doco
j
"oauth2:" works for me. Thanks @Chris Bui