File tree 1 file changed +11
-1
lines changed
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -239,12 +239,22 @@ action_deploy() {
239
239
--extra-vars @./.spin.yml \
240
240
--extra-vars " spin_environment=$deployment_environment " \
241
241
--extra-vars " spin_ci_folder=$SPIN_CI_FOLDER " \
242
- --tags " get-host" \
242
+ --tags " get-host,get-authorized-keys " \
243
243
" ${SPIN_ANSIBLE_ARGS[@]} " \
244
244
" ${SPIN_UNPROCESSED_ARGS[@]} "
245
245
246
246
docker_swarm_manager=$( cat " $SPIN_CI_FOLDER /${deployment_environment_uppercase} _SSH_REMOTE_HOSTNAME" )
247
247
248
+ # Read and export authorized keys
249
+ if [[ -f " $SPIN_CI_FOLDER /AUTHORIZED_KEYS" ]]; then
250
+ # Read the file content and escape newlines for Docker
251
+ AUTHORIZED_KEYS=$( awk 1 ORS=' \\n' " $SPIN_CI_FOLDER /AUTHORIZED_KEYS" | sed ' s/\\n$//' )
252
+ export AUTHORIZED_KEYS
253
+ echo " ${BOLD}${BLUE} 🔑 Authorized keys loaded and exported as AUTHORIZED_KEYS${RESET} "
254
+ else
255
+ echo " ${BOLD}${YELLOW} ⚠️ Warning: No AUTHORIZED_KEYS file found in $SPIN_CI_FOLDER ${RESET} "
256
+ fi
257
+
248
258
if [ $? -ne 0 ] || [ -z " $docker_swarm_manager " ]; then
249
259
echo " ${BOLD}${RED} ❌ Error: Failed to get a valid swarm manager host for group '$deployment_environment '.${RESET} " >&2
250
260
exit 1
You can’t perform that action at this time.
0 commit comments