I have a set of automated tests that are ran in a jenkins pipeline, testcode is located in gitlab. The section where I pull code from gitlab looks like this:
I use gitlab credentials that were already present there (since other project use the same gitlab credentials).
I use a simple jenkinsfile that is located in the test codebase to run the script from here. This is roughly how it looks:
agent {
kubernetes {
defaultContainer 'jnlp'
yaml """
apiVersion: v1
kind: Pod
metadata:
labels:
application: auto_ish
spec:
containers:
- name: node
image: node:12.14.1
command:
- cat
tty: true
"""
}
}
stages {
stage('Build') {
steps {
container('node') {
sh '''
npm install
'''
}
}
}
stage('Test') {
steps {
container('node') {
sh 'node_modules/.bin/wdio ./test/config/wdio.conf.acc.js --suite SmokeTest --mochaOpts.grep=@smoke'
}
}
}
My problem:
The codebase of my automated tests has recently been moved to github, and I have trouble getting it to work in jenkins. For github I have a personal access token that I need to use, so no private key like I had for gitlab. I have tried adding this token to the credentials manager, but after adding it doesnt show up in the dropdown.
I followed some walkthroughs that told me to install github plugins for jenkins and then set my personal access token in jenkins configuration like this:
I tested the connection,and it worked.
From here on, I have no idea how to proceed. I just want to pull the code from the codebase to run the project. No need to trigger builds when code is pushed to github, since my tests are triggered when other jobs finish.
But since my credentials are not in the credentialsmanager, I cannot just add the new repo here. This also means I cannot refer to my jenkinsfile here.
I read somewhere I had to refer to my github project here:
I did this, butI think this will not be enough. I figure I need to pull the code from the new repo somewhere, but I have no idea where.
Which brings me to my question: where and how do I pull the code from my github repo, using the personal acces token/github server I specified?.