Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Sauter michaelsauter

View GitHub Profile
View outline.md

✂️ Get rid of that boilerplate!

From:

def final projectId = 'foo'
def final componentId = 'bar'
def final credentialsId = "${projectId}-cd-cd-user-with-password"
def dockerRegistry
node {
  dockerRegistry = env.DOCKER_REGISTRY
}
View Jenkinsfile.example
odsComponentPipeline(
imageStreamTag: 'ods/jenkins-agent-base:3.x'
) {
odsComponentStageImportOpenShiftImageOrElse(context) {
stage('Build') {
sh './gradlew build'
}
odsComponentStageBuildOpenShiftImage(context)
}
View gist:16bd497a2052b014f31fb40da8ad33d7
import org.ods.service.ServiceRegistry
import org.ods.util.GitUtil
import org.ods.util.Project
def runOnAgentPod(Project project, boolean condition, Closure block) {
if (condition) {
def git = ServiceRegistry.instance.get(GitUtil)
dir(env.WORKSPACE) {
stash(name: 'wholeWorkspace', includes: '**/*,**/.git', useDefaultExcludes: false)
}
View ODS3.md

Work Packages for OpenDevStack 3.0

Release timeline: May 2020. Theme: Quality

Shared Library Testing

Owner(s): ? / Size: M / Benefit: Reliable pipelines, more confidence in changes / Ticket(s): #149, #146

Write automated tests for the shared library. Could be a mixed of tests with mocks and E2E tests. Run e.g. in Travis or Github Actions.

Project Provisioning Testing

View task.md

Interview Task

Objective

As a Farmera developer, synchronize temperature data reliably from an external vendor, myfarm.io, with Farmera. What kind of concepts / entities do you need to implement in our service? How will you do the interaction with myfarm.io? If you need more information about the API, please ask.

API Documentation myfarm.io

Example request

curl 'https://api.myfarm.io/devices/123/temperature?start=2019-01-06T00%3A00%3A00Z&end=2019-01-09T00%3A00%3A00Z&groupBy=FIFTEEN_MINUTES' -i -u 'user:secret' -X GET
@michaelsauter
michaelsauter / gist:297c0a67ba277b9c508f933ef9f70cdf
Last active Jan 31, 2017
Find and remove old Git branches
View gist:297c0a67ba277b9c508f933ef9f70cdf
# Update local repo
git fetch origin --prune
# Merged branches at least 2 months old
for branch in `git branch -r --merged | grep -v HEAD`; do echo -e `git show --format="%ci %cr %an" $branch | head -n 1` \\t$branch; done | grep "months" | awk '{print $(NF)}' | sed -e "s/^origin\///" | xargs git push origin --delete --dry-run
# All branches at least a year old
for branch in `git branch -r | grep -v HEAD`; do echo -e `git show --format="%ci %cr %an" $branch | head -n 1` \\t$branch; done | grep "1 year" | awk '{print $(NF)}' | sed -e "s/^origin\///" | xargs git push origin --delete --dry-run
@michaelsauter
michaelsauter / Makefile
Created Jan 23, 2017
Terraform Makefile
View Makefile
check:
@terraform version | grep "Terraform v0\.8\.[0-9]*" >/dev/null; case $$? in \
1) echo You need Terraform version 0.8.x!; exit 1;; \
esac
config: check
@terraform remote config -backend=s3 -backend-config="bucket=xxx-terraform-state" -backend-config="key=yyy/terraform.tfstate" -backend-config="region=eu-central-1"
plan: config
@terraform plan -out terraform.tfplan
View gnupg.md

Encrypt file:

gpg --encrypt --armor --recipient email@example.com file

Decrypt file:

gpg --decrypt file
View Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.6.3"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "boot2docker"
config.vm.box = "yungsang/boot2docker"
config.vm.box_check_update = false
You can’t perform that action at this time.