You can call it before calling Task.init
as it's a class method and configures the local session
Hi CleanPigeon16 ,
I'm not sure I follow what you mean.
and then creating credentials for each one will show them as the user
How exactly?
Depending on how you set up Trains Server, you can create user identities either by:
Using a "flexible" user mode in which your user identity is determined by the name you provide when logging into the UI (i.e. when you do not configure apiserver.conf
) Using a "fixed" users list you define in the apiserver.conf
file (in which you provide a display name, a user name and a password for each user identity)Regardless of how you created your user identity, you will need to go to your profile page in the UI, and obtain a set of credentials with which you can configure your Trains Python package (using trains init
or by editing trains.conf
) - unless you do that, when Trains runs it can't know which user you're supposed to be...
What exactly were you thinking of?
I was thinking about sending the parameters programatically. We have different pipelines that can generate tasks, I would like to be able to tell trains the user who started the pipeline.
Sending programmatically how? You mean inside your pipeline script?
Yes, use TRAINS_API_ACCESS_KEY
and TRAINS_API_SECRET_KEY
Well... assuming you could have used the username and password - that would mean you have those hard coded in scripts or files somewhere, and unlike the credentials you generate - they can't be revoked and re-generated in case something is wrong...
legit, I was thinking only about task tracking, less about user based credentials. good point
Well, that's possible - take a look at Task.set_credentials()
🙂
That's not really recommended, security-wise
what about using ENV variables? is it possible to override the config file's credentials?
ok, hopefully last question on this subject 🙂
I want to use Jenkins for some pipelines. What I would like to do is have one set of credentials saved on Jenkins. Then whenever a user triggers a pipeline - this is the user that will be marked as the task's user.
If I understand the options you suggested, I'll currently need either to (1) have some mapping between users and their credentials and have all the credentials saved on Jenkins; or, (2) have each user manually add 2 environment variables for as parameters to the pipeline.
Am I missing something? Are those the possible solutions?
cool! just to verify - I'll still need to have the credentials created in the server, right?