Skip to content

Commit

Permalink
1999 - Update repositories and adapt /etc/os-release to versioneer (#…
Browse files Browse the repository at this point in the history
…2081)

* Use kairos-agent instead of naming.sh everywhere

For this commit, kairos-agent has to be built from at least 4409a4e

Also:

- Remove some relics from when we had docs in this repo and when we
used to pass a VERSION to the bundle for systemd-sysext (now we use
"_ANY")
- Simplify earthly targets. They don't need all that input just to construct
  the artifact name because it's running on the "base-image".
  The artifact name is already written in the /etc/os-release file.
- Remove +version target and convert GIT_VERSION to a normal target because when you call
  `DO +foo` in a target and "foo" has "FROM myimage" in it, after the call, your
  target now runs on "myimage".

- Remove "VERSION" instances from most places, except in reusable-build-flavor
  which is using it to replace it with "latest" thus the current value
  (just the kairos version) should work. That workflow is disabled currently
  but I tried not to break it in case someone re-enables it.

Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>

* Fix rebase mistake

Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>

* Fix issues building arm

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>

* Oops

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>

---------

Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
Co-authored-by: Mauro Morales <mauro.morales@spectrocloud.com>
  • Loading branch information
jimmykarily and mauromorales committed Dec 21, 2023
1 parent fa901cb commit ec6a6f2
Show file tree
Hide file tree
Showing 16 changed files with 325 additions and 581 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/image-arm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ jobs:
files_yaml: |
nvidia:
- 'images/Dockerfile.nvidia'
- name: Install kairos-agent (for versioneer)
uses: Luet-lab/luet-install-action@v1.1
with:
repository: quay.io/kairos/packages
packages: system/kairos-agent
- name: Release space from worker
if: steps.changed-files.outputs.nvidia_any_changed == 'true'
run: |
Expand Down Expand Up @@ -131,7 +137,7 @@ jobs:
- name: Build 🔧 & Push 🚀
if: steps.changed-files.outputs.nvidia_any_changed == 'true'
run: |
export IMAGE=$(FAMILY=ubuntu FLAVOR=ubuntu FLAVOR_RELEASE="20.04" MODEL=nvidia-jetson-agx-orin VARIANT=core TARGETARCH=arm64 REGISTRY_AND_ORG="quay.io/kairos" ./images/naming.sh container_artifact_base_name)
export IMAGE=$(FLAVOR=ubuntu FLAVOR_RELEASE="20.04" MODEL=nvidia-jetson-agx-orin VARIANT=core TARGETARCH=arm64 REGISTRY_AND_ORG="quay.io/kairos" ID=master kairos-agent versioneer base-container-artifact-name)
docker build --platform=linux/arm64 -t $IMAGE -f ./images/Dockerfile.nvidia ./images
docker push $IMAGE
Expand All @@ -143,7 +149,7 @@ jobs:
flavor: ubuntu
flavor_release: "20.04"
family: ubuntu
# is there a way to run the naming.sh script here?
# is there a way to run versioneer here?
base_image: quay.io/kairos/ubuntu:20.04-core-arm64-nvidia-jetson-agx-orin-master
model: nvidia-jetson-agx-orin
worker: fast
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/release-arm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install kairos-agent (for versioneer)
uses: Luet-lab/luet-install-action@v1.1
with:
repository: quay.io/kairos/packages
packages: system/kairos-agent
- name: Release space from worker
if: steps.changed-files.outputs.nvidia_any_changed == 'true'
run: |
Expand Down Expand Up @@ -112,7 +117,7 @@ jobs:
run: echo ${{ secrets.QUAY_PASSWORD }} | docker login -u ${{ secrets.QUAY_USERNAME }} --password-stdin quay.io
- name: Build 🔧 & Push 🚀
run: |
export IMAGE=$(FAMILY=ubuntu FLAVOR=ubuntu FLAVOR_RELEASE="20.04" MODEL=nvidia-jetson-agx-orin VARIANT=core TARGETARCH=arm64 REGISTRY_AND_ORG="quay.io/kairos" BRANCH=release ./images/naming.sh container_artifact_base_name)
export IMAGE=$(FLAVOR=ubuntu FLAVOR_RELEASE="20.04" MODEL=nvidia-jetson-agx-orin VARIANT=core TARGETARCH=arm64 REGISTRY_AND_ORG="quay.io/kairos" ID=release kairos-agent versioneer base-container-artifact-name)
docker build --platform=linux/arm64 -t $IMAGE -f ./images/Dockerfile.nvidia ./images
docker push $IMAGE
Expand All @@ -123,7 +128,7 @@ jobs:
flavor: ubuntu
flavor_release: "20.04"
family: ubuntu
# is there a way to run the naming.sh script here?
# is there a way to run versioneer here?
base_image: quay.io/kairos/ubuntu:20.04-core-arm64-nvidia-jetson-agx-orin-release
model: nvidia-jetson-agx-orin
worker: fast
Expand Down Expand Up @@ -208,7 +213,6 @@ jobs:
-BASE_IMAGE=${{ matrix.baseImage }}
- name: Convert all json files into a reports.tar.gz file
run: |
export VERSION=$(cat build/VERSION)
cd build
filename=$(ls *-grype.json | head -n 1) && filename=${filename%%-grype.json}
sudo tar cvf "${filename}-scan-reports.tar.gz" *.json
Expand All @@ -233,7 +237,7 @@ jobs:
sudo luet util pack $IMAGE build.tar image.tar
sudo -E docker load -i image.tar
sudo -E docker push "$IMAGE"
sudo rm -rf build/IMAGE build/VERSION
sudo rm -rf build/IMAGE
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
Expand Down Expand Up @@ -332,7 +336,6 @@ jobs:
-BASE_IMAGE=${{ matrix.baseImage }}
- name: Convert all json files into a reports.tar.gz file
run: |
export VERSION=$(cat build/VERSION)
cd build
filename=$(ls *-grype.json | head -n 1) && filename=${filename%%-grype.json}
sudo tar cvf "${filename}-scan-reports.tar.gz" *.json
Expand All @@ -357,7 +360,7 @@ jobs:
sudo luet util pack $IMAGE build.tar image.tar
sudo -E docker load -i image.tar
sudo -E docker push "$IMAGE"
sudo rm -rf build/IMAGE build/VERSION
sudo rm -rf build/IMAGE
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ jobs:
--output-signature="${filename}.sig" "${filename}"
- name: Prepare files for release
run: |
export VERSION=$(cat release/VERSION)
mkdir sarif
mv release/*.sarif sarif/
mkdir reports
Expand All @@ -163,7 +162,7 @@ jobs:
sudo tar cvf "${filename}-scan-reports.tar.gz" *.json
mv *.tar.gz ../release/
cd ..
rm release/VERSION release/IMAGE release/versions.yaml
rm release/IMAGE release/versions.yaml
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
Expand Down Expand Up @@ -256,7 +255,6 @@ jobs:
cosign sign $(docker image inspect --format='{{index .RepoDigests 0}}' "$IMAGE")
- name: Prepare files for release
run: |
export VERSION=$(cat release/VERSION)
mkdir sarif
mv release/*.sarif sarif/
mkdir reports
Expand All @@ -266,7 +264,7 @@ jobs:
sudo tar cvf "${filename}-scan-reports.tar.gz" *.json
mv *.tar.gz ../release/
cd ..
sudo rm -rf release/IMAGE release/VERSION release/versions.yaml
sudo rm -rf release/IMAGE release/versions.yaml
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/reusable-build-base-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,15 @@ jobs:
- name: Login to Quay Registry
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && steps.changed-files.outputs.nvidia_any_changed == 'true' }}
run: echo ${{ secrets.QUAY_PASSWORD }} | docker login -u ${{ secrets.QUAY_USERNAME }} --password-stdin quay.io
- name: Install kairos-agent (for versioneer)
uses: Luet-lab/luet-install-action@v1.1
with:
repository: quay.io/kairos/packages
packages: system/kairos-agent
- name: Build 🔧 & Push 🚀
if: steps.changed-files.outputs.nvidia_any_changed == 'true'
run: |
export IMAGE=$(FAMILY=${{ inputs.family }} FLAVOR=${{ inputs.flavor }} FLAVOR_RELEASE="${{ inputs.flavor_release}}" MODEL=${{ inputs.model}} TARGETARCH=${{ inputs.arch }} REGISTRY_AND_ORG="quay.io/kairos" ./images/naming.sh container_artifact_base_name)
export IMAGE=$(FLAVOR=${{ inputs.flavor }} FLAVOR_RELEASE="${{ inputs.flavor_release}}" MODEL=${{ inputs.model}} TARGETARCH=${{ inputs.arch }} REGISTRY_AND_ORG="quay.io/kairos" ID=master kairos-agent versioneer base-container-artifact-name)
docker build --platform=linux/${{ inputs.arch }} --build-arg="FAMILY=${{ inputs.family }}" --build-arg="FLAVOR=${{ inputs.flavor }}" --build-arg="FLAVOR_RELEASE=${{ inputs.flavor_release }}" --build-arg="MODEL=${{ inputs.model }}" --build-arg="BASE_IMAGE=${{ inputs.base_image }}" -t $IMAGE -f ./images/Dockerfile.${{ inputs.family }} ./images
docker push $IMAGE
10 changes: 6 additions & 4 deletions .github/workflows/reusable-build-flavor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ jobs:
sudo iptables -I INPUT -s 169.254.169.254 -j DROP
sudo iptables -I OUTPUT -d 169.254.169.254 -j DROP
- name: Build PR 🔧
if: ${{ github.event_name == 'pull_request' }}
env:
VERSION: latest
run: |
earthly --platform=linux/${{ inputs.arch }} +ci \
--SECURITY_SCANS=false \
Expand All @@ -109,10 +106,15 @@ jobs:
--FAMILY=${{ inputs.family }}
sudo mv build/* .
sudo rm -rf build
- name: Install kairos-agent (for versioneer)
uses: Luet-lab/luet-install-action@v1.1
with:
repository: quay.io/kairos/packages
packages: system/kairos-agent
- name: Build master 🔧
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
run: |
export BASE_IMAGE=$(FAMILY=${{ inputs.family }} FLAVOR=${{ inputs.flavor }} FLAVOR_RELEASE="${{ inputs.flavor_release}}" MODEL=${{ inputs.model}} TARGETARCH=${{ inputs.arch }} REGISTRY_AND_ORG="quay.io/kairos" ./images/naming.sh container_artifact_base_name)
export BASE_IMAGE=$(FLAVOR=${{ inputs.flavor }} FLAVOR_RELEASE="${{ inputs.flavor_release}}" MODEL=${{ inputs.model}} TARGETARCH=${{ inputs.arch }} REGISTRY_AND_ORG="quay.io/kairos" ID=master kairos-agent versioneer base-container-artifact-name)
earthly --platform=linux/${{ inputs.arch }} +ci \
--SECURITY_SCANS=true \
--VARIANT=${{ inputs.variant }} \
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/reusable-build-provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,15 @@ jobs:
sudo mv build/* .
sudo rm -rf build
- name: Install kairos-agent (for versioneer)
uses: Luet-lab/luet-install-action@v1.1
with:
repository: quay.io/kairos/packages
packages: system/kairos-agent
- name: Build master 🔧
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
run: |
export BASE_IMAGE=$(FAMILY=${{ inputs.family }} FLAVOR=${{ inputs.flavor }} FLAVOR_RELEASE="${{ inputs.flavor_release}}" MODEL=${{ inputs.model}} TARGETARCH=${{ inputs.arch }} REGISTRY_AND_ORG="quay.io/kairos" ./images/naming.sh container_artifact_base_name)
export BASE_IMAGE=$(FLAVOR=${{ inputs.flavor }} FLAVOR_RELEASE="${{ inputs.flavor_release}}" MODEL=${{ inputs.model}} TARGETARCH=${{ inputs.arch }} REGISTRY_AND_ORG="quay.io/kairos" ID=master kairos-agent versioneer base-container-artifact-name)
earthly --platform=linux/${{ inputs.arch }} +extract-framework-profile
K3S_VERSION=$(sudo luet --config framework-profile.yaml search -o json k8s/k3s | jq '.packages | map(.version) | unique | last' | tr -d '"')
earthly --platform=linux/${{ inputs.arch }} +ci \
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/reusable-docker-arm-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ jobs:
- name: Convert all json files into a reports.tar.gz file
if: startsWith(github.ref, 'refs/tags/v')
run: |
export VERSION=$(cat build/VERSION)
cd build
filename=$(ls *-grype.json | head -n 1) && filename=${filename%%-grype.json}
sudo tar cvf "${filename}-scan-reports.tar.gz" *.json
Expand All @@ -146,7 +145,7 @@ jobs:
sudo luet util pack $IMAGE build.tar image.tar
sudo -E docker load -i image.tar
sudo -E docker push "$IMAGE"
sudo rm -rf build/IMAGE build/VERSION
sudo rm -rf build/IMAGE
- name: Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
Expand Down
Loading

0 comments on commit ec6a6f2

Please sign in to comment.