This file contains 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
--- | |
AWSTemplateFormatVersion: "2010-09-09" | |
Description: this is the notification project with ms teams | |
Parameters: | |
ProjectName: | |
Description: this name will prefix many names | |
Type: String | |
Default: notif |
This file contains 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
library identifier: 'jenkins-shared-libraries@master', retriever: modernSCM( | |
[$class: 'GitSCMSource', | |
remote: 'ssh://git@bitbucket.mycompany.net/smar/jenkins-shared-libraries.git', | |
credentialsId: 'jenkins-bitbucket-ssh-private-key']) | |
pipeline { | |
agent any | |
environment { | |
TEAMS_WEBHOOK_URL = credentials('digital-apac-webhook-url-for-ms-teams') |
This file contains 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
version: '3.7' | |
services: | |
jenkins_master: | |
image: jenkins/jenkins:lts | |
container_name: jenkins-lts | |
user: root | |
restart: always | |
volumes: | |
- $HOME/jenkins:/var/jenkins_home | |
ports: |
This file contains 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
# MASTER PRE-REQS | |
# Install docker, docker-compose | |
# mkdir -p ~/{jenkins,jnlp_slave} | |
# master | |
# docker run -d \ | |
# -u root \ | |
# --name=jenkins \ | |
# -e TZ=America/Denver \ |
This file contains 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
#https://JENKINS_URL/user/username/configure -> API Token | |
#token_auth under BuildItem -> Configure -> Build Trigger -> Trigger builds remotely | |
curl -X POST https://{api_token_name}:{api_token}@JENKINS_URL/job/item/buildWithParameters?token={token_auth}&PARAM=value1&PARAM2=value2 |
This file contains 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
/* | |
เราตั้งใจสร้าง List ขึ้นมาเพื่อให้เป็น Template สำหรับ choice ในการเลือก | |
Environment Server สำหรับ Deploy เช่นบน Dev Server อาจจะมี IP | |
อยู่คนล่ะเครื่องกับ Production และ Database ก็อาจจะไมไ่ด้แยกแค่ระดับ Schema | |
แต่อาจจะแยกเป็นคนล่ะ DB อยู่คนล่ะที่กันเลย ซึ่งเราจะใช้ตัวแปรที่เป็น Constant เหล่านี้ในการทำเงื่อนไข | |
ว่าถ้าหากเป็น Dev Server ตัวแปร DB Server ก็จะมี Value คนล่ะอย่างกับ Prodcution นั่นเอง | |
*/ | |
def getServerEnvironmentList(){ | |
return ['DEV', 'SIT', 'UAT', 'PROD'] | |
} |
I wanted to have a Teams channel where to inform the team each time a deloy was successful.
Initialy I used the "Jenkins" connector, but found the posted information too generic. No branch nor commit number.
So I switched to use the "Incoming Webhook" connector, with allows me to create a Teams chat webhook URL to receive a JSON formated accordingly to the [Teams message card format], with whate ever information I requiere.
Then, in the Build section of the Jenkins Job, I added an "Execute Shell" build step, with the following code:
This file contains 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
def label = 'ci-runner' | |
def npmToken = <PROJECT_NPM_TOKEN> | |
podTemplate( | |
label: label, | |
containers: [ | |
containerTemplate( | |
name: 'jnlp', | |
image: <YOUR_IMAGE>, | |
workingDir: '/home/jenkins', |
This is the second part of the three-part gist for setting up a basic CI environment on a single machine (e.g., a laptop), for dev / test / proof-of-concept, etc.
This CI environment consists of:
- Gitlab (Community Edition) as a source-code repository
- Jenkins for build and continuous integration Gitlab cannot be used without a mail server (Postfix). So, we also set up Postfix.
NewerOlder