简体   繁体   中英

How to fix script.sh: line 1: Builing...: not found problem?

I have used both jenkins/jenkins:latest and jenkinsci/blueocean:latest docker images with pipeline script from SCM settings.

General setting "GitHub project" was enabled with https://github.com/alamsarker/test

Now When I build. its shows the following error:

+ Builing...
/var/jenkins_home/workspace/pipeline-test@tmp/durable-2aac8cac/script.sh: line 1: Builing...: not found

Can you please to fix the issue?

I run docker by:

docker run \
  -u root \
  --rm \
  -d \
  -p 8080:8080 \
  -p 50000:50000 \
  -v jenkins-data:/var/jenkins_home \
  -v /var/run/docker.sock:/var/run/docker.sock \
  jenkinsci/blueocean

My Jenkinsfile is simple as follows:

pipeline {
    agent any
    stages {
        stage('build') {
            steps {
                sh 'Builing...'
            }
        }
        stage('Test') {
            steps {
                sh 'Testing...'
            }
        }
        stage('Deploy') {
            steps {
                sh 'Deploying...'
            }
        }
    }
}

the pipeline step sh is used to execute linux cmd. Building is not a valid linux cmd, that's why you get the error.

If you want to print out some word you can use step echo which is cross-platform or execute the linux cmd: echo via step sh , like sh 'echo Building...' which only work on linux-like agent.

pipeline {
    agent any
    stages {
        stage('build') {
            steps {
                echo 'Builing...'
            }
        }
        stage('Test') {
            steps {
                sh 'echo Testing...'
            }
        }
        stage('Deploy') {
            steps {
                echo 'Deploying...'
            }
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM