Skip to content

Instantly share code, notes, and snippets.

@hochun836
Last active September 7, 2021 03:53
Show Gist options
  • Save hochun836/cd23c56d872880b819d5429378037537 to your computer and use it in GitHub Desktop.
Save hochun836/cd23c56d872880b819d5429378037537 to your computer and use it in GitHub Desktop.
# base
devops (development, operations)
cicd (continuous integration, continuous deployment)
=> ref: https://www.bilibili.com/video/BV1zf4y127vu
# workflow
developer gitlab jenkins
|push---------->| |
| |webhook------->|
| | |trigger
| |<----------pull|
| | |build
| |<--------notify|
| | |
| | |
| | |
# gitlab
gitlab-ctl status
gitlab-ctl restart
# jenkins
systemctl status jenkins
systemctl restart jenkins
cat /var/lib/jenkins/updates/default.json
cat /var/log/jenkins/jenkins.log
ls -al /var/lib/jenkins/workspace/
ls -al /var/lib/jenkins/workspace/<item-name>
ls -al /var/lib/jenkins/jobs/
ls -al /var/lib/jenkins/jobs/<item-name>
cat /var/lib/jenkins/jobs/<item-name>/config.xml
cat /var/lib/jenkins/jobs/<item-name>/nextBuildNumber
# jenkins job type
free-style (builtin)
maven (by install plugin: Maven Integration)
pipeline (by install plugin: Pipeline)
# jenkins pipeline
groovy
syntax
declarative pipeline // jenkins 2.x recommended
scripted pipeline
store in
jenkins server
scm server (source code management) // filename 'Jenkinsfile' recommended
# jenkins build trigger
trigger builds remotely (builtin)
build after other projects are built (builtin)
build periodically (builtin)
poll scm (builtin)
build when a change is pushed to gitlab (by install plugin: GitLab Plugin)
# jenkins parameterized
<item-name> | configure | general | v this project is parameterized
# jenkins mail notification
Email Extension Plugin
Email Extension Template
manage jenkins | configure system | extended e-mail notification | content token reference
# [note] gitlab base
one group can contain multi projects
one project doesn't need to be contained in the group
# [note] Whoops, GitLab is taking too much time to respond.
gitlab-ctl status
# [note] jenkins environment variable
http://<ip>:<port>/env-vars.html
# [note] jenkins restart
http://<ip>:<port>/restart
# [note] jenkins add user
manage jenkins | manage users
# [note] jenkins rbac (role-based access control)
manage jenkins | manage plugins | available | install 'Role-based Authorization Strategy'
manage jenkins | configure global security | authorization | choose 'Role-Based Strategy'
manage jenkins | manage and assign roles | manage roles
manage jenkins | manage and assign roles | assign roles
'global role' is used to manage jenkins
'item role' is used to manage item
# [note] jenkins version
manage jenkins | about jenkins
# [note] jenkins log
manage jenkins | system log
=> ref: https://www.jenkins.io/doc/book/system-administration/viewing-logs/
# [note] No credentials found for credentialsId (when gitlab webhook to jenkins)
vi /var/lib/jenkins/jobs/<item-name>/config.xml
delete <jobCredentialId/>
delete <useAlternativeCredential>false</useAlternativeCredential>
=> ref: https://github.com/jenkinsci/gitlab-plugin/issues/992
# [note] learn
=> ref: https://www.bilibili.com/video/BV1kJ411p7mV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment