I am going to create Jenkins pipline but with different scenario please share your experiance to resolve error.

So the scenario is :

  1. Jenkins is installed in the Mac machine.
  2. My project is in .Net core 6.
  3. Site is hosted on IIS in window server where want to deploy.
  4. In this server we installed Open SSH server with SSH key to connect with jenkins
  5. Also we have git from where user merge the code it should start execute the script automatically and will do restore, build, publish, deploy in the window server using open SSH.

So, now we tried freestyle project and pipeline script as well with different kind of code but jenkins freestyle works without any error but unable to execute command even "dir".

In pipeline script every time after complete git stage I have restore stage and while executing this script we got "no such directory found" error message.

Can anyone help me on this?

Thank you in advance.

For pipeline I tried below and we got "no Such file or directory" message found

`pipeline { agent any stages { stage('Code Checkout') { steps { // Clean before build cleanWs()

            checkout changelog: false, 
            poll: false,  
            scm: [$class: 'GitSCM',
                  branches: [[name: "${BRANCH_NAME}"]], 
                  extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: '${WORKSPACE}']],
                  userRemoteConfigs: [[credentialsId: "${GIT_CREDENTIALS_ID}",
                  url: "${REPO_URL}"]]
                  ]
        }
    }
    stage('API Restore'){
        steps{
            echo "${WORKSPACE}"
            dotnetRestore project: "${WORKSPACE}/${SLN_FILE_NAME}", 
            workDirectory: "${WORKSPACE}"
        }
    }
}

post {
    // Clean always after build
    always {
        cleanWs()
    }
}`

For freestyle project I tried below and here script execute but no command effect.

I choose "Execute shell script on remote host using ssh" Then selected "SSH site" details Then we tried different different command like below dir cd E:\path\to\directory

0

There are 0 best solutions below