Skip to content

Commit

Permalink
ci from taskfile
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyEnr1quez committed Nov 4, 2024
1 parent 34286ec commit 38c926c
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 31 deletions.
41 changes: 22 additions & 19 deletions .github/workflows/karios-update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,33 @@ jobs:

- uses: DeterminateSystems/magic-nix-cache-action@main

- uses: workflow/nix-shell-action@v3
id: update
with:
packages: regctl
script: |
kairos_image_tag=$(regctl tag ls quay.io/kairos/opensuse \
--include 'leap-\d+.\d+-standard-amd64-generic.*' \
--exclude '.*(master|alpha|beta|rc).*' \
| tail -1)
- name: test flake ci
run: nix develop --command task kubernetes:ci-karios-update

# - uses: workflow/nix-shell-action@v3
# id: update
# with:
# packages: regctl
# script: |
# kairos_image_tag=$(regctl tag ls quay.io/kairos/opensuse \
# --include 'leap-\d+.\d+-standard-amd64-generic.*' \
# --exclude '.*(master|alpha|beta|rc).*' \
# | tail -1)

replacement_pattern='s|version: "[^"]*"|version: "'"$kairos_image_tag"'"|g'
# replacement_pattern='s|version: "[^"]*"|version: "'"$kairos_image_tag"'"|g'

sed -i "$replacement_pattern" ./kubernetes/home-lab/apps/system-upgrade/system-upgrade-controller/plans/amd.yaml
# sed -i "$replacement_pattern" ./kubernetes/home-lab/apps/system-upgrade/system-upgrade-controller/plans/amd.yaml

# outputs
leap_version="$(cut -d'-' -f2 <<< $kairos_image_tag)"
echo "opensuse_url=https://doc.opensuse.org/release-notes/x86_64/openSUSE/Leap/$leap_version/" >> $GITHUB_OUTPUT
# # outputs
# leap_version="$(cut -d'-' -f2 <<< $kairos_image_tag)"
# echo "opensuse_url=https://doc.opensuse.org/release-notes/x86_64/openSUSE/Leap/$leap_version/" >> $GITHUB_OUTPUT

kairos_version="$(cut -d'-' -f6 <<< $kairos_image_tag)"
echo "kairos_url=https://github.com/kairos-io/kairos/releases/tag/$kairos_version" >> $GITHUB_OUTPUT
# kairos_version="$(cut -d'-' -f6 <<< $kairos_image_tag)"
# echo "kairos_url=https://github.com/kairos-io/kairos/releases/tag/$kairos_version" >> $GITHUB_OUTPUT

k3s_version="$(cut -d'-' -f7 <<< $kairos_image_tag)"
k3s_version=${k3s_version:3}
echo "k3s_url=https://github.com/k3s-io/k3s/releases/tag/$k3s_version+k3s1" >> $GITHUB_OUTPUT
# k3s_version="$(cut -d'-' -f7 <<< $kairos_image_tag)"
# k3s_version=${k3s_version:3}
# echo "k3s_url=https://github.com/k3s-io/k3s/releases/tag/$k3s_version+k3s1" >> $GITHUB_OUTPUT

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
Expand Down
42 changes: 30 additions & 12 deletions .taskfiles/kubernetes/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,37 @@
version: '3'

tasks:
test123:
desc: plz work
cmds:
- echo HELLO WORLD

test456:
desc: test var
get-latest-kairos-tag:
desc: save latest kairos image tag to vars
vars:
GIT_COMMIT:
LATEST_KAIROS_IMAGE_TAG:
sh: >
regctl tag ls quay.io/kairos/opensuse \
--include 'leap-\d+.\d+-standard-amd64-generic.*' \
--exclude '.*(master|alpha|beta|rc).*' \
| tail -1
--include 'leap-\d+.\d+-standard-amd64-generic.*' \
--exclude '.*(master|alpha|beta|rc).*' \
| tail -1
cmd: >
echo {{.GIT_COMMIT}}
echo {{.LATEST_KAIROS_IMAGE_TAG}}
ci-kairos-update:
desc: ci task to update kairos and k3s
cmd: >
kairos_image_tag=$(regctl tag ls quay.io/kairos/opensuse \
--include 'leap-\d+.\d+-standard-amd64-generic.*' \
--exclude '.*(master|alpha|beta|rc).*' \
| tail -1)
replacement_pattern='s|version: "[^"]*"|version: "'"$kairos_image_tag"'"|g'
sed -i "$replacement_pattern" ./kubernetes/home-lab/apps/system-upgrade/system-upgrade-controller/plans/amd.yaml
# outputs
leap_version="$(cut -d'-' -f2 <<< $kairos_image_tag)"
echo "opensuse_url=https://doc.opensuse.org/release-notes/x86_64/openSUSE/Leap/$leap_version/" >> $GITHUB_OUTPUT
kairos_version="$(cut -d'-' -f6 <<< $kairos_image_tag)"
echo "kairos_url=https://github.com/kairos-io/kairos/releases/tag/$kairos_version" >> $GITHUB_OUTPUT
k3s_version="$(cut -d'-' -f7 <<< $kairos_image_tag)"
k3s_version=${k3s_version:3}
echo "k3s_url=https://github.com/k3s-io/k3s/releases/tag/$k3s_version+k3s1" >> $GITHUB_OUTPUT

0 comments on commit 38c926c

Please sign in to comment.