Skip to content
Snippets Groups Projects
Commit 706795c4 authored by František Řezníček's avatar František Řezníček
Browse files

feat: add ssh keypair mounting / generation

parent 4bc593be
No related branches found
No related tags found
No related merge requests found
Pipeline #435952 passed
......@@ -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
# ---------------------------------------------------------------------------
......
......@@ -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
......
......@@ -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
......
......@@ -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
}
......@@ -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
......
......@@ -7,7 +7,7 @@ variable "infra_name" {
}
variable "ssh_public_key" {
default = "~/.ssh/id_rsa.pub"
default = "id_rsa.pub"
}
variable "internal_network_cidr" {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment