Skip to content

Commit 39626a7

Browse files
committed
reverted changes
1 parent f760062 commit 39626a7

File tree

2 files changed

+9
-48
lines changed

2 files changed

+9
-48
lines changed

.github/workflows/chicmoz-prod.yml

+8-47
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: CI/CD Chicmoz Prod
2+
# TODO
23

34
on:
45
push:
@@ -10,12 +11,11 @@ on:
1011
types:
1112
- closed
1213

13-
env:
14-
DOCKER_CONFIG: ${{ github.workspace }}/.docker
15-
1614
jobs:
1715
build_and_deploy:
18-
runs-on: ubuntu-latest
16+
runs-on:
17+
labels: ubuntu-latest
18+
1919
steps:
2020
- name: Checkout Repository
2121
uses: actions/checkout@v2
@@ -31,55 +31,16 @@ jobs:
3131
with:
3232
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
3333

34-
- name: Set up Docker authentication
35-
run: |
36-
mkdir -p ${{ env.DOCKER_CONFIG }}
37-
echo '{"auths":{"registry.digitalocean.com":{"auth":"'$(echo -n ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} | base64)'"}}}' > ${{ env.DOCKER_CONFIG }}/config.json
38-
39-
- name: Build and Push Images
40-
run: |
41-
MAX_RETRIES=3
42-
RETRY_DELAY=10
43-
44-
build_and_push() {
45-
for i in $(seq 1 $MAX_RETRIES); do
46-
if DOCKER_CONFIG=${{ env.DOCKER_CONFIG }} skaffold build --filename "k8s/production/skaffold.production.yaml" --default-repo=registry.digitalocean.com/aztlan-containers; then
47-
return 0
48-
fi
49-
echo "Attempt $i failed. Retrying in $RETRY_DELAY seconds..."
50-
sleep $RETRY_DELAY
51-
done
52-
return 1
53-
}
54-
55-
if build_and_push; then
56-
echo "Build and push successful"
57-
else
58-
echo "Build and push failed after $MAX_RETRIES attempts"
59-
exit 1
60-
fi
34+
- name: Log in to DigitalOcean Container Registry with short-lived credentials
35+
run: doctl registry login --expiry-seconds 1800
6136

6237
- name: Cleanup old images
6338
run: |
6439
chmod +x "./cleanup-script.sh"
65-
./cleanup-script.sh
40+
bash -x "./cleanup-script.sh"
6641
6742
- name: Save DigitalOcean kubeconfig
6843
run: doctl kubernetes cluster kubeconfig save "chicmoz-prod"
6944

7045
- name: Deploy to cluster with Skaffold
71-
run: |
72-
MAX_RETRIES=3
73-
RETRY_DELAY=10
74-
75-
for i in $(seq 1 $MAX_RETRIES); do
76-
if DOCKER_CONFIG=${{ env.DOCKER_CONFIG }} skaffold run --filename "k8s/production/skaffold.production.yaml" --default-repo=registry.digitalocean.com/aztlan-containers; then
77-
echo "Deployment successful"
78-
exit 0
79-
fi
80-
echo "Attempt $i failed. Retrying in $RETRY_DELAY seconds..."
81-
sleep $RETRY_DELAY
82-
done
83-
84-
echo "Deployment failed after $MAX_RETRIES attempts"
85-
exit 1
46+
run: skaffold run --filename "k8s/production/skaffold.production.yaml"

.github/workflows/cleanup-script.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ delete_old_tags() {
99
echo "Processing repository: $repo"
1010

1111
# List tags and filter for SHA-based tags, excluding the most recent 5
12-
SHA_TAGS=$(doctl registry repository list-tags "$repo" --format "Manifest Digest" --no-header | grep -E '^sha' | sort -r | tail -n +2) || true
12+
SHA_TAGS=$(doctl registry repository list-tags "$repo" --format "Manifest Digest" --no-header | grep -E '^sha' | sort -r | tail -n +3) || true
1313

1414
if [ -z "$SHA_TAGS" ]; then
1515
echo "No old SHA tags found for repository: $repo"

0 commit comments

Comments
 (0)