-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v3.0.5 updates, adapt scripts to run with th either docker or podman
- Loading branch information
Showing
14 changed files
with
54 additions
and
34 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
FROM ubuntu:22.04 | ||
|
||
# Copyright 2021 Battelle Energy Alliance, LLC | ||
# Copyright 2023 Battelle Energy Alliance, LLC | ||
|
||
LABEL maintainer="[email protected]" | ||
LABEL org.opencontainers.image.authors='[email protected]' | ||
|
This file contains 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 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 |
---|---|---|
@@ -1,31 +1,37 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2021 Battelle Energy Alliance, LLC | ||
# Copyright 2023 Battelle Energy Alliance, LLC | ||
|
||
set -e | ||
set -o pipefail | ||
set -u | ||
|
||
ENCODING="utf-8" | ||
|
||
# image name (can be overriden via NAVV_DOCKER_IMAGE env. var.) | ||
NAVV_DOCKER_IMAGE="${NAVV_DOCKER_IMAGE:-ghcr.io/cisagov/network-architecture-verification-and-validation:latest}" | ||
# container engine (docker vs. podman, can be overriden via CONTAINER_ENGINE env. var.) | ||
CONTAINER_ENGINE="${CONTAINER_ENGINE:-docker}" | ||
|
||
[[ "$(uname -s)" = 'Darwin' ]] && REALPATH=grealpath || REALPATH=realpath | ||
[[ "$(uname -s)" = 'Darwin' ]] && DIRNAME=gdirname || DIRNAME=dirname | ||
if ! (type "$REALPATH" && type "$DIRNAME" && type docker) > /dev/null; then | ||
echo "$(basename "${BASH_SOURCE[0]}") requires docker, $REALPATH and $DIRNAME" | ||
if ! (type "$REALPATH" && type "$DIRNAME" && type "$CONTAINER_ENGINE") > /dev/null; then | ||
echo "$(basename "${BASH_SOURCE[0]}") requires $CONTAINER_ENGINE, $REALPATH and $DIRNAME" | ||
exit 1 | ||
fi | ||
export SCRIPT_PATH="$($DIRNAME $($REALPATH -e "${BASH_SOURCE[0]}"))" | ||
|
||
# default docker image name (can be overriden via NAVV_DOCKER_IMAGE env. var.) | ||
NAVV_DOCKER_IMAGE="${NAVV_DOCKER_IMAGE:-ghcr.io/cisagov/network-architecture-verification-and-validation:latest}" | ||
|
||
# save tarball with image creation date and sha | ||
DOCKER_BACKUP_FILENAME=navv-docker_$(date -d "$(docker inspect --format='{{.Created}}' "$NAVV_DOCKER_IMAGE")" +"%Y%m%d_%H%M%S")_$(docker images --no-trunc --quiet "$NAVV_DOCKER_IMAGE" | cut -d: -f2 | cut -c 1-12).tar.gz | ||
DOCKER_BACKUP_FILENAME=navv-$CONTAINER_ENGINE-$(date -d "$($CONTAINER_ENGINE inspect --format='{{.Created}}' "$NAVV_DOCKER_IMAGE" | sed "s/ /T/" | sed "s/ +0000 UTC/Z/")" +"%Y%m%d_%H%M%S")_$($CONTAINER_ENGINE images --no-trunc --quiet "$NAVV_DOCKER_IMAGE" | cut -d: -f2 | cut -c 1-12).tar.gz | ||
|
||
# backup docker image and navv-docker.sh | ||
docker save "$NAVV_DOCKER_IMAGE" | gzip > "$DOCKER_BACKUP_FILENAME" | ||
# backup image and navv-docker.sh | ||
if [[ "$CONTAINER_ENGINE" == "podman" ]]; then | ||
$CONTAINER_ENGINE save --format oci-archive "$NAVV_DOCKER_IMAGE" | gzip > "$DOCKER_BACKUP_FILENAME" | ||
else | ||
$CONTAINER_ENGINE save "$NAVV_DOCKER_IMAGE" | gzip > "$DOCKER_BACKUP_FILENAME" | ||
fi | ||
[[ ! -r navv-docker.sh ]] && cp "$SCRIPT_PATH"/navv-docker.sh ./ | ||
|
||
echo "Transfer $DOCKER_BACKUP_FILENAME and navv-docker.sh to destination host" | tee ./navv_export.txt | ||
echo "Import $NAVV_DOCKER_IMAGE with docker load -i $DOCKER_BACKUP_FILENAME" | tee -a ./navv_export.txt | ||
echo "Import $NAVV_DOCKER_IMAGE with $CONTAINER_ENGINE load -i $DOCKER_BACKUP_FILENAME" | tee -a ./navv_export.txt | ||
echo "Run with navv-docker.sh" | tee -a ./navv_export.txt |
This file contains 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 |
---|---|---|
@@ -1,23 +1,28 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2021 Battelle Energy Alliance, LLC | ||
# Copyright 2023 Battelle Energy Alliance, LLC | ||
|
||
set -e | ||
set -o pipefail | ||
set -u | ||
|
||
ENCODING="utf-8" | ||
|
||
# image name (can be overriden via NAVV_DOCKER_IMAGE env. var.) | ||
NAVV_DOCKER_IMAGE="${NAVV_DOCKER_IMAGE:-ghcr.io/cisagov/network-architecture-verification-and-validation:latest}" | ||
# container engine (docker vs. podman, can be overriden via CONTAINER_ENGINE env. var.) | ||
CONTAINER_ENGINE="${CONTAINER_ENGINE:-docker}" | ||
|
||
[[ "$(uname -s)" = 'Darwin' ]] && REALPATH=grealpath || REALPATH=realpath | ||
[[ "$(uname -s)" = 'Darwin' ]] && DIRNAME=gdirname || DIRNAME=dirname | ||
if ! (type "$REALPATH" && type "$DIRNAME" && type docker) > /dev/null; then | ||
echo "$(basename "${BASH_SOURCE[0]}") requires docker, $REALPATH and $DIRNAME" | ||
if ! (type "$REALPATH" && type "$DIRNAME" && type $CONTAINER_ENGINE) > /dev/null; then | ||
echo "$(basename "${BASH_SOURCE[0]}") requires $CONTAINER_ENGINE, $REALPATH and $DIRNAME" | ||
exit 1 | ||
fi | ||
export SCRIPT_PATH="$($DIRNAME $($REALPATH -e "${BASH_SOURCE[0]}"))" | ||
|
||
pushd "$SCRIPT_PATH"/.. >/dev/null 2>&1 | ||
|
||
docker build -f docker/Dockerfile -t ghcr.io/cisagov/network-architecture-verification-and-validation:latest "$@" . | ||
$CONTAINER_ENGINE build -f docker/Dockerfile -t ghcr.io/cisagov/network-architecture-verification-and-validation:latest "$@" . | ||
|
||
popd >/dev/null 2>&1 |
This file contains 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 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 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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
"""This file defines the version of this module.""" | ||
__version__ = "3.0.4" | ||
__version__ = "3.0.5" |
This file contains 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 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 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 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