Question: Software is to be deployed to a live server using a declarative pipeline script. The server is connected as a jenkins node labeled LiveLinuxAgent. The

Software is to be deployed to a live server using a declarative pipeline script. The server is connected as a jenkins node labeled LiveLinuxAgent. The deploymen Commands, including a command that depends on a file's presence in the Jenkins workspace. This file contains sensitive information like API tokens and environment
What is the recommended approach for deploying this pipeline?
Pick ONE option
A)
node (Label: "LiveLinuxAgent"){
stage("Deploy to the server"){
fetch file Secretfiles.secrets;
sh " use $Secretfiles.secrets"
}
}
B)
node (Label: "LivelinuxAgent"){
stage("deploy to the server"){
withCredentials([string(credentialsId: 'Secrets', variable: 'Secrets.secrets')]){
sh "use $Secrets.secrets"
}
}
}
c)
pipeline{
agent {
label 'LiveLinuxAgent'
}
stages{
stage("deploy to the server"){
steps{
withCredentials([string(credentialsId: 'Secrets', variable: 'Secrets.secrets')]){
sh "use $Secrets.secrets"
}
}
}
}
}
D)
pipeline{
agent {
label 'LiveLinuxAgent'
}
stages{
stage("deploy to the server"){
steps{
withCredentials([file(credentialsId: 'Secrets', variable: 'Secrets.secrets')]){
sh "use $Secrets.secrets"
}
}
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!