commit
e231fc8801
14 changed files with 8585 additions and 0 deletions
Split View
Diff Options
-
22.gitignore
-
3Dockerfile
-
100Jenkinsfile
-
5babel.config.js
-
46k8s.yaml
-
43package.json
-
BINpublic/favicon.ico
-
17public/index.html
-
24readme.md
-
28src/App.vue
-
BINsrc/assets/logo.png
-
50src/components/HelloWorld.vue
-
11src/main.js
-
8236yarn.lock
@ -0,0 +1,22 @@ |
|||
.DS_Store |
|||
node_modules |
|||
/dist |
|||
|
|||
# local env files |
|||
.env.local |
|||
.env.*.local |
|||
|
|||
# Log files |
|||
npm-debug.log* |
|||
yarn-debug.log* |
|||
yarn-error.log* |
|||
pnpm-debug.log* |
|||
|
|||
# Editor directories and files |
|||
.idea |
|||
.vscode |
|||
*.suo |
|||
*.ntvs* |
|||
*.njsproj |
|||
*.sln |
|||
*.sw? |
|||
@ -0,0 +1,3 @@ |
|||
FROM nginx:latest |
|||
ADD ./dist /usr/share/nginx/html |
|||
|
|||
@ -0,0 +1,100 @@ |
|||
node('haimaxy-jnlp') { |
|||
stage('Clone') { |
|||
echo "1.Clone Stage" |
|||
checkout scm |
|||
script { |
|||
build_tag = sh(returnStdout: true, script: 'git rev-parse --short HEAD').trim() |
|||
currentGitBranch = sh(returnStdout: true, script: 'git rev-parse --abbrev-ref HEAD').trim() |
|||
|
|||
// if (env.BRANCH_NAME != 'master') { |
|||
// build_tag = "${env.BRANCH_NAME}-${build_tag}" |
|||
// } |
|||
} |
|||
} |
|||
stage('Test') { |
|||
echo "2.Test Stage" |
|||
} |
|||
stage('Build dist') { |
|||
echo "build dist" |
|||
sh "pwd" |
|||
sh "ls -l" |
|||
//echo $PWD |
|||
//cat /home/jenkins/agent/workspace/jenkins-frontend-demo/package.json |
|||
|
|||
//sh "/mnt/nfses/nodeDatas/bin/npm install" |
|||
sh "cp ./package.json /mnt/nfses/nodeDatas/lib/" |
|||
sh "cd /mnt/nfses/nodeDatas/lib" |
|||
//sh "/mnt/nfses/nodeDatas/bin/npm i yarn nrm" |
|||
sh "/mnt/nfses/nodeDatas/bin/nrm add qniao http://120.78.76.88:4873/" |
|||
sh "/mnt/nfses/nodeDatas/bin/nrm use qniao" |
|||
sh "/mnt/nfses/nodeDatas/bin/nrm ls" |
|||
sh "/mnt/nfses/nodeDatas/bin/yarn && cd -" |
|||
sh "ln -s /mnt/nfses/nodeDatas/lib/node_modules node_modules" |
|||
sh "/mnt/nfses/nodeDatas/bin/yarn build" |
|||
|
|||
// /home/jenkins/agent/workspace/jenkins-frontend-demo/node_modules |
|||
|
|||
// sh "docker run --rm -d -v $PWD/workspace/jenkins-frontend-demo:/home 120.78.76.88/library/qnnode:latest sh -c 'npm install && npm run build'" |
|||
//sh "yarn && yarn build" |
|||
} |
|||
stage('Build docker image') { |
|||
echo "3.Build Docker Image Stage" |
|||
sh "pwd" |
|||
sh "ls -l" |
|||
sh "docker build -t 120.78.76.88/test/jenkins-frontend-demo:${build_tag} ." |
|||
} |
|||
stage('Push') { |
|||
echo "4.Push Docker Image Stage" |
|||
withCredentials([usernamePassword(credentialsId: 'harbor', passwordVariable: 'harborPassword', usernameVariable: 'harborUser')]) { |
|||
sh "docker login -u ${harborUser} -p ${harborPassword} 120.78.76.88" |
|||
sh "docker push 120.78.76.88/test/jenkins-frontend-demo:${build_tag}" |
|||
} |
|||
} |
|||
stage('YAML') { |
|||
echo "5. Change YAML File Stage" |
|||
//def userInput = input( |
|||
// id: 'userInput', |
|||
// message: 'Choose a deploy environment', |
|||
// parameters: [ |
|||
// [ |
|||
// $class: 'ChoiceParameterDefinition', |
|||
// choices: "Dev\nQA\nProd", |
|||
// name: 'Env' |
|||
// ] |
|||
// ] |
|||
//) |
|||
//echo "This is a deploy step to ${userInput.Env}" |
|||
sh "sed -i 's/<BUILD_TAG>/${build_tag}/' k8s.yaml" |
|||
//sh "sed -i 's/<BRANCH_NAME>/${env.BRANCH_NAME}/' k8s.yaml" |
|||
} |
|||
stage('Deploy') { |
|||
echo "6. Deploy Stage" |
|||
//if (userInput.Env == "Dev") { |
|||
// deploy dev stuff |
|||
//} else if (userInput.Env == "QA"){ |
|||
// deploy qa stuff |
|||
//} else { |
|||
// deploy prod stuff |
|||
// input "确认要部署线上环境吗?" |
|||
//} |
|||
sh "kubectl apply -f k8s.yaml" |
|||
} |
|||
|
|||
stage('async git repo') { |
|||
echo "current git repo: " |
|||
sh "git config --list | grep remote.origin.url" |
|||
echo "current git branch: " |
|||
sh "echo ${currentGitBranch}" |
|||
sh "mv .git .git.tmp" |
|||
sh "git clone http://47.106.79.88:10080/liuji/frontend" |
|||
sh "mv frontend/.git .git" |
|||
//sh "rm -fr jenkins-frontend-demo" |
|||
sh "git stash" |
|||
sh "git checkout ${currentGitBranch}" |
|||
sh "git pull" |
|||
sh "git stash pop" |
|||
sh "git config user.name zhangshan" |
|||
sh "git config user.email zhangshan@qniao.cn" |
|||
sh "git add . && git commit -m 'async test git repo with dev git repo' && git push" |
|||
} |
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
module.exports = { |
|||
presets: [ |
|||
'@vue/cli-plugin-babel/preset' |
|||
] |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
apiVersion: apps/v1 |
|||
kind: Deployment |
|||
metadata: |
|||
labels: |
|||
env: dev |
|||
type: frontend |
|||
name: jenkins-frontend-demo |
|||
namespace: frontend |
|||
spec: |
|||
selector: |
|||
matchLabels: |
|||
app: jenkins-frontend-demo |
|||
template: |
|||
metadata: |
|||
labels: |
|||
app: jenkins-frontend-demo |
|||
spec: |
|||
containers: |
|||
- image: 120.78.76.88/test/jenkins-frontend-demo:<BUILD_TAG> |
|||
imagePullPolicy: IfNotPresent |
|||
name: jenkins-frontend-demo |
|||
env: |
|||
- name: branch |
|||
value: <BRANCH_NAME> |
|||
ports: |
|||
- containerPort: 80 |
|||
name: web |
|||
protocol: TCP |
|||
|
|||
--- |
|||
apiVersion: v1 |
|||
kind: Service |
|||
metadata: |
|||
name: jenkins-frontend-demo-svc |
|||
namespace: frontend |
|||
labels: |
|||
app: jenkins-frontend-demo |
|||
spec: |
|||
selector: |
|||
app: jenkins-frontend-demo |
|||
type: NodePort |
|||
ports: |
|||
- name: web |
|||
port: 80 |
|||
targetPort: web |
|||
nodePort: 30010 |
|||
@ -0,0 +1,43 @@ |
|||
{ |
|||
"name": "frontend", |
|||
"version": "0.1.0", |
|||
"private": true, |
|||
"scripts": { |
|||
"serve": "vue-cli-service serve", |
|||
"build": "vue-cli-service build", |
|||
"lint": "vue-cli-service lint" |
|||
}, |
|||
"dependencies": { |
|||
"core-js": "^3.6.5", |
|||
"utils": "^1.5.3", |
|||
"vue": "^2.6.11" |
|||
}, |
|||
"devDependencies": { |
|||
"@vue/cli-plugin-babel": "~4.4.0", |
|||
"@vue/cli-plugin-eslint": "~4.4.0", |
|||
"@vue/cli-service": "~4.4.0", |
|||
"babel-eslint": "^10.1.0", |
|||
"eslint": "^6.7.2", |
|||
"eslint-plugin-vue": "^6.2.2", |
|||
"vue-template-compiler": "^2.6.11" |
|||
}, |
|||
"eslintConfig": { |
|||
"root": true, |
|||
"env": { |
|||
"node": true |
|||
}, |
|||
"extends": [ |
|||
"plugin:vue/essential", |
|||
"eslint:recommended" |
|||
], |
|||
"parserOptions": { |
|||
"parser": "babel-eslint" |
|||
}, |
|||
"rules": {} |
|||
}, |
|||
"browserslist": [ |
|||
"> 1%", |
|||
"last 2 versions", |
|||
"not dead" |
|||
] |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en"> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
|||
<meta name="viewport" content="width=device-width,initial-scale=1.0"> |
|||
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> |
|||
<title><%= htmlWebpackPlugin.options.title %></title> |
|||
</head> |
|||
<body> |
|||
<noscript> |
|||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> |
|||
</noscript> |
|||
<div id="app"></div> |
|||
<!-- built files will be auto injected --> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,24 @@ |
|||
# frontend |
|||
|
|||
## Project setup |
|||
``` |
|||
yarn install |
|||
``` |
|||
|
|||
### Compiles and hot-reloads for development |
|||
``` |
|||
yarn serve |
|||
``` |
|||
|
|||
### Compiles and minifies for production |
|||
``` |
|||
yarn build |
|||
``` |
|||
|
|||
### Lints and fixes files |
|||
``` |
|||
yarn lint |
|||
``` |
|||
|
|||
### Customize configuration |
|||
See [Configuration Reference](https://cli.vuejs.org/config/). |
|||
@ -0,0 +1,28 @@ |
|||
<template> |
|||
<div id="app"> |
|||
<img alt="Vue logo" src="./assets/logo.png"> |
|||
<HelloWorld msg="Welcome to Your Vue.js App"/> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import HelloWorld from './components/HelloWorld.vue' |
|||
|
|||
export default { |
|||
name: 'App', |
|||
components: { |
|||
HelloWorld |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
#app { |
|||
font-family: Avenir, Helvetica, Arial, sans-serif; |
|||
-webkit-font-smoothing: antialiased; |
|||
-moz-osx-font-smoothing: grayscale; |
|||
text-align: center; |
|||
color: #2c3e50; |
|||
margin-top: 60px; |
|||
} |
|||
</style> |
|||
@ -0,0 +1,50 @@ |
|||
<template> |
|||
<div class="hello"> |
|||
<h1>{{ msg }}</h1> |
|||
<p> |
|||
For a guide and recipes on how to configure / customize this project,<br> |
|||
check out the |
|||
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>. |
|||
</p> |
|||
<h3>Installed CLI Plugins</h3> |
|||
<ul> |
|||
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li> |
|||
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li> |
|||
</ul> |
|||
<h3>Essential Links</h3> |
|||
<ul> |
|||
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li> |
|||
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li> |
|||
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li> |
|||
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li> |
|||
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li> |
|||
</ul> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
name: 'HelloWorld', |
|||
props: { |
|||
msg: String |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<!-- Add "scoped" attribute to limit CSS to this component only --> |
|||
<style scoped> |
|||
h3 { |
|||
margin: 40px 0 0; |
|||
} |
|||
ul { |
|||
list-style-type: none; |
|||
padding: 0; |
|||
} |
|||
li { |
|||
display: inline-block; |
|||
margin: 0 10px; |
|||
} |
|||
a { |
|||
color: #42b983; |
|||
} |
|||
</style> |
|||
@ -0,0 +1,11 @@ |
|||
import Vue from 'vue' |
|||
import App from './App.vue' |
|||
import { type } from 'utils' |
|||
|
|||
console.log(type(1)) |
|||
|
|||
Vue.config.productionTip = false |
|||
|
|||
new Vue({ |
|||
render: h => h(App), |
|||
}).$mount('#app') |
|||
8236
yarn.lock
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Write
Preview
Loading…
Cancel
Save