Skip to content

Instantly share code, notes, and snippets.

pipeline {
agent 'any'
options {
skipStagesAfterUnstable()
}
stages {
// Build dev
stage('BuildDev') {
when {
branch 'dev'
pipeline {
agent 'any'
options {
skipStagesAfterUnstable()
}
stages {
// Build
stage('BuildMaster') {
@anilnautiyal
anilnautiyal / Jenkins.yml
Created May 5, 2020 06:08
Jenkins YAML file
pipeline {
agent 'any'
options {
skipStagesAfterUnstable()
}
environment {
exampleEnvType = 'dev'
//you can decalare more global env variable here as above, if not needed remove the environment block
}
@anilnautiyal
anilnautiyal / rsync
Last active February 13, 2020 13:10
Jenkins Rsync Commands
sshpass -p 'Password' rsync -Prtgovze "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --no-perms --no-owner --no-group --delete-after --exclude config/database.php --exclude config/config.php --exclude config/constants.php --exclude config/routes.php --exclude helpers/encrypt_decrypt_helper.php --exclude cms/cms.php --exclude assets/spreadsheet/uploads/ /var/lib/jenkins/jenkins/workspace/repo-name/src/ destination-server-hostname@IP:/usr/share/nginx/html/directory-name/
image: ubuntu:latest
pipelines:
branches:
master:
- step:
script:
- apt-get update -yqq
- 'which ssh-agent || ( apt-get install openssh-client -yqq )'
- 'which rsync || ( apt-get install rsync -yqq )'
@anilnautiyal
anilnautiyal / For WPengine (.gitlab-ci.yml)
Last active February 16, 2022 02:13
.gitlab-ci.yml
before_script:
- mkdir -p ~/.ssh
- eval $(ssh-agent -s)
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- echo "$PRIVATEKEY" | tr -d '\r' | ssh-add - > /dev/null
stages:
- deploy_staging
- deploy_master
@anilnautiyal
anilnautiyal / Default .gitlab-ci.yml
Last active March 15, 2018 12:32
.gitlab-ci.yml
before_script:
- apt-get update -yqq
- 'which ssh-agent || ( apt-get install openssh-client -y )'
- mkdir -p ~/.ssh
- eval $(ssh-agent -s)
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
stages:
- deploy_dev
- deploy_stage
@anilnautiyal
anilnautiyal / Standard VirtaulHost Conf
Last active February 13, 2020 12:59
VirtualHost Conf File
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /home/user/example.com/public/
<Directory /home/user/example.com/public/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>