Skip to content

Commit

Permalink
cicd: disable copy by helm for now
Browse files Browse the repository at this point in the history
  • Loading branch information
xgui3783 committed Oct 21, 2024
1 parent a3eda5c commit ca5a1d5
Showing 1 changed file with 46 additions and 46 deletions.
92 changes: 46 additions & 46 deletions .github/workflows/docker-img.yml
Original file line number Diff line number Diff line change
Expand Up @@ -257,60 +257,60 @@ jobs:
KUBECONFIG: ${{ secrets.KUBECONFIG }}

# prod
copy-by-helm:
needs: setup-envvar
if: ${{ github.event_name == 'release' && !contains(github.ref, 'rc') }}
runs-on: ubuntu-latest
timeout-minutes: 15 # should not take more than 15 minutes to copy cache
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/composite-set-k8s-cred
with:
secrets: ${{ secrets.KUBECONFIG }}
- name: 'set FROM_DIR TO_DIR'
run: |
VERSION=${{ needs.setup-envvar.outputs.version }}
# copy-by-helm:
# needs: setup-envvar
# if: ${{ github.event_name == 'release' && !contains(github.ref, 'rc') }}
# runs-on: ubuntu-latest
# timeout-minutes: 15 # should not take more than 15 minutes to copy cache
# steps:
# - uses: actions/checkout@v4
# - uses: ./.github/workflows/composite-set-k8s-cred
# with:
# secrets: ${{ secrets.KUBECONFIG }}
# - name: 'set FROM_DIR TO_DIR'
# run: |
# VERSION=${{ needs.setup-envvar.outputs.version }}

# TODO use label exclusively in the future
POD=$(kubectl get pod -l role=server -l app-flavor=rc -o json | jq -r '.items[0].metadata.name')
echo POD: $POD
# # TODO use label exclusively in the future
# POD=$(kubectl get pod -l role=server -l app-flavor=rc -o json | jq -r '.items[0].metadata.name')
# echo POD: $POD

cache_str=$(kubectl exec $POD -- env | grep SIIBRA_CACHEDIR)
FROM_DIR=${cache_str//SIIBRA_CACHEDIR=/}
TO_DIR=${FROM_DIR//-rc/}
POD_NAME=copy-cache
# cache_str=$(kubectl exec $POD -- env | grep SIIBRA_CACHEDIR)
# FROM_DIR=${cache_str//SIIBRA_CACHEDIR=/}
# TO_DIR=${FROM_DIR//-rc/}
# POD_NAME=copy-cache

echo FROM_DIR: $FROM_DIR, TO_DIR: $TO_DIR, POD_NAME: $POD_NAME
# echo FROM_DIR: $FROM_DIR, TO_DIR: $TO_DIR, POD_NAME: $POD_NAME

echo "FROM_DIR=$FROM_DIR" >> $GITHUB_ENV
echo "TO_DIR=$TO_DIR" >> $GITHUB_ENV
echo "POD_NAME=$POD_NAME" >> $GITHUB_ENV
# echo "FROM_DIR=$FROM_DIR" >> $GITHUB_ENV
# echo "TO_DIR=$TO_DIR" >> $GITHUB_ENV
# echo "POD_NAME=$POD_NAME" >> $GITHUB_ENV

- name: 'start container'
run: |
# delete pod before workflow, so that logs can be inspected
kubectl delete pod/$POD_NAME || echo "Pod pod/$POD_NAME not found."
FROM_DIR=$FROM_DIR TO_DIR=$TO_DIR envsubst < .helm/adhoc/copy-cache.yaml | kubectl apply -f -
- name: 'Ensure copy completes'
run: |
while true
do
sleep 10
POD_PHASE=$(kubectl get pod $POD_NAME -o json | jq -r '.status.phase')
# - name: 'start container'
# run: |
# # delete pod before workflow, so that logs can be inspected
# kubectl delete pod/$POD_NAME || echo "Pod pod/$POD_NAME not found."
# FROM_DIR=$FROM_DIR TO_DIR=$TO_DIR envsubst < .helm/adhoc/copy-cache.yaml | kubectl apply -f -
# - name: 'Ensure copy completes'
# run: |
# while true
# do
# sleep 10
# POD_PHASE=$(kubectl get pod $POD_NAME -o json | jq -r '.status.phase')

echo Possible phases: Pending, Running, Succeeded, Failed, Unknown
echo Found phase: $POD_PHASE
# echo Possible phases: Pending, Running, Succeeded, Failed, Unknown
# echo Found phase: $POD_PHASE

if [[ "$POD_PHASE" == "Failed" ]] || [[ "$POD_PHASE" == "Unknown" ]]
then
exit 1
fi
# if [[ "$POD_PHASE" == "Failed" ]] || [[ "$POD_PHASE" == "Unknown" ]]
# then
# exit 1
# fi

if [[ "$POD_PHASE" == "Succeeded" ]]
then
exit 0
fi
done
# if [[ "$POD_PHASE" == "Succeeded" ]]
# then
# exit 0
# fi
# done

# deploy-prod-via-helm:
# needs: copy-by-helm
Expand Down

0 comments on commit ca5a1d5

Please sign in to comment.