Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gitea 클러스터 저장소 삭제 수정 #145

Merged
merged 1 commit into from
Feb 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions git-repo/delete-cluster-repo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,32 @@ spec:
activeDeadlineSeconds: 120
container:
name: 'deleteClusterSite'
image: harbor-cicd.taco-cat.xyz/tks/ghcli:2.5.1
image: harbor-cicd.taco-cat.xyz/tks/ghcli-alpine:2.0.0
imagePullPolicy: Always
command:
- /bin/bash
- -ecx
- |
echo $TOKEN | gh auth login --with-token
function gh_delete_repo() {
echo $TOKEN | gh auth login --with-token

gh repo delete ${USERNAME}/${CLUSTER_ID} --confirm
gh repo delete ${USERNAME}/${CLUSTER_ID}-manifests --confirm
gh repo delete ${USERNAME}/${CLUSTER_ID} --confirm
gh repo delete ${USERNAME}/${CLUSTER_ID}-manifests --confirm
}

function gitea_delete_repo() {
curl -X DELETE -H 'accept: application/json' -H "Authorization: token ${TOKEN}" $GIT_SVC_HTTP://${GIT_SVC_BASE_URL}/api/v1/repos/${USERNAME}/${CLUSTER_ID}
curl -X DELETE -H 'accept: application/json' -H "Authorization: token ${TOKEN}" $GIT_SVC_HTTP://${GIT_SVC_BASE_URL}/api/v1/repos/${USERNAME}/${CLUSTER_ID}-manifests
}

GIT_SVC_HTTP=${GIT_SVC_URL%://*}
GIT_SVC_BASE_URL=${GIT_SVC_URL#*//}

if [ "$GIT_SVC_TYPE" = "gitea" ];then
gitea_delete_repo
else
gh_delete_repo
fi
envFrom:
- secretRef:
name: "git-svc-token"
Expand Down