-
Couldn't load subscription status.
- Fork 450
Update Dockerfile: add labels and bats org libs #674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
martin-schulze-vireso
merged 19 commits into
bats-core:master
from
brokenpip3:dockerfile-bats-libs
Jan 14, 2023
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
ed6ea68
add labels, do not use root, start to add libs
brokenpip3 57cb398
fix docker hub label
brokenpip3 64453f1
add utility to download and install the bats libs
brokenpip3 f648cc2
fix duplicate exit trap https://github.com/bats-core/bats-core/pull/6…
brokenpip3 785c9e1
make if more readable, ref: https://github.com/bats-core/bats-core/pu…
brokenpip3 6fa8c9a
fix(install_libs) move check param to the top, ref https://github.com…
brokenpip3 4a43668
fix(dockerfile): add arg with defaults instead of hardcoding values
brokenpip3 bc16a7a
Add test via Dockerfile
martin-schulze-vireso 4060d25
Warn if runlog can't be created
martin-schulze-vireso 2a01202
CI: Add test for official docker image
martin-schulze-vireso f4eb785
Fix shellcheck
martin-schulze-vireso 35769e8
Add changelog entry for #674
martin-schulze-vireso 8341a07
Fix expand_path for one element paths (like /code)
martin-schulze-vireso e4a3275
Also test libraries
martin-schulze-vireso 8ee52d4
Make volume mounts work in default case
martin-schulze-vireso 2911163
Improve output
martin-schulze-vireso 0e0dad5
Docker: Undo unprivileged user for now
martin-schulze-vireso 9cc95c6
Add missing dependencies for bats-file
martin-schulze-vireso 8d43d5c
Install libs in correct default location
martin-schulze-vireso File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -o errexit | ||
| set -o nounset | ||
|
|
||
|
|
||
| LIBNAME="${1:-support}" | ||
| LIVERSION="${2:-0.3.0}" | ||
brokenpip3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| BASEURL='https://github.com/bats-core' | ||
| DESTDIR="${BATS_LIBS_DEST_DIR:-/usr/lib/bats}" | ||
| TMPDIR=$(mktemp -d -t bats-libs-XXXXXX) | ||
| USAGE="Please provide the bats libe name and version \nFor example: install_libs.sh support 2.0.0\n" | ||
|
|
||
| trap 'test -d "${TMPDIR}" && rm -fr "${TMPDIR}"' EXIT ERR SIGINT SIGTERM | ||
|
|
||
| [[ $# -ne 2 ]] && { _log FATAL "$USAGE"; exit 1; } | ||
|
|
||
| _log() { | ||
| printf "$(date "+%Y-%m-%d %H:%M:%S") - %s - %s\n" "${1}" "${2}" | ||
| } | ||
|
|
||
| create_temp_dirs() { | ||
| mkdir -p "${TMPDIR}/${1}" | ||
| if [[ ${LIBNAME} != "detik" ]]; then | ||
| mkdir -p "${DESTDIR}/bats-${1}/src" | ||
| else | ||
| _log INFO "Skipping src 'cause Detik does not need it" | ||
| fi | ||
| } | ||
|
|
||
| download_extract_source() { | ||
| wget -qO- ${BASEURL}/bats-"${1}"/archive/refs/tags/v"${2}".tar.gz | tar xz -C "${TMPDIR}/${1}" --strip-components 1 | ||
| } | ||
|
|
||
| install_files() { | ||
| if [[ ${LIBNAME} != "detik" ]]; then | ||
| install -Dm755 "${TMPDIR}/${1}/load.bash" "${DESTDIR}/bats-${1}/load.bash" | ||
| for fn in "${TMPDIR}/${1}/src/"*.bash; do install -Dm755 "$fn" "${DESTDIR}/bats-${1}/src/$(basename "$fn")"; done | ||
| else | ||
| for fn in "${TMPDIR}/${1}/lib/"*.bash; do install -Dm755 "$fn" "${DESTDIR}/bats-${1}/$(basename "$fn")"; done | ||
| fi | ||
| } | ||
|
|
||
| _log INFO "Starting to install ${LIBNAME} ver ${LIVERSION}" | ||
| _log INFO "Creating directories" | ||
| create_temp_dirs "${LIBNAME}" | ||
| _log INFO "Downloading" | ||
| download_extract_source "${LIBNAME}" "${LIVERSION}" | ||
| _log INFO "Installation" | ||
| install_files "${LIBNAME}" | ||
| _log INFO "Done, cleaning.." | ||
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 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 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.