Skip to content

Instantly share code, notes, and snippets.

View sean-abbott's full-sized avatar

Sean Abbott sean-abbott

View GitHub Profile
@sean-abbott
sean-abbott / example_runs
Last active February 21, 2022 22:42
Validation ideas
[1] pry(main)> load "validation_demo.rb"
=> true
[2] pry(main)> # The finance method
[3] pry(main)> he = HashExample.new
=> #<HashExample:0x0000564aaaebc558>
[4] pry(main)> he.check(true)
Airhorn would say All conditions are true!
=> true
[5] pry(main)> he.check(false)
Airhorn would say Something failed! I don't know what! Figure it out!
@sean-abbott
sean-abbott / api-deployment.yml
Created April 5, 2019 18:05
api-deployment using volume instead of env for config
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "cds.fullname" . }}-api
labels:
app: {{ template "cds.fullname" . }}-api
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
withEnv(build_env()) {
nexusArtifactUploader artifactId: 'client', classifier: 'linux', credentialsId: '', file: env.ARTIFACT, groupId: 'example', nexusPassword: '', nexusUrl: 'example:8081/nexus', nexusUser: 'deployment', packaging: 'tar.bz2', protocol: 'http', repository: env.REPO, type: '', version: env.JVERSION
}
def build_env() {
def env_filename = env.BUILD_TAG + '.build.env'
sh './buildenv.sh > /tmp/${BUILD_TAG}.build.env'
def prop_list = readFile('/tmp/' + env_filename).split('\n')
return prop_list
}
from jenkins import Jenkins
from ConfigParser import RawConfigParser
import requests
import json
# read from /etc/jenkins_jobs/jenkins_jobs.ini
cfg = RawConfigParser()
cfg.read('/etc/jenkins_jobs/jenkins_jobs.ini')
args = dict(cfg.items('jenkins'))
args['username'] = args.pop('user')