Skip to content
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

CASMINST-4471 simplify build and properly load nexus images with new podman #6

Merged
merged 1 commit into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.3
1.1.4
28 changes: 18 additions & 10 deletions systemd/nexus-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,21 @@ fi

NEXUS_PIDFILE="$1"
NEXUS_CIDFILE="$2"
NEXUS_CONTAINER_NAME="${3-nexus3}"
NEXUS_VOLUME_NAME="${4:-${NEXUS_CONTAINER_NAME}3-data}"
NEXUS_CONTAINER_NAME="${3-nexus}"
NEXUS_VOLUME_NAME="${4:-${NEXUS_CONTAINER_NAME}-data}"

NEXUS_VOLUME_MOUNT="/nexus-data:rw,exec"

set -x

# Create Nexus volume if not already present
if ! podman volume inspect "$NEXUS_VOLUME_NAME" ; then
if ! podman volume inspect "$NEXUS_VOLUME_NAME" &>/dev/null; then
# Load busybox image if it doesn't already exist
if ! podman image inspect "$NEXUS_IMAGE" >/dev/null; then
podman load -i "$NEXUS_IMAGE_PATH" "$NEXUS_IMAGE" || exit
if ! podman image inspect "$NEXUS_IMAGE" &>/dev/null; then
# load the image
podman load -i "$NEXUS_IMAGE_PATH" || exit
# get the tag
NEXUS_IMAGE_ID=$(podman images --noheading --format "{{.Id}}" --filter label="name=Nexus Repository Manager")
# tag the image
podman tag "$NEXUS_IMAGE_ID" "$NEXUS_IMAGE"
fi
podman run --rm --network host \
-v "${NEXUS_VOLUME_NAME}:${NEXUS_VOLUME_MOUNT}" \
Expand All @@ -68,11 +71,16 @@ fi
rm -f "$NEXUS_PIDFILE"

# Create Nexus container
if ! podman inspect "$NEXUS_CONTAINER_NAME" ; then
if ! podman inspect --type container "$NEXUS_CONTAINER_NAME" &>/dev/null; then
rm -f "$NEXUS_CIDFILE" || exit
# Load nexus image if it doesn't already exist
if ! podman image inspect "$NEXUS_IMAGE" >/dev/null; then
podman load "$NEXUS_IMAGE_PATH" "$NEXUS_IMAGE" || exit
if ! podman image inspect "$NEXUS_IMAGE" &>/dev/null; then
# load the image
podman load -i "$NEXUS_IMAGE_PATH"
# get the tag
NEXUS_IMAGE_ID=$(podman images --noheading --format "{{.Id}}" --filter label="name=Nexus Repository Manager")
# tag the image
podman tag "$NEXUS_IMAGE_ID" "$NEXUS_IMAGE"
fi
podman create \
--conmon-pidfile "$NEXUS_PIDFILE" \
Expand Down
9 changes: 7 additions & 2 deletions systemd/nexus-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,13 @@ fi

set -x

if ! podman image inspect "$NEXUS_SETUP_IMAGE" >/dev/null; then
podman load -i "$NEXUS_SETUP_IMAGE_PATH" "$NEXUS_SETUP_IMAGE" || exit
if ! podman image inspect --type image "$NEXUS_SETUP_IMAGE" &>/dev/null; then
# load the image
podman load -i "$NEXUS_SETUP_IMAGE_PATH" || exit
# get the image id
CRAY_NEXUS_SETUP_ID=$(podman images --noheading --format "{{.Id}}" --filter label="org.label-schema.name=cray-nexus-setup")
# tag the image
podman tag "$CRAY_NEXUS_SETUP_ID" "$NEXUS_SETUP_IMAGE"
fi

# Setup Nexus container (assumes Nexus is at http://localhost:8081)
Expand Down