Skip to content

Commit fdd8b56

Browse files
authored
Merge pull request #32 from mmguero-dev/develop
v3.0.5 updates, adapt scripts to run with th either docker or podman
2 parents 6089942 + 8633697 commit fdd8b56

16 files changed

+56
-36
lines changed

.github/workflows/navv-build-push-ghcr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
password: ${{ secrets.GITHUB_TOKEN }}
4141
-
4242
name: Build and push
43-
uses: docker/build-push-action@v3
43+
uses: docker/build-push-action@v4
4444
with:
4545
context: .
4646
file: ./docker/Dockerfile

.github/workflows/publish-to-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v3
1414
- name: Set up Python 3.10
15-
uses: actions/setup-python@v4.3.0
15+
uses: actions/setup-python@v4.5.0
1616
with:
1717
python-version: "3.10"
1818
- name: Install pypa/build

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
© 2021 Battelle Energy Alliance, LLC
3+
© 2023 Battelle Energy Alliance, LLC
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Github cisagov/network-architecture-verification-and-validation
33
Licensed under BSD-3 License.
44

55

6-
© 2021 Battelle Energy Alliance, LLC
6+
© 2023 Battelle Energy Alliance, LLC
77
ALL RIGHTS RESERVED
88

99
Prepared by Battelle Energy Alliance, LLC

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ See [`docker/README.md`](./docker/README.md) for setup and instructions for runn
255255

256256
## <a name="Footer"></a>Copyright
257257

258-
[NAVV](https://github.com/cisagov/network-architecture-verification-and-validation) is Copyright 2021 Battelle Energy Alliance, LLC, licensed under the BSD-3 Clause License.
258+
[NAVV](https://github.com/cisagov/network-architecture-verification-and-validation) is Copyright 2023 Battelle Energy Alliance, LLC, licensed under the BSD-3 Clause License.
259259

260260
See [`LICENSE`](./LICENSE) for the terms of its release.
261261

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM ubuntu:22.04
22

3-
# Copyright 2021 Battelle Energy Alliance, LLC
3+
# Copyright 2023 Battelle Energy Alliance, LLC
44

55
LABEL maintainer="[email protected]"
66
LABEL org.opencontainers.image.authors='[email protected]'

docker/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,6 @@ total 9.4M
104104
```
105105
## <a name="Footer"></a>Copyright
106106

107-
[NAVV](https://github.com/cisagov/network-architecture-verification-and-validation) is Copyright 2021 Battelle Energy Alliance, LLC, licensed under the BSD-3 Clause License.
107+
[NAVV](https://github.com/cisagov/network-architecture-verification-and-validation) is Copyright 2023 Battelle Energy Alliance, LLC, licensed under the BSD-3 Clause License.
108108

109109
See [`LICENSE`](./LICENSE) for the terms of its release.

docker/backup_docker.sh

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,37 @@
11
#!/usr/bin/env bash
22

3-
# Copyright 2021 Battelle Energy Alliance, LLC
3+
# Copyright 2023 Battelle Energy Alliance, LLC
44

55
set -e
66
set -o pipefail
77
set -u
88

99
ENCODING="utf-8"
1010

11+
# image name (can be overriden via NAVV_DOCKER_IMAGE env. var.)
12+
NAVV_DOCKER_IMAGE="${NAVV_DOCKER_IMAGE:-ghcr.io/cisagov/network-architecture-verification-and-validation:latest}"
13+
# container engine (docker vs. podman, can be overriden via CONTAINER_ENGINE env. var.)
14+
CONTAINER_ENGINE="${CONTAINER_ENGINE:-docker}"
15+
1116
[[ "$(uname -s)" = 'Darwin' ]] && REALPATH=grealpath || REALPATH=realpath
1217
[[ "$(uname -s)" = 'Darwin' ]] && DIRNAME=gdirname || DIRNAME=dirname
13-
if ! (type "$REALPATH" && type "$DIRNAME" && type docker) > /dev/null; then
14-
echo "$(basename "${BASH_SOURCE[0]}") requires docker, $REALPATH and $DIRNAME"
18+
if ! (type "$REALPATH" && type "$DIRNAME" && type "$CONTAINER_ENGINE") > /dev/null; then
19+
echo "$(basename "${BASH_SOURCE[0]}") requires $CONTAINER_ENGINE, $REALPATH and $DIRNAME"
1520
exit 1
1621
fi
1722
export SCRIPT_PATH="$($DIRNAME $($REALPATH -e "${BASH_SOURCE[0]}"))"
1823

19-
# default docker image name (can be overriden via NAVV_DOCKER_IMAGE env. var.)
20-
NAVV_DOCKER_IMAGE="${NAVV_DOCKER_IMAGE:-ghcr.io/cisagov/network-architecture-verification-and-validation:latest}"
21-
2224
# save tarball with image creation date and sha
23-
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
25+
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
2426

25-
# backup docker image and navv-docker.sh
26-
docker save "$NAVV_DOCKER_IMAGE" | gzip > "$DOCKER_BACKUP_FILENAME"
27+
# backup image and navv-docker.sh
28+
if [[ "$CONTAINER_ENGINE" == "podman" ]]; then
29+
$CONTAINER_ENGINE save --format oci-archive "$NAVV_DOCKER_IMAGE" | gzip > "$DOCKER_BACKUP_FILENAME"
30+
else
31+
$CONTAINER_ENGINE save "$NAVV_DOCKER_IMAGE" | gzip > "$DOCKER_BACKUP_FILENAME"
32+
fi
2733
[[ ! -r navv-docker.sh ]] && cp "$SCRIPT_PATH"/navv-docker.sh ./
2834

2935
echo "Transfer $DOCKER_BACKUP_FILENAME and navv-docker.sh to destination host" | tee ./navv_export.txt
30-
echo "Import $NAVV_DOCKER_IMAGE with docker load -i $DOCKER_BACKUP_FILENAME" | tee -a ./navv_export.txt
36+
echo "Import $NAVV_DOCKER_IMAGE with $CONTAINER_ENGINE load -i $DOCKER_BACKUP_FILENAME" | tee -a ./navv_export.txt
3137
echo "Run with navv-docker.sh" | tee -a ./navv_export.txt

docker/build_docker.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
#!/usr/bin/env bash
22

3-
# Copyright 2021 Battelle Energy Alliance, LLC
3+
# Copyright 2023 Battelle Energy Alliance, LLC
44

55
set -e
66
set -o pipefail
77
set -u
88

99
ENCODING="utf-8"
1010

11+
# image name (can be overriden via NAVV_DOCKER_IMAGE env. var.)
12+
NAVV_DOCKER_IMAGE="${NAVV_DOCKER_IMAGE:-ghcr.io/cisagov/network-architecture-verification-and-validation:latest}"
13+
# container engine (docker vs. podman, can be overriden via CONTAINER_ENGINE env. var.)
14+
CONTAINER_ENGINE="${CONTAINER_ENGINE:-docker}"
15+
1116
[[ "$(uname -s)" = 'Darwin' ]] && REALPATH=grealpath || REALPATH=realpath
1217
[[ "$(uname -s)" = 'Darwin' ]] && DIRNAME=gdirname || DIRNAME=dirname
13-
if ! (type "$REALPATH" && type "$DIRNAME" && type docker) > /dev/null; then
14-
echo "$(basename "${BASH_SOURCE[0]}") requires docker, $REALPATH and $DIRNAME"
18+
if ! (type "$REALPATH" && type "$DIRNAME" && type $CONTAINER_ENGINE) > /dev/null; then
19+
echo "$(basename "${BASH_SOURCE[0]}") requires $CONTAINER_ENGINE, $REALPATH and $DIRNAME"
1520
exit 1
1621
fi
1722
export SCRIPT_PATH="$($DIRNAME $($REALPATH -e "${BASH_SOURCE[0]}"))"
1823

1924
pushd "$SCRIPT_PATH"/.. >/dev/null 2>&1
2025

21-
docker build -f docker/Dockerfile -t ghcr.io/cisagov/network-architecture-verification-and-validation:latest "$@" .
26+
$CONTAINER_ENGINE build -f docker/Dockerfile -t ghcr.io/cisagov/network-architecture-verification-and-validation:latest "$@" .
2227

2328
popd >/dev/null 2>&1

docker/navv-build-for-export.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
# Copyright 2021 Battelle Energy Alliance, LLC
3+
# Copyright 2023 Battelle Energy Alliance, LLC
44

55
set -o pipefail
66
set -u

0 commit comments

Comments
 (0)