Commit ee07747f authored by 郭灿峰's avatar 郭灿峰

Update Jenkinsfile

parent 70b656c1
Pipeline #25 failed with stage
pipeline { pipeline {
agent any agent any
environment {
commit_id = get_commit_id()
}
stages { stages {
stage('Build') { stage('Build') {
steps { steps {
sh '$(echo ${GIT_COMMIT} | cut -c 1-8)' sh '/var/jenkins_home/plugins/apache-maven-3.6.3/bin/mvn clean package'
//sh '/var/jenkins_home/plugins/apache-maven-3.6.3/bin/mvn clean package' }
} }
} stage('Build image') {
// stage('Build image') { steps {
// steps { sh 'docker build -t registry.lizhi.co/registry/pybbs:${COMMIT_ID} .'
// sh 'docker build -t registry.lizhi.co/registry/pybbs:${GIT_COMMIT} .' sh 'docker push registry.lizhi.co/registry/pybbs:${COMMIT_ID}'
// sh 'docker push registry.lizhi.co/registry/pybbs:${GIT_COMMIT}' }
// } }
// } stage('deploy') {
// stage('deploy') { steps {
// steps { sh 'sed -i "s#registry/pybbs#registry/pybbs:${COMMIT_ID}#g" docker-compose.yml'
// sh 'sed -i "s#registry/pybbs#registry/pybbs:${GIT_COMMIT}#g" docker-compose.yml' sshPublisher(
// sshPublisher( publishers: [
// publishers: [ sshPublisherDesc(
// sshPublisherDesc( configName: 'nginx',
// configName: 'nginx', transfers: [
// transfers: [ sshTransfer(
// sshTransfer( cleanRemote: false,
// cleanRemote: false, execCommand: 'cd /app && docker-compose down &&docker-compose up -d',
// execCommand: 'cd /app && docker-compose down &&docker-compose up -d', remoteDirectory: '/app',
// remoteDirectory: '/app', removePrefix: '',
// removePrefix: '', sourceFiles: 'docker-compose.yml'
// sourceFiles: 'docker-compose.yml' )
// ) ],
// ], verbose: true
// verbose: true )
// ) ]
// ] )
// ) }
// } }
// } }
}
def get_commit_id() {
node('master') {
if (env.GIT_COMMIT) {
return GIT_COMMIT.substring(0,6)
}
} }
} }
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment