Skip to content

Instantly share code, notes, and snippets.

View AdamSaleh's full-sized avatar

Adam Saleh AdamSaleh

View GitHub Profile
//Example: run_groovy_script.sh ../wendy.ini add_global_pipeline_library.groovy <owner> <repo> [<branch> <ssh credentials id> <scan credentials id>]
import jenkins.model.*
import org.jenkinsci.plugins.workflow.libs.*
import org.jenkinsci.plugins.github_branch_source.*
import jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy
String owner = args[0]
String repo = args[1]
String branch = args.size() > 2 ? args[2] : 'master'
String sshCredentialsId = args.size() > 3 ? args[3] : 'jenkinsgithub'
#!groovy
// https://github.com/feedhenry/fh-pipeline-library
@Library('fh-pipeline-library') _
node('jenkins-tools') {
stage('Checkout') {
checkout scm
}
#!/usr/bin/env python
import os
import yaml
import argparse
class literal(str): pass
def literal_presenter(dumper, data):
return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='|')
yaml.add_representer(literal, literal_presenter)
@AdamSaleh
AdamSaleh / Dockerfile
Created May 21, 2018 12:51
Dockerized Jenkins Job Builder
FROM python:2
ENV BRANCH master
WORKDIR /
RUN git clone -b allow_self_signed_certs https://github.com/mikenairn/python-jenkins.git
WORKDIR python-jenkins
RUN pip install -U -r requirements.txt && python setup.py install
WORKDIR /
getDependents :: PackageName -> Handler [PackageName]
getDependents pkgdep = do
allPkgs <- getAllPackages
return $ D.packageName <$> (filter (\pkg -> isJust $ find isPackageDep $ getDepList pkg) allPkgs)
where isPackageDep = (== (runPackageName pkgdep))
getDepList p = map (runPackageName . fst) $ bowerDependencies $ D.pkgMeta $ p
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
//https://github.com/jenkinsci/jenkins-scripts/blob/master/scriptler/buildJobsMatchingPattern.groovy
import jenkins.model.*
import hudson.model.*
def jobPattern = args[0]
// Pattern to search for. Regular expression.
//def jobPattern = "test_.*"
def matchedJobs = Jenkins.instance.items.findAll { job ->
client_get_services_test.go:51: actual =
+------+--------------+------------+
| NAME | INTEGRATIONS | PARAMETERS |
+------+--------------+------------+
+------+--------------+------------+
, expected =
+---------------------+------------------+--------------------------------+
| NAME | INTEGRATIONS | PARAMETERS |
+---------------------+------------------+--------------------------------+
| ups | | MYSQL_DATABASE, |

by Goodacre Liam

declarations in a where clause are bound inside a given case an alternative way to do what you've written is:

nonempty = go where
  go input
    | isEmpty input = Nothing
 | otherwise = Just input
@AdamSaleh
AdamSaleh / Main.purs
Last active December 23, 2017 14:56
Sequence a Record
module Main where
import Prelude
import Control.Monad.Eff.Console (log, logShow)
import TryPureScript (render, withConsole)
import Data.Maybe (Maybe(..), isNothing, fromJust)
import Data.Record (get, insert)
import Data.Tuple (Tuple(..))
import Global.Unsafe (unsafeStringify)