change to k-branches
Some checks failed
Github Actions Demo / Explore-Gitea-Actions (push) Failing after 7s

the history changing on every commit felt very yucky.
This commit is contained in:
James Andariese 2024-03-28 22:03:43 -05:00
parent 5b5c11844f
commit 39c493bf23
2 changed files with 29 additions and 4 deletions

View File

@ -21,9 +21,34 @@ jobs:
docker tag "`cat iid.txt`" "$DOCKER_REGISTRY/$GITHUB_REPOSITORY:$TAG"
docker push "$DOCKER_REGISTRY/$GITHUB_REPOSITORY:$TAG"
done
sed -i -e "s@image: $DOCKER_REGISTRY/$GITHUB_REPOSITORY:.*@image: $DOCKER_REGISTRY/$GITHUB_REPOSITORY:$STAG@" k/runner.yaml
BRANCH="$GITHUB_REF_NAME"
KBRANCH="k-$GITHUB_REF_NAME"
git config user.name "$GITHUB_REPOSITORY (act)"
git config user.email "gitea-actions@strudelline.net"
git add k/runner.yaml
# ensure the branch exists so we can ensure it's deleted. no errors at all.
git checkout -B "$KBRANCH"
git checkout "$BRANCH"
git branch -D "$KBRANCH"
git checkout -b "$KBRANCH"
# now fix up the images in k/runner.yaml
sed -i -e "s@image: $DOCKER_REGISTRY/$GITHUB_REPOSITORY:.*@image: $DOCKER_REGISTRY/$GITHUB_REPOSITORY:$STAG@" k/runner.yaml
sed -i -e "s@branch: .*@$KBRANCH@" k/flux.yaml
git add k
git commit -m "upgrade runner sts to $STAG"
git push
git push -f origin k-$GITHUB_REF_NAME
# now let's fix the origin branch's flux.yaml if it's needed.
# this will only happen once so it's not such an awful UX.
git checkout "$BRANCH"
sed -i -e "s@branch: .*@$KBRANCH@" k/flux.yaml
if git diff | grep -q .;then
echo fixing branch in flux.yaml of the origin branch
git commit -m "fix flux.yaml in $BRANCH"
git push
fi

View File

@ -8,7 +8,7 @@ spec:
interval: 5m
url: https://git.strudelline.net/cascade/docker-act_runner
ref:
branch: main
branch: k-main
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization