File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 8585 uses : actions/checkout@v4
8686 with :
8787 repository : ' code-kern-ai/cicd-deployment-scripts'
88+
89+ - name : Setup SSH known_hosts
90+ run : |
91+ mkdir -p -m 0700 ~/.ssh
92+ echo "${{ env.SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
93+ chmod 600 ~/.ssh/known_hosts
8894
8995 - name : Perform Registry Image Deletion
9096 shell : bash
Original file line number Diff line number Diff line change @@ -15,10 +15,9 @@ DELETE_SINCE_DAYS=""
1515SSH_KEY=" "
1616SSH_USER=" "
1717SSH_HOST=" "
18- SSH_KNOWN_HOSTS=" "
1918FORCE_DELETE_REPO=false
2019
21- while getopts e:g:r:a:t:u:d:p:s:h:k: f: flag
20+ while getopts e:g:r:a:t:u:d:p:s:h:f: flag
2221do
2322 case " ${flag} " in
2423 e) ENVIRONMENT_NAME=${OPTARG} ;;
3130 p) SSH_KEY=${OPTARG} ;;
3231 s) SSH_USER=${OPTARG} ;;
3332 h) SSH_HOST=${OPTARG} ;;
34- k) SSH_KNOWN_HOSTS=${OPTARG} ;;
3533 f) FORCE_DELETE_REPO=${OPTARG} ;;
3634 esac
3735done
@@ -80,7 +78,6 @@ function delete_since_days() {
8078}
8179
8280function force_delete_repo() {
83- cp ~ /.ssh/known_hosts ~ /.ssh/known_hosts.old && echo " $SSH_KNOWN_HOSTS " > ~ /.ssh/known_hosts
8481 echo " $SSH_KEY " | ssh $SSH_USER @$SSH_HOST " cd ci-setup && docker exec -i -u root ci-setup_registry_1 bin/registry garbage-collect --delete-untagged /etc/docker/registry/config.yml"
8582 echo " $SSH_KEY " | ssh $SSH_USER @$SSH_HOST " cd ci-setup && docker exec -i -u root ci-setup_registry_1 rm -rf /var/lib/registry/docker/registry/v2/repositories/$GITHUB_OWNER /$APP_NAME "
8683 echo " ::warning::force deleted $REGISTRY_URL /$GITHUB_OWNER /$APP_NAME "
You can’t perform that action at this time.
0 commit comments