This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This step generates an image tag based on git tree hash of the source folder so | |
# the tag changes whenever your source changes and will trigger new builds/pulls. | |
# If the image is tracking an upstream app, I'll add a "{{ base_tag }}-" prefix | |
# so I get a new image if the source version changes but my wrapper does not. | |
# This can be hidden in vars/main.yml to avoid a dedicated step | |
- set_fact: | |
# Extracted for shorter lines - this command assumes the parent directory to | |
# roles/ is the root of a git repository. | |
get_tag_cmd: git rev-parse HEAD:roles/myapp/files/docker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# If not set, tell the user what variable we're looking for. | |
if [ -z "$SOMETHING" ]; then | |
echo "Missing vault pass. Set:" | |
echo " export SOMETHING='SECRET'" | |
exit | |
fi | |
# Ansible checks this variable for executable or password as text. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: swarm_manager | |
gather_facts: no | |
tasks: | |
- name: run pre-flight checks | |
fail: | |
msg: '{{ checks[item].message }}' | |
register: r | |
# abort after first failure - https://medium.com/opsops/how-to-break-from-the-loop-in-ansible-1e8ebb92be0d | |
when: not (r.failed|d(false)) and checks[item].condition |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hudson.model.Result | |
import org.jenkinsci.plugins.workflow.steps.FlowInterruptedException | |
// Callable as a step, defined in vars/ | |
void call() { | |
if (this.isBranchIndexingCause()) { | |
echo "ABORTED: $message" | |
throw new FlowInterruptedException(Result.NOT_BUILT) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inputs: | |
# proxmox_host # ansible host running proxmox. Is also destination node: for container | |
# proxmox_user | |
# proxmox_pass | |
# vmid # ID for lxc instance in proxmox | |
# admin_ssh_keys # SSH keys to install for passwordless login | |
--- | |
- hosts: lxc_guests | |
vars: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Input: | |
# containerd_version: 1.6.4 | |
- name: download containerd | |
ansible.builtin.unarchive: | |
src: 'https://github.com/containerd/containerd/releases/download/v{{ containerd_version }}/containerd-{{ containerd_version }}-linux-{{ a[ansible_distribution].tar.gz' | |
dest: '/usr/local' | |
remote_src: yes | |
vars: | |
# Translate ansible_architecture to containerd arch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static def getBuildParameters(currentBuild) { | |
def project = currentBuild.getRawBuild().getParent() | |
def params = null | |
// Find or create parameters object | |
for (e in project.properties) { | |
if (e.value instanceof ParametersDefinitionProperty) { | |
params = e.value | |
break | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse | |
from beancount import loader | |
from beancount.core.data import Balance, Open, Close | |
class Report: | |
def __init__(self): | |
self.accounts = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
eeval () { | |
set -x | |
"$@" | |
{ set +x; } 2>/dev/null | |
} | |
# Print command and evaluate | |
eeval touch file |
NewerOlder