How to install .NetCore dotnet (not MSBuid plugin) to Jenkins

199 views Asked by At

I was assigned to create CI/CD workflow for our project combining Openshift + Jenkins pipeline. I can build by using following:

stage('build') {
            steps {
                script {
                    openshift.withCluster() {
                        openshift.withProject() {
                            def buildSelector = openshift.selector("bc", "test")
                            buildSelector.startBuild()
                            buildSelector.logs('-f')
                        }
                    }
                } // script
            } // steps
        } // stage

But I want to also use dotnet restore and other commands but pipeline returns: /var/lib/jenkins/jobs/test-namespace/jobs/test-pipeline/workspace@tmp/durable-4265d26a/script.sh: line 1: dotnet: command not found also when trying to use

agent {
        docker { image 'mcr.microsoft.com/dotnet/aspnet:3.1' }
    }

/var/lib/jenkins/jobs/test-namespace/jobs/test-pipeline/workspace@tmp/durable-4265d26a/script.sh: line 1: docker: command not found

This is my current script

pipeline {
    agent {
        node {
            label ''
        }
    }
    options {
                // set a timeout of 20 minutes for this pipeline
                timeout(time: 20, unit: 'MINUTES')
            }
        stage('build') {
            steps {
                script {
                    openshift.withCluster() {
                        openshift.withProject() {
                            def buildSelector = openshift.selector("bc", "test")
                            buildSelector.startBuild()
                            buildSelector.logs('-f')
                        }
                    }
                } // script
            } // steps
        } // stage
        stage('clean'){
            steps {
                script{
                    echo "${workspace} I want to call dotnet clean"
                }
            } // steps
        } // stage
        stage('restore'){
            steps {
                script{
                    echo "${workspace} I want to call dotnet restore"
                }
            } // steps
        } // stage
        stage('tests'){
            steps {
                script{
                    echo "${workspace} I want to call dotnet test *.sln"
                }
            } // steps
        } // stage
        stage('deploy') {
            steps {
                script {
                    openshift.withCluster() {
                        openshift.withProject() {
                            def deploySelector = openshift.selector("dc", "test")
                            deploySelector.startDeploy()
                            deploySelector.logs('-f')
                        }
                    }
                } // script
            } // steps
        } // stage
    }
}

How can I install those binaries to Jenkins? I am using minishift on MacOS.

0

There are 0 answers