-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00695dd
commit 6fecf50
Showing
3 changed files
with
107 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Prepare EKS Metadata | ||
description: Prepares the EKS enclave metadata | ||
|
||
inputs: | ||
operator_image_version: | ||
description: The uid2-operator image version | ||
default: latest | ||
admin_root: | ||
description: The root path for uid2-admin folder | ||
default: uid2-admin | ||
|
||
outputs: | ||
image_hash: | ||
description: The operator image hash | ||
value: ${{ steps.image_digest.outputs.IMAGE_HASH }} | ||
operator_key: | ||
description: The operator key | ||
value: ${{ steps.enclave_metadata.outputs.OPERATOR_KEY }} | ||
|
||
runs: | ||
using: "composite" | ||
|
||
steps: | ||
- name: Prepare EKS enclave deployment files | ||
id: enclave_metadata | ||
shell: bash | ||
env: | ||
IMAGE_VERSION: ${{ inputs.operator_image_version }} | ||
run: | | ||
bash uid2-shared-actions/scripts/prepare_eks_deployment_files.sh | ||
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
ROOT="uid2-shared-actions/scripts/eks" | ||
INPUT_DIR="${ROOT}/artifacts_schema" | ||
OUTPUT_DIR="${ROOT}/azure-artifacts" | ||
|
||
if [ -z "${IMAGE_VERSION}" ]; then | ||
echo "IMAGE_VERSION can not be empty" | ||
exit 1 | ||
fi | ||
|
||
IMAGE="ghcr.io/iabtechlab/uid2-operator-eks-uid2:${IMAGE_VERSION}" | ||
|
||
if [ -d "${OUTPUT_DIR}" ]; then | ||
echo "${OUTPUT_DIR} exists" | ||
fi | ||
|
||
INPUT_TEMPLATE_FILE="${INPUT_DIR}/template.json" | ||
INPUT_PARAMETERS_FILE="${INPUT_DIR}/parameters.json" | ||
OUTPUT_TEMPLATE_FILE="${OUTPUT_DIR}/template.json" | ||
OUTPUT_PARAMETERS_FILE="${OUTPUT_DIR}/parameters.json" | ||
OUTPUT_POLICY_DIGEST_FILE="${OUTPUT_DIR}/digest.txt" | ||
|
||
if [[ -d ${OUTPUT_DIR} ]]; then | ||
echo "${OUTPUT_DIR} exists, skipping - this only happens during local testing" | ||
else | ||
mkdir -p ${OUTPUT_DIR} | ||
|
||
# Install confcom extension, az is originally available in GitHub workflow environment | ||
az extension add --name confcom | ||
if [[ $? -ne 0 ]]; then | ||
echo "Failed to install Azure confcom extension" | ||
exit 1 | ||
fi | ||
|
||
# Required by az confcom | ||
sudo usermod -aG docker ${USER} | ||
if [[ $? -ne 0 ]]; then | ||
echo "Failed to add current user to Docker group" | ||
exit 1 | ||
fi | ||
|
||
# Generate deployment template | ||
cp ${INPUT_TEMPLATE_FILE} ${OUTPUT_TEMPLATE_FILE} | ||
sed -i "s#IMAGE_PLACEHOLDER#${IMAGE}#g" ${OUTPUT_TEMPLATE_FILE} | ||
if [[ $? -ne 0 ]]; then | ||
echo "Failed to pre-process template file" | ||
exit 1 | ||
fi | ||
|
||
az confcom acipolicygen --approve-wildcards --template-file ${OUTPUT_TEMPLATE_FILE} > ${OUTPUT_POLICY_DIGEST_FILE} | ||
if [[ $? -ne 0 ]]; then | ||
echo "Failed to generate template file" | ||
exit 1 | ||
fi | ||
|
||
cp ${INPUT_PARAMETERS_FILE} ${OUTPUT_PARAMETERS_FILE} | ||
fi | ||
|
||
if [ -z "${GITHUB_OUTPUT}" ]; then | ||
echo "Not in GitHub action" | ||
else | ||
echo "OUTPUT_TEMPLATE_FILE=${OUTPUT_TEMPLATE_FILE}" >> ${GITHUB_OUTPUT} | ||
echo "OUTPUT_PARAMETERS_FILE=${OUTPUT_PARAMETERS_FILE}" >> ${GITHUB_OUTPUT} | ||
echo "OUTPUT_POLICY_DIGEST_FILE=${OUTPUT_POLICY_DIGEST_FILE}" >> ${GITHUB_OUTPUT} | ||
fi |