diff --git a/.github/workflows/publish-all-channels.yaml b/.github/workflows/publish-all-channels.yaml new file mode 100644 index 0000000..6d3798d --- /dev/null +++ b/.github/workflows/publish-all-channels.yaml @@ -0,0 +1,43 @@ +name: Publish All Channels +on: + push: + branches: + - main + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + publish-channel: + strategy: + matrix: + channel: + - tag: "5.5" + file: "sle-micro-5-5.json" + - tag: "5.5-base" + file: "sle-micro-base-5-5.json" + - tag: "5.5-kvm" + file: "sle-micro-kvm-5-5.json" + - tag: "5.5-rt" + file: "sle-micro-rt-5-5.json" + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + build-args: + - CHANNEL_JSON_FILE=${{ matrix.channel.file }} + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.channel.tag }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d38f80a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM busybox + +ARG CHANNEL_JSON_FILE + +COPY channels/$CHANNEL_JSON_FILE /channel.json + +ENTRYPOINT ["cp"] +CMD ["/channel.json", "/data/output"] diff --git a/channels/sle-micro-5-5.json b/channels/sle-micro-5-5.json new file mode 100644 index 0000000..00174b3 --- /dev/null +++ b/channels/sle-micro-5-5.json @@ -0,0 +1,340 @@ +[ + { + "metadata": { + "name": "v2.0.2" + }, + "spec": { + "version": "v2.0.2", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2", + "displayName": "SLE Micro 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.102" + }, + "spec": { + "version": "v2.0.2-4.2.102", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-4.2.102", + "displayName": "SLE Micro 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.105" + }, + "spec": { + "version": "v2.0.2-4.2.105", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-4.2.105", + "displayName": "SLE Micro 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.107" + }, + "spec": { + "version": "v2.0.2-4.2.107", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-4.2.107", + "displayName": "SLE Micro 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.109" + }, + "spec": { + "version": "v2.0.2-4.2.109", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-4.2.109", + "displayName": "SLE Micro 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.111" + }, + "spec": { + "version": "v2.0.2-4.2.111", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-4.2.111", + "displayName": "SLE Micro 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.20" + }, + "spec": { + "version": "v2.0.2-4.2.20", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-4.2.20", + "displayName": "SLE Micro 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.70" + }, + "spec": { + "version": "v2.0.2-4.2.70", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-4.2.70", + "displayName": "SLE Micro 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.85" + }, + "spec": { + "version": "v2.0.2-4.2.85", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-4.2.85", + "displayName": "SLE Micro 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.87" + }, + "spec": { + "version": "v2.0.2-4.2.87", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-4.2.87", + "displayName": "SLE Micro 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.89" + }, + "spec": { + "version": "v2.0.2-4.2.89", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-4.2.89", + "displayName": "SLE Micro 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.91" + }, + "spec": { + "version": "v2.0.2-4.2.91", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-4.2.91", + "displayName": "SLE Micro 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.93" + }, + "spec": { + "version": "v2.0.2-4.2.93", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-4.2.93", + "displayName": "SLE Micro 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.94" + }, + "spec": { + "version": "v2.0.2-4.2.94", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-4.2.94", + "displayName": "SLE Micro 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.96" + }, + "spec": { + "version": "v2.0.2-4.2.96", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-4.2.96", + "displayName": "SLE Micro 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.97" + }, + "spec": { + "version": "v2.0.2-4.2.97", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-4.2.97", + "displayName": "SLE Micro 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.99" + }, + "spec": { + "version": "v2.0.2-4.2.99", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-4.2.99", + "displayName": "SLE Micro 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.4" + }, + "spec": { + "version": "v2.0.4", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.4", + "displayName": "SLE Micro 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.4-5.5.2" + }, + "spec": { + "version": "v2.0.4-5.5.2", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.4-5.5.2", + "displayName": "SLE Micro 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2" + }, + "spec": { + "version": "v2.0.2", + "type": "iso", + "metadata": { + "uri": ":2.0.2", + "displayName": "SLE Micro 5.5 ISO" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.128" + }, + "spec": { + "version": "v2.0.2-4.2.128", + "type": "iso", + "metadata": { + "uri": ":2.0.2-4.2.128", + "displayName": "SLE Micro 5.5 ISO" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.27" + }, + "spec": { + "version": "v2.0.2-4.2.27", + "type": "iso", + "metadata": { + "uri": ":2.0.2-4.2.27", + "displayName": "SLE Micro 5.5 ISO" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.97" + }, + "spec": { + "version": "v2.0.2-4.2.97", + "type": "iso", + "metadata": { + "uri": ":2.0.2-4.2.97", + "displayName": "SLE Micro 5.5 ISO" + } + } + }, + { + "metadata": { + "name": "v2.0.4" + }, + "spec": { + "version": "v2.0.4", + "type": "iso", + "metadata": { + "uri": ":2.0.4", + "displayName": "SLE Micro 5.5 ISO" + } + } + }, + { + "metadata": { + "name": "v2.0.4-5.5.3" + }, + "spec": { + "version": "v2.0.4-5.5.3", + "type": "iso", + "metadata": { + "uri": ":2.0.4-5.5.3", + "displayName": "SLE Micro 5.5 ISO" + } + } + }, + { + "metadata": { + "name": "v2.0.4-5.5.6" + }, + "spec": { + "version": "v2.0.4-5.5.6", + "type": "iso", + "metadata": { + "uri": ":2.0.4-5.5.6", + "displayName": "SLE Micro 5.5 ISO" + } + } + } +] diff --git a/channels/sle-micro-base-5-5.json b/channels/sle-micro-base-5-5.json new file mode 100644 index 0000000..d8217eb --- /dev/null +++ b/channels/sle-micro-base-5-5.json @@ -0,0 +1,249 @@ +[ + { + "metadata": { + "name": "v2.0.2" + }, + "spec": { + "version": "v2.0.2", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2", + "displayName": "SLE Micro Base 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.16" + }, + "spec": { + "version": "v2.0.2-4.2.16", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-4.2.16", + "displayName": "SLE Micro Base 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.51" + }, + "spec": { + "version": "v2.0.2-4.2.51", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-4.2.51", + "displayName": "SLE Micro Base 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.60" + }, + "spec": { + "version": "v2.0.2-4.2.60", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-4.2.60", + "displayName": "SLE Micro Base 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.65" + }, + "spec": { + "version": "v2.0.2-4.2.65", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-4.2.65", + "displayName": "SLE Micro Base 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-5.5.1" + }, + "spec": { + "version": "v2.0.2-5.5.1", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-5.5.1", + "displayName": "SLE Micro Base 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-5.5.12" + }, + "spec": { + "version": "v2.0.2-5.5.12", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-5.5.12", + "displayName": "SLE Micro Base 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-5.5.2" + }, + "spec": { + "version": "v2.0.2-5.5.2", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-5.5.2", + "displayName": "SLE Micro Base 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-5.5.6" + }, + "spec": { + "version": "v2.0.2-5.5.6", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-5.5.6", + "displayName": "SLE Micro Base 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-5.5.9" + }, + "spec": { + "version": "v2.0.2-5.5.9", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-5.5.9", + "displayName": "SLE Micro Base 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.4" + }, + "spec": { + "version": "v2.0.4", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.4", + "displayName": "SLE Micro Base 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.4-5.8.1" + }, + "spec": { + "version": "v2.0.4-5.8.1", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.4-5.8.1", + "displayName": "SLE Micro Base 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2" + }, + "spec": { + "version": "v2.0.2", + "type": "iso", + "metadata": { + "uri": ":2.0.2", + "displayName": "SLE Micro Base 5.5 ISO" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.156" + }, + "spec": { + "version": "v2.0.2-4.2.156", + "type": "iso", + "metadata": { + "uri": ":2.0.2-4.2.156", + "displayName": "SLE Micro Base 5.5 ISO" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.203" + }, + "spec": { + "version": "v2.0.2-4.2.203", + "type": "iso", + "metadata": { + "uri": ":2.0.2-4.2.203", + "displayName": "SLE Micro Base 5.5 ISO" + } + } + }, + { + "metadata": { + "name": "v2.0.2-4.2.42" + }, + "spec": { + "version": "v2.0.2-4.2.42", + "type": "iso", + "metadata": { + "uri": ":2.0.2-4.2.42", + "displayName": "SLE Micro Base 5.5 ISO" + } + } + }, + { + "metadata": { + "name": "v2.0.4" + }, + "spec": { + "version": "v2.0.4", + "type": "iso", + "metadata": { + "uri": ":2.0.4", + "displayName": "SLE Micro Base 5.5 ISO" + } + } + }, + { + "metadata": { + "name": "v2.0.4-5.5.3" + }, + "spec": { + "version": "v2.0.4-5.5.3", + "type": "iso", + "metadata": { + "uri": ":2.0.4-5.5.3", + "displayName": "SLE Micro Base 5.5 ISO" + } + } + }, + { + "metadata": { + "name": "v2.0.4-5.5.6" + }, + "spec": { + "version": "v2.0.4-5.5.6", + "type": "iso", + "metadata": { + "uri": ":2.0.4-5.5.6", + "displayName": "SLE Micro Base 5.5 ISO" + } + } + } +] diff --git a/channels/sle-micro-kvm-5-5.json b/channels/sle-micro-kvm-5-5.json new file mode 100644 index 0000000..a671722 --- /dev/null +++ b/channels/sle-micro-kvm-5-5.json @@ -0,0 +1,80 @@ +[ + { + "metadata": { + "name": "v2.0.2" + }, + "spec": { + "version": "v2.0.2", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2", + "displayName": "SLE Micro KVM 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-2.2.115" + }, + "spec": { + "version": "v2.0.2-2.2.115", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-2.2.115", + "displayName": "SLE Micro KVM 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-2.2.20" + }, + "spec": { + "version": "v2.0.2-2.2.20", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-2.2.20", + "displayName": "SLE Micro KVM 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-2.2.85" + }, + "spec": { + "version": "v2.0.2-2.2.85", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-2.2.85", + "displayName": "SLE Micro KVM 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.4" + }, + "spec": { + "version": "v2.0.4", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.4", + "displayName": "SLE Micro KVM 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.4-3.5.2" + }, + "spec": { + "version": "v2.0.4-3.5.2", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.4-3.5.2", + "displayName": "SLE Micro KVM 5.5 OS" + } + } + } +] diff --git a/channels/sle-micro-rt-5-5.json b/channels/sle-micro-rt-5-5.json new file mode 100644 index 0000000..61a8564 --- /dev/null +++ b/channels/sle-micro-rt-5-5.json @@ -0,0 +1,80 @@ +[ + { + "metadata": { + "name": "v2.0.2" + }, + "spec": { + "version": "v2.0.2", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2", + "displayName": "SLE Micro RT 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-2.2.115" + }, + "spec": { + "version": "v2.0.2-2.2.115", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-2.2.115", + "displayName": "SLE Micro RT 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-2.2.20" + }, + "spec": { + "version": "v2.0.2-2.2.20", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-2.2.20", + "displayName": "SLE Micro RT 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.2-2.2.85" + }, + "spec": { + "version": "v2.0.2-2.2.85", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.2-2.2.85", + "displayName": "SLE Micro RT 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.4" + }, + "spec": { + "version": "v2.0.4", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.4", + "displayName": "SLE Micro RT 5.5 OS" + } + } + }, + { + "metadata": { + "name": "v2.0.4-3.5.2" + }, + "spec": { + "version": "v2.0.4-3.5.2", + "type": "container", + "metadata": { + "upgradeImage": ":2.0.4-3.5.2", + "displayName": "SLE Micro RT 5.5 OS" + } + } + } +] diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..af8a7a3 --- /dev/null +++ b/config.yaml @@ -0,0 +1,18 @@ +watches: + - fileName: "sle-micro-5-5" + displayName: "SLE Micro 5.5" + osRepo: registry.suse.com/suse/sle-micro/5.5 + isoRepo: registry.suse.com/suse/sle-micro-iso/5.5 + - fileName: "sle-micro-base-5-5" + displayName: "SLE Micro Base 5.5" + osRepo: registry.suse.com/suse/sle-micro/base-5.5 + isoRepo: registry.suse.com/suse/sle-micro-iso/base-5.5 + - fileName: "sle-micro-kvm-5-5" + displayName: "SLE Micro KVM 5.5" + osRepo: registry.suse.com/suse/sle-micro/kvm-5.5 + isoRepo: "N/A" + - fileName: "sle-micro-rt-5-5" + displayName: "SLE Micro RT 5.5" + osRepo: registry.suse.com/suse/sle-micro/kvm-5.5 + isoRepo: "N/A" + diff --git a/populate_channels.sh b/populate_channels.sh new file mode 100755 index 0000000..2f62468 --- /dev/null +++ b/populate_channels.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +set -e + +watches=$(yq e -o=j -I=0 '.watches[]' config.yaml) + +# Loop through all watches +while IFS=\= read watch; do + # Parse one entry + fileName=$(echo "$watch" | yq e '.fileName') + displayName=$(echo "$watch" | yq e '.displayName') + osRepo=$(echo "$watch" | yq e '.osRepo') + isoRepo=$(echo "$watch" | yq e '.isoRepo') + + # Fetch the OS Image tags + osTags=($(skopeo list-tags docker://$osRepo | jq '.Tags[]' | grep -v '.att\|.sig\|latest' | sed 's/"//g')) + + # Start writing the channel file + file="channels/$fileName.json" + echo "Creating $fileName" + echo "[" > $file + for tag in "${osTags[@]}"; do + cat << EOF >> $file + { + "metadata": { + "name": "v$tag" + }, + "spec": { + "version": "v$tag", + "type": "container", + "metadata": { + "upgradeImage": "$osImage:$tag", + "displayName": "$displayName OS" + } + } + }, +EOF + done + + ## Fetch the ISO Image tags (if applicable) + if [ $isoRepo != "N/A" ]; then + isoTags=($(skopeo list-tags docker://$isoRepo | jq '.Tags[]' | grep -v '.att\|.sig\|latest' | sed 's/"//g')) + for tag in "${isoTags[@]}"; do + cat << EOF >> $file + { + "metadata": { + "name": "v$tag" + }, + "spec": { + "version": "v$tag", + "type": "iso", + "metadata": { + "uri": "$isoImage:$tag", + "displayName": "$displayName ISO" + } + } + }, +EOF + done + fi + + # Delete trailing ',' from array. (technically last written char on the file) + sed -i '$ s/.$//' $file + + # Close the JSON Array + echo "]" >> $file + + # Validate the JSON file + cat $file | jq empty +done <