diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cfcd43e9c406c50c1122bd41551fd42eb64efd9f..22c77e83dd2c12a1f5170249d8b53547257ab7d7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,7 +16,7 @@ before_script: after_script: &container-images-list - echo "Pushed container images are:" -- awk '{print " " $0}' container-release.uri +- awk '{print " " $0}' ci/toolset-container/container-release.uri # build and release container image # --------------------------------------------------------------------------- diff --git a/CHANGELOG.md b/CHANGELOG.md index b68d1097c4198a4b6b041c40bcfa7a04bcfa31c0..12115c64b5e229c7abd8aea246c58784ae1693cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] + +## [1.5.0] - 2024-04-29 +### Fixed +- CI container listing +- add SSh key pair generation if needed + ## [1.4.0] - 2024-04-29 ### Fixed - container entrypoint diff --git a/ci/toolset-container/entrypoint.sh b/ci/toolset-container/entrypoint.sh index 83e95543a273da680c8d09e11d2eee2ed3959207..bb9e115461b781643fd988373a3f6d6d4a0d241b 100755 --- a/ci/toolset-container/entrypoint.sh +++ b/ci/toolset-container/entrypoint.sh @@ -23,6 +23,7 @@ elif [ "${OPERATION}" == "cloud-connect" ]; then ostack_cloud_connect elif [ "${OPERATION}" == "infra-deploy" -o "${OPERATION}" == "infra-destroy" ]; then + generate_ssh_keypair_if_missing id_rsa source_if_exists ${OPENSTACK_RC_FILES} ostack_cloud_connect project_type=group diff --git a/ci/toolset-container/lib.sh.inc b/ci/toolset-container/lib.sh.inc index 8f26c7182790f4a89a65d076265f2b75912a536a..50b7780a01271d2b8e26e54ca59f499324a3fbfd 100644 --- a/ci/toolset-container/lib.sh.inc +++ b/ci/toolset-container/lib.sh.inc @@ -68,3 +68,11 @@ function is_personal_project() { fi } +function generate_ssh_keypair_if_missing() { + local ssh_private_key_file="$1" + + if [ ! -s "${ssh_private_key_file}.pub" ]; then + ssh-keygen -t rsa -b 4096 -f "${ssh_private_key_file}" + fi +} + diff --git a/infra-action.sh b/infra-action.sh index 06d272a953fe7a0965fd133a15c16703b417c656..46b0f1bf682b85b49cb9b56d91f4b059bd1924c9 100755 --- a/infra-action.sh +++ b/infra-action.sh @@ -17,8 +17,15 @@ CONTAINER_RUNTIME_EXE=$(get_container_engine) CONTAINER_IMAGE="${CONTAINER_IMAGE:-"registry.gitlab.ics.muni.cz:443/cloud/terraform/modules/dask-distributed-2t-infra:1"}" REPO_NAME=dask-distributed-2t-infra +ADDITIONAL_ARGS="" +if [ "${HOME}/.ssh/id_rsa.pub" ]; then + ADDITIONAL_ARGS="-v ${HOME}/.ssh/id_rsa.pub:${WORKDIR}/${REPO_NAME}/example/id_rsa.pub:ro" +fi + if [[ "${OPERATION}" =~ ^(shell|cloud-connect|infra-deploy|infra-destroy)$ ]]; then - ${CONTAINER_RUNTIME_EXE} run -it -v "$PWD:${WORKDIR}/${REPO_NAME}" "${CONTAINER_IMAGE}" "${OPERATION}" + ${CONTAINER_RUNTIME_EXE} run -it -v "$PWD:${WORKDIR}/${REPO_NAME}" ${ADDITIONAL_ARGS} "${CONTAINER_IMAGE}" "${OPERATION}" +elif [ "${OPERATION}" == "-h" -o "${OPERATION}" == "--help" ]; then + awk 'NR>1{if ($1=="#"){$1=" ";print $0}else{exit(0)}}' $0 else logerr "ERROR: Invalid operation (${OPERATION})" exit 2 diff --git a/modules/2tier_public_bastion_private_vm_farm/variables.tf b/modules/2tier_public_bastion_private_vm_farm/variables.tf index 24c96e9f8c196b3239c8c2446ba631949615ab18..a6b5a82d0b100845351a2b6ad544093c44387de9 100644 --- a/modules/2tier_public_bastion_private_vm_farm/variables.tf +++ b/modules/2tier_public_bastion_private_vm_farm/variables.tf @@ -7,7 +7,7 @@ variable "infra_name" { } variable "ssh_public_key" { - default = "~/.ssh/id_rsa.pub" + default = "id_rsa.pub" } variable "internal_network_cidr" {