A simple experiment.
By creating bash functions for common Dockerfile commands (e.g., RUN, COPY) you can sort of implement docker build as a bash script.
It's sort of like a cheap buildah knockoff.
It creates the image example:build.bash
| // Requires https://plugins.jenkins.io/mask-passwords to run | |
| /** | |
| * Runs code with secret environment variables and hides the values. | |
| * | |
| * @param varAndPasswordList - A list of Maps with a 'var' and 'password' key. Example: `[[var: 'TOKEN', password: 'sekret']]` | |
| * @param Closure - The code to run in | |
| * @return {void} | |
| */ | |
| def withSecretEnv(List<Map> varAndPasswordList, Closure closure) { |
A simple experiment.
By creating bash functions for common Dockerfile commands (e.g., RUN, COPY) you can sort of implement docker build as a bash script.
It's sort of like a cheap buildah knockoff.
It creates the image example:build.bash
| #!/bin/bash | |
| # | |
| # Usage: ./run.bash $(sort --random-sort /usr/share/dict/words| head -n10 ) | tee /tmp/foo.html | |
| set -euo pipefail | |
| function string_to_color_hex { | |
| local -r string="$1" | |
| local -r hash=$(echo -n "$string" | md5sum | cut -d' ' -f1) | |
| local -ir r=$((16#${hash:0:2})) |
| #!/usr/bin/env groovy | |
| // This works in Jenkinsfiles without approving any scripts. | |
| class MyProfiler { | |
| def timings | |
| def dsl | |
| MyProfiler(dsl) { | |
| this.timings = [:] |
| module gist.github.com/e3b13265d24471651e02f7d7a42e7d2c | |
| go 1.18 |
| #!/bin/sh | |
| set -eu | |
| tempdir='' | |
| setup() { | |
| tempdir="$(mktemp -d)" | |
| cd "$tempdir" |
| #!/bin/zsh | |
| set -eu | |
| cd "${0:h}" | |
| die() { | |
| echo "death: $*" >&2 | |
| exit | |
| } |
| #!/bin/bash | |
| # | |
| # Tracebacks in bash | |
| # https://docwhat.org/tracebacks-in-bash/ | |
| # | |
| # Just take the code between the "cut here" lines | |
| # and put it in your own program. | |
| # | |
| # Written by Christian Höltje | |
| # Donated to the public domain in 2013 |