Skip to content

Commit

Permalink
switch out images
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanmars committed Sep 14, 2024
1 parent 8a90d2c commit 60dd701
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 46 deletions.
46 changes: 26 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: ["*"]
tags:
- "v*"
- "*"

env:
FLUTTER_ROOT: dummy
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
sudo apt-get install -yq --no-install-recommends skopeo
sudo wget -q https://github.com/carvel-dev/ytt/releases/download/v0.48.0/ytt-linux-amd64 -O /usr/bin/ytt
sudo chmod +x /usr/bin/ytt
- uses: balchua/microk8s-actions@v0.3.2
- uses: balchua/microk8s-actions@v0.4.3
with:
channel: "1.29/stable"
addons: '["dns", "hostpath-storage", "registry"]'
Expand Down Expand Up @@ -113,13 +113,16 @@ jobs:
merge-multiple: true
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/tiecd
images: ghcr.io/${{ github.repository_owner }}/tiecd/${{ matrix.image }}
flavor: |
latest=false
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=pep440,pattern={{version}}
type=pep440,pattern={{major}}.{{minor}}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
Expand All @@ -129,9 +132,9 @@ jobs:
- name: Install CEKit
uses: cekit/actions-setup-cekit@v1.1.5
- name: Save Tags
run: echo "${{ steps.meta.outputs.tags }}" >> tags.txt
run: echo -e "${{ steps.meta.outputs.tags }}" >> tags.txt
- name: Save Labels
run: echo "${{ steps.meta.outputs.labels }}" >> labels.txt
run: echo -e "${{ steps.meta.outputs.labels }}" >> labels.txt
- name: Build ${{ matrix.image }} Image
run: scripts/build-image.sh ${{ matrix.image }}

Expand Down Expand Up @@ -165,21 +168,16 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/tiecd
images: ghcr.io/${{ github.repository_owner }}/tiecd/${{ matrix.image }}
labels: |
org.opencontainers.image.vendor=Dataaxiom Inc
flavor: |
latest=false
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
- name: Save Tags
run: echo "${{ steps.meta.outputs.tags }}" >> tags.txt
- name: Generate Image Tags
id: gentags
run: |
tags=$(scripts/generate-tags.sh ${{ matrix.image }})
echo "tags=$tags" >> $GITHUB_OUTPUT
echo Using tags $image_tags
type=pep440,pattern={{version}}
type=pep440,pattern={{major}}.{{minor}}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
Expand All @@ -193,16 +191,24 @@ jobs:
push: true
platforms: linux/arm64,linux/amd64
provenance: false
tags: ${{ steps.gentags.outputs.tags }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.labels }}

delete-untagged-images:
name: delete-untagged-images
# cleans up untagged images, keeps all versioned images and main, and 3 RC images
cleanup-images:
name: cleanup-images
runs-on: ubuntu-latest
concurrency:
group: cleanup-images
needs: [image-build-single-arch,image-build-multi-arch]
steps:
- uses: dataaxiom/ghcr-cleanup-action@v1.0.11
with:
packages: "tiecd/jdk8,tiecd/jdk11,tiecd/jdk17,tiecd/jdk21,tiecd/vercel,tiecd/base,tiecd/k8s,tiecd/okd,tiecd/gke,tiecd/eks,tiecd/aks,tiecd/node18,tiecd/node20"
delete-untagged: true
keep-n-tagged: 1
exclude-tags: "^\\d+\\.\\d+\\.\\d+$|^main$"
use-regex: true
token: ${{ secrets.GITHUB_TOKEN }}

17 changes: 0 additions & 17 deletions .github/workflows/cleanup.yml

This file was deleted.

16 changes: 8 additions & 8 deletions scripts/build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cp scripts/umoci-perm.sh images/modules/base/build/.
cp LICENSE images/modules/base/build/.

while read tag; do
tagargs+=( --tag="$tag-$1" )
tagargs+=( --tag="$tag" )
done <tags.txt

# need to fix via overrides?
Expand All @@ -24,13 +24,13 @@ done <tags.txt
cekit --descriptor images/$1.yaml build docker "${tagargs[@]}"

while read tag; do
echo "docker push $tag-$1"
docker push $tag-$1
echo "docker push $tag"
docker push $tag

# tag okd image openshift also
if [ "$1" == "okd" ]; then
docker tag $tag-$1 $tag-openshift
echo "docker push $tag-openshift"
docker push $tag-openshift
fi
#if [ "$1" == "okd" ]; then
# docker tag $tag-$1 $tag-openshift
# echo "docker push $tag-openshift"
# docker push $tag-openshift
#fi
done <tags.txt
3 changes: 2 additions & 1 deletion scripts/generate-tags.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash

# concat all the tags onto a single line
while read tag; do
tags+=(" $tag-$1")
tags+=("$tag,")
done <tags.txt

echo -n ${tags[@]}

0 comments on commit 60dd701

Please sign in to comment.