Skip to content

Commit

Permalink
Adding script to customize images for Eviden Trustway
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauricio Harley committed Sep 20, 2024
1 parent bd70200 commit f82b988
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
8 changes: 5 additions & 3 deletions hack/automation_scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ procedures might differ. You need to run the script corresponding to the vendor
For the Eviden (previously, ATOS) Trustway HSMs, you will use the `build_custom_image-eviden.sh` script. The usage is as follows:

```bash
$ bash build_custom_image-eviden.sh <registry_host> <namespace> <barbican-api_image_tag> <barbican-worker_image_tag> <eviden_iso_file>
$ bash build_custom_image-eviden.sh <source_registry_host> <namespace> <barbican-api_image_tag> <barbican-worker_image_tag> <eviden_iso_file> <destination_registry_host>
```

where:
* `registry_host`: corresponds to the FQDN (Fully Qualified Domain Name) of the registry that holds the default container images.
* `source_registry_host`: corresponds to the FQDN (Fully Qualified Domain Name) of the registry that holds the default container images.
Example: quay.io.
* `namespace`: it's an internal repository organization that matches the OpenStack distribution with an operating system. Example: `podified-antelope-centos9`.
* `barbican-api_image_tag`: because OpenStack container images may not have the usual `latest` tag, you may need to manually obtain and provide the newest tag. Example: `75c508097e39a3423d9f2eef86648c4e`.
* `barbican-worker_image_tag`: something similar happens for the Barbican Worker image. Example: `71849c7583fa95ee18dcc0c73c93569d`.
* `eviden_iso_file`: this is the filename of the ISO file holding the Eviden HSM client software. Example: `Proteccio3.00.03.iso`. **Please put it in the same directory as this script.**
* `destination_registry_host`: corresponds to the FQDN (Fully Qualified Domain Name) of the registry that will store the customized container images.
Example: hub.docker.com.

>**Note 1**<br>
**You need to edit the `build_custom_image-eviden.sh` script to include your username on the container registry. <br> This is necessary since one of the final steps the script takes is to push the new customized image to the registry.**
Expand All @@ -40,4 +42,4 @@ The script proceeds as follows:
5. Pushes the new image to the registry host you provided as parameter. **For this sake, the script needs to be edited to have your username on this registry host.**
6. Unmounts the ISO client software and deletes the temporary directory created on step 2.

After this script successfully runs, you can start your Barbican operator deployment.
After this script successfully runs, you can start your Barbican operator deployment.
16 changes: 9 additions & 7 deletions hack/build_custom_image-eviden.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# including the HSM vendor's client software.
# Vendor: Eviden

if [ "$#" -ne 5 ]; then
echo "Usage: $0 <registry_host> <namespace> <barbican-api_image_tag> <barbican-worker_image_tag> <eviden_iso_file>"
if [ "$#" -ne 6 ]; then
echo "Usage: $0 <source_registry_host> <namespace> <barbican-api_image_tag> <barbican-worker_image_tag> <eviden_iso_file> <destination_registry_host>"
exit 1
fi

Expand All @@ -13,18 +13,19 @@ NAMESPACE=$2
API_IMAGE_TAG=$3
WORKER_IMAGE_TAG=$4
EVIDEN_ISO_FILE=$5
DESTINATION_HOST=$6
TEMP_ISO_DIR=iso_eviden
USERNAME=replace_with_your_registry_username
USERNAME=replace_with_your_destination_registry_username

echo
echo "You need to be logged into your registry for this script to work."
echo "If you're not logged in, stop this script now and log in with 'podman login'."

echo
echo "Downloading Barbican API image..."
echo "Downloading Barbican API image from source registry..."
podman pull $REGISTRY_HOST/$NAMESPACE/openstack-barbican-api:$API_IMAGE_TAG
echo
echo "Downloading Barbican Worker image..."
echo "Downloading Barbican Worker image from source registry..."
podman pull $REGISTRY_HOST/$NAMESPACE/openstack-barbican-worker:$WORKER_IMAGE_TAG

echo
Expand Down Expand Up @@ -67,9 +68,10 @@ echo "Building new container images..."
buildah bud -t barbican-api-custom:$API_IMAGE_TAG -f Dockerfile.barbican-api
buildah bud -t barbican-worker-custom:$WORKER_IMAGE_TAG -f Dockerfile.barbican-worker

echo "Pushing new images to the registry..."
echo
echo "Pushing new images to the destination registry..."
# Replace the registry URL with the appropriate one for your environment
REGISTRY_URL=$(REGISTRY_HOST)/$(USERNAME)
REGISTRY_URL=$(DESTINATION_HOST)/$(USERNAME)

podman tag barbican-api-custom:$API_IMAGE_TAG $REGISTRY_URL/barbican-api-custom:$API_IMAGE_TAG
podman push $REGISTRY_URL/barbican-api-custom:$API_IMAGE_TAG
Expand Down

0 comments on commit f82b988

Please sign in to comment.