1) I have cloned a bitbucket repo name myrepo
which has 5 folders..branch name is development.
2) In all 5 folders (A
,B
,C
,D
,E
) I need to view A
folder contents using jenkins pipeline so that the user will have choice to pick/select.
3) All files names should be shown as xxx
only not as xxx_yar.yaml
.
I have implemented one func which clones bitbucket repo and executing shell command to find A
dir and removing _yar.yaml
and getting output as xxx
.
Here the problem is I am not able to switch from myrepo
folder to A
folder to execute shell command:
def CREDS="xxxxxx"
static void clonerepo(CREDS) {
def git branch: "development",
credentialsId: "${CREDS}",
url: "https://bitbucket.com/xxx/xx/myrepo.git"
sh(find A -type f -maxdepth 1 | cut -d "/" -f 2 | sed -e "s/_yar.yaml//g")
}
After this in pipeline question I have given in below format
MYNAME=input( id: 'userInput', message: 'What is the application?', parameters: [ [$class: 'ChoiceParameterDefinition', choices: clonerepo, description: '', name: ''] ])
so that in above choices all A
files contents will be shown to user.