Front-end CI/CD
1.Environments
- AWS EC2 Linux && nginx
- Java
- Gitlab/Github
2.Install Jenkins
- 1.switch root user
1 |
|
- 2.update local yum repo
1 |
|
- 3.get jenkins remote repo package
1 |
|
- 4.get jenkins repo key
1 |
|
- 5.install jenkins
1 |
|
- 6.set to run on startup
1 |
|
3.Jenkins plugins install
- 1.Install NodeJS plugin
- 2.Enter the Global Tool Configuration => new NodeJS
- 3.Install Publish Over SSH(Send build artifacts over SSH)
- 4.Install Generic Webhook Trigger(Dynamically associate the Git repository)
- 5.Install Email Extension Plugin(Ignore it if it exists)
4.Build Github Project
- 1.Create Freestyle project
- 2.Select Github Project => Project URL input your repo url => Source code management select git && input git address => build Enviroment select provide Node & npm bin/folder to PATH => Select your NodeJs version => build select excu shell => input shell script
1 |
|
- 3.Apply && Save
5.Email Configure
1 |
|
6. Automatic build
- 1.settings => Developer settings => Personal access tokens => select scop
repo
admin:repo_hook
=> copy token - 2.system settings => Github Server => add credentials => select secret text => secret field input token => check manage hook
- 3.project => settings => Webhooks => check webhook setting
http://*****:8080/github-webhook/
7.Publish
- system settings => Publish over SSH
1
2
3
4
5
6
7name: aws
Hostname: XXX.XX.XX.XX
Username: root
Remote Directory: /usr/local/nginx/
check Use password authentication, or use a different key
Passphrase / Password: ******
- system settings => Publish over SSH
- project => settings => after build => send build artifacts over SSH
1
2
3
4Name: aws
Source files: dist/jenkins-test/*
Remove prefix: dist/jenkins-test
Remote directory: html/
- project => settings => after build => send build artifacts over SSH