Skip to content

Instantly share code, notes, and snippets.

View chaturanga50's full-sized avatar

Chathuranga Abeyrathna chaturanga50

  • Colombo, Sri Lanka
View GitHub Profile
@chaturanga50
chaturanga50 / docker-compose.yml
Last active March 19, 2021 14:29
docker-compose for openldap with phpldapadmin
version: '3.7'
services:
openldap:
container_name: openldap
image: osixia/openldap:1.3.0
restart: on-failure
environment:
LDAP_DOMAIN: ldap.example.com
LDAP_ORGANISATION: OpenLDAP
@chaturanga50
chaturanga50 / README.md
Created February 20, 2020 14:41 — forked from magnetikonline/README.md
AWS Elastic Beanstalk deploy user restricted IAM policy.

AWS Elastic Beanstalk deploy user restricted IAM policy

An IAM user policy document to give minimal rights for deploying an Elastic Beanstalk application.

Where:

  • REGION: AWS region.
  • ACCOUNT_ID: AWS account ID.
  • APPLICATION_NAME: Desired target Elastic Beanstalk application name(space).
  • IAM_INSTANCE_PROFILE_ROLE: The instance profile (IAM role) Elastic Beanstalk EC2 instaces will run under.
@chaturanga50
chaturanga50 / cleanupUnusedWorkspaceInSlaves.groovy
Last active July 18, 2019 08:19 — forked from ceilfors/cleanupUnusedWorkspaceInSlaves.groovy
When you delete jobs in Jenkins, the corresponding workspaces in the build slaves won't be deleted automatically. This Jenkins script will go to each slave and check if the jobs are already deleted in Jenkins master and delete the workspace.
import com.cloudbees.hudson.plugins.folder.Folder
import hudson.FilePath
import jenkins.model.Jenkins
def boolean isFolder(String name) {
def item = Jenkins.instance.getItemByFullName(name)
return item instanceof Folder
}
def deleteUnusedWorkspace(FilePath root, String path) {
@chaturanga50
chaturanga50 / coverage-reports-jenkinsfile.groovy
Last active September 1, 2019 19:11
publish multiple coverage reports to one
node('master') {
stage('Publish coverage reports') {
def pathPattern = ['/target/jacoco/index.html']
pathPattern.each { pattern ->
def modules = ['module1',
'module2',
'module3']
allPaths = []
allModules = []
modules.each { module ->
#!/usr/bin/env bash
# Generate timestamped filename
TIMESTAMPED_TAG=`date +%Y-%m-%d-%H%M%S`
BACKUP_ARCHIVE="./jenkins-backup-${TIMESTAMPED_TAG}.tar.gz"
# Inconceivable race condition avoidance
if [-f $BACKUP_ARCHIVE ]; then
rm ${BACKUP_ARCHIVE}
fi
@chaturanga50
chaturanga50 / deploy_jenkins.sh
Created July 11, 2017 07:20
Jenkins Installation with Ansible roles,
#!/bin/bash
#Detect OS
if grep -q Ubuntu /proc/version; then
version=$(cat /etc/issue)
echo "You are running on $version"
else
echo "This script is only supported on Ubuntu."
exit 1
fi