Last active
December 7, 2024 13:22
-
-
Save qzm/f8921c0b7032ab7a6497ea92eb605438 to your computer and use it in GitHub Desktop.
Vue.js / Jenkinsfile /Pipelines
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline { | |
agent { | |
docker { | |
image 'node' | |
} | |
} | |
stages { | |
stage('Clone Sources') { | |
steps { | |
git 'https://gitlab.com/chiminyau/ci-test.git' | |
} | |
} | |
stage('Information') { | |
steps { | |
sh 'node -v' | |
sh 'npm -v' | |
} | |
} | |
stage('Config') { | |
steps { | |
sh 'npm set registry https://registry.npm.taobao.org' | |
sh 'npm set disturl https://npm.taobao.org/dist' | |
sh 'npm set chromedriver_cdnurl http://cdn.npm.taobao.org/dist/chromedriver' | |
sh 'npm set operadriver_cdnurl http://cdn.npm.taobao.org/dist/operadriver' | |
sh 'npm set phantomjs_cdnurl http://cdn.npm.taobao.org/dist/phantomjs' | |
sh 'npm set fse_binary_host_mirror https://npm.taobao.org/mirrors/fsevents' | |
sh 'npm set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass' | |
sh 'npm set electron_mirror http://cdn.npm.taobao.org/dist/electron/' | |
} | |
} | |
stage('Dependencies') { | |
steps { | |
sh 'npm install' | |
} | |
} | |
stage('Unit Test') { | |
steps { | |
sh 'npm run unit' | |
} | |
} | |
stage('E2E Test') { | |
steps { | |
sh 'npm run e2e' | |
} | |
} | |
stage('Build') { | |
steps { | |
sh 'npm run build' | |
} | |
} | |
stage('Artifacts') { | |
steps { | |
sh 'tar -czf dist.tar.gz ./dist' | |
stash 'dist.tar.gz' | |
stash 'Dockerfile' | |
stash 'nginx.conf' | |
archiveArtifacts artifacts: 'dist.tar.gz', fingerprint: true | |
} | |
} | |
stage('Docker Image') { | |
agent { | |
docker { | |
image 'docker:dind' | |
} | |
} | |
steps { | |
sh 'docker -v' | |
unstash 'dist.tar.gz' | |
unstash 'Dockerfile' | |
unstash 'nginx.conf' | |
sh 'docker build -t registry.gitlab.com/chiminyau/ci-test:jenkins .' | |
} | |
} | |
} | |
} |
For me it helped to add a environment block with the HOME variable under the agent, like this:
agent {
docker {
image 'node:10-alpine'
args '-p 4000:4000'
}
}
environment {
HOME= '.'
}
What is I want to push the content of dist folder to a azure blob storage?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hellp,I ran into problems using your script。I have no authority to perform any modified file paths
