Skip to content

Instantly share code, notes, and snippets.

View ajayryeruva's full-sized avatar

Ajay R Yeruva ajayryeruva

View GitHub Profile
@ajayryeruva
ajayryeruva / Jenkinsfile.groovy
Created February 29, 2020 05:54 — forked from tknerr/Jenkinsfile.groovy
Debugging Powershell Sequential / Parallel Workflows and Error Reporting in Jenkinsfile
def powershell_workflow(String mode, String... scripts) {
powershell """
echo "starting workflow in $mode mode"
workflow runWorkflow {
$mode {
${scripts.collect { script ->
"InlineScript { ${script} *>&1 | tee -filepath ${script.replace(' ','_')}.log; if(\$LastExitCode -ne 0) { Throw \"ERROR: \'$script\' failed with exit code \$LastExitCode \" } } -ErrorAction Continue"
}.join('\n') }
}
}
@ajayryeruva
ajayryeruva / ci_jobs.groovy
Created February 29, 2020 05:51 — forked from tknerr/ci_jobs.groovy
Example JobDSL for a multibranchPipelineJob which keeps only the last 10 builds
// define the bitbucket project + repos we want to build
def bitbucket_project = 'myproj'
def bitbucket_repos = ['myrepo1', 'myrepo2']
// create a pipeline job for each of the repos and for each feature branch.
for (bitbucket_repo in bitbucket_repos)
{
multibranchPipelineJob("${bitbucket_repo}-ci") {
// configure the branch / PR sources
branchSources {
@ajayryeruva
ajayryeruva / System Design.md
Created September 16, 2019 05:42 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@ajayryeruva
ajayryeruva / datadog.conf
Created August 21, 2019 20:38 — forked from clofresh/datadog.conf
Multiline datadog agent log parser
[Main]
dogstreams: /path/to/log:/path/to/multiline.py:MultilineParser
Jenkins Best Practices
https://en.wikipedia.org/wiki/Continuous_integration<- Read this!
https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Best+Practices
http://www.slideshare.net/andrewbayer/7-habits-of-highly-effective-jenkins-users
Set up version control of job configurations
Keep jobs simple! Don't put a ton of bash in each job. If a job needs to do something complex, put it in a script in GitHub and check it out as needed.
Use templated builders to simplify common tasks
Keep all scripts in version control - avoid running scripts that live on the Jenkins server filesystem
Don't install unnecessary plugins - plugins are often written by third parties and can interact with each other in strange ways
Use LDAP authentication if possible for traceability - avoid anonymous access
@ajayryeruva
ajayryeruva / email_notify.py
Created April 14, 2017 17:09 — forked from jriguera/email_notify.py
Email from Python with Jinja2
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Python 3 and compatibility with Python 2
from __future__ import unicode_literals, print_function
import os
import sys
import re
import logging