Skip to content

Commit

Permalink
fix: delete 로직 수정:
Browse files Browse the repository at this point in the history
  • Loading branch information
GitJIHO committed Jan 5, 2025
1 parent 271efba commit f9954ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/docker-push-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,9 @@ jobs:
- name: Delete old Pods after successful rollout
run: |
NEW_POD=$(kubectl get pods -l app=knutoyproject -o jsonpath='{.items[?(@.status.phase=="Running")].metadata.name}' --kubeconfig ~/.kube/config --insecure-skip-tls-verify | head -n 1)
kubectl get pods -l app=knutoyproject --kubeconfig ~/.kube/config --insecure-skip-tls-verify -o jsonpath='{.items[?(@.metadata.name!="'"$NEW_POD"'")].metadata.name}' | xargs -I {} kubectl delete pod {} --kubeconfig ~/.kube/config --insecure-skip-tls-verify
echo "Fetching the most recently created Pod..."
NEW_POD=$(kubectl get pods -l app=knutoyproject --sort-by=.metadata.creationTimestamp --kubeconfig ~/.kube/config --insecure-skip-tls-verify | head -n 1 | awk '{print $1}')
echo "New Pod: $NEW_POD"
echo "Deleting older Pods..."
kubectl get pods -l app=knutoyproject --kubeconfig ~/.kube/config --insecure-skip-tls-verify --sort-by=.metadata.creationTimestamp | tail -n +2 | head -n -1 | awk '{print $1}' | xargs kubectl delete pod --kubeconfig ~/.kube/config --insecure-skip-tls-verify
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ public class testController {

@GetMapping("/api")
public ResponseEntity<String> mainPage() {
return ResponseEntity.ok().body("test8");
return ResponseEntity.ok().body("test10");
}

@GetMapping("/api/oh")
public ResponseEntity<String> sidePage() {
return ResponseEntity.ok().body("new test9");
return ResponseEntity.ok().body("new test10");
}
}

0 comments on commit f9954ea

Please sign in to comment.