chore: update golangci version #38
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test reusable-ko-build | |
on: | |
pull_request: {} | |
workflow_dispatch: {} | |
env: | |
VERSION_CRANE: v0.16.1 | |
# LIMITATIONS | |
# - this workflow cannot run in parallel between PRs; retries are required (for now). | |
# this is due to non-unique image names. having unique image names tends to cause needing to retry more times due to some sort of internal container artifact "registration" behaviour | |
# TESTCASES | |
# - t0: basic | |
# - t1: auth-with-geonetci | |
# - t2: with-paths-and-packages | |
# - t3: no-push | |
# - t4: custom-config | |
permissions: | |
packages: write | |
contents: read | |
id-token: write | |
jobs: | |
t0-basic: | |
uses: ./.github/workflows/reusable-ko-build.yml | |
with: | |
push: true | |
setup: | | |
mkdir -p testdata-ko-build/cmd/testimage-ko-build-t0-basic-1 | |
cat << EOF > testdata-ko-build/cmd/testimage-ko-build-t0-basic-1/main.go | |
package main | |
import "fmt" | |
func main() { | |
fmt.Println("Hello World!") | |
} | |
EOF | |
t0-basic-check: | |
needs: t0-basic | |
runs-on: ubuntu-latest | |
steps: | |
- uses: GeoNet/setup-crane@00c9e93efa4e1138c9a7a5c594acd6c75a2fbf0c # main | |
with: | |
version: ${{ env.VERSION_CRANE }} | |
- name: check for images | |
env: | |
IMAGES: ${{ needs.t0-basic.outputs.images }} | |
run: | | |
echo "$IMAGES" | tr ',' '\n' | xargs -n 1 -I{} crane manifest {} | |
for IMAGE in $IMAGES; do | |
crane manifest "$IMAGE" | jq -r '.annotations["org.opencontainers.image.base.name"]' | grep -qE 'ghcr.io/geonet/base-images/static(:latest)?' | |
done | |
- name: cleanup | |
if: always() | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh api -X DELETE /orgs/GeoNet/packages/container/actions%2Ftestimage-ko-build-t0-basic-1 || true | |
t1-auth-with-geonetci: | |
uses: ./.github/workflows/reusable-ko-build.yml | |
secrets: inherit | |
with: | |
push: true | |
registryGhcrUsernameOverride: geonetci | |
setup: | | |
mkdir -p testdata-ko-build/cmd/testimage-ko-build-t1-auth-with-geonetci-1 | |
cat << EOF > testdata-ko-build/cmd/testimage-ko-build-t1-auth-with-geonetci-1/main.go | |
package main | |
import "fmt" | |
func main() { | |
fmt.Println("Hello World!") | |
} | |
EOF | |
t1-auth-with-geonetci-check: | |
needs: t1-auth-with-geonetci | |
runs-on: ubuntu-latest | |
steps: | |
- uses: GeoNet/setup-crane@00c9e93efa4e1138c9a7a5c594acd6c75a2fbf0c # main | |
with: | |
version: ${{ env.VERSION_CRANE }} | |
- name: check for images | |
env: | |
IMAGES: ${{ needs.t1-auth-with-geonetci.outputs.images }} | |
run: | | |
echo "$IMAGES" | tr ',' '\n' | xargs -n 1 -I{} crane manifest {} | |
- name: cleanup | |
if: always() | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh api -X DELETE /orgs/GeoNet/packages/container/actions%2Ftestimage-ko-build-t1-auth-with-geonetci-1 || true | |
t2-with-paths-and-packages: | |
uses: ./.github/workflows/reusable-ko-build.yml | |
with: | |
push: true | |
paths: | | |
./testdata-ko-build/cmd/testimage-ko-build-t2-with-paths-and-packages-1 | |
github.com/GeoNet/Actions/testdata-ko-build/cmd/testimage-ko-build-t2-with-paths-and-packages-2 | |
setup: | | |
mkdir -p testdata-ko-build/cmd/testimage-ko-build-t2-with-paths-and-packages-1 | |
cat << EOF > testdata-ko-build/cmd/testimage-ko-build-t2-with-paths-and-packages-1/main.go | |
package main | |
import "fmt" | |
func main() { | |
fmt.Println("Hello World!") | |
} | |
EOF | |
mkdir -p testdata-ko-build/cmd/testimage-ko-build-t2-with-paths-and-packages-2 | |
cat << EOF > testdata-ko-build/cmd/testimage-ko-build-t2-with-paths-and-packages-2/main.go | |
package main | |
import "fmt" | |
func main() { | |
fmt.Println("Hello World!") | |
} | |
EOF | |
t2-with-paths-and-packages-check: | |
needs: t2-with-paths-and-packages | |
runs-on: ubuntu-latest | |
steps: | |
- uses: GeoNet/setup-crane@00c9e93efa4e1138c9a7a5c594acd6c75a2fbf0c # main | |
with: | |
version: ${{ env.VERSION_CRANE }} | |
- name: check for images | |
env: | |
IMAGES: ${{ needs.t2-with-paths-and-packages.outputs.images }} | |
run: | | |
echo "$IMAGES" | tr ',' '\n' | sort | cut -d'@' -f1 | xargs | grep -qE '^ghcr.io/geonet/actions/testimage-ko-build-t2-with-paths-and-packages-1 ghcr.io/geonet/actions/testimage-ko-build-t2-with-paths-and-packages-2$' | |
echo "$IMAGES" | tr ',' '\n' | xargs -n 1 -I{} crane manifest {} | |
- name: cleanup | |
if: always() | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh api -X DELETE /orgs/GeoNet/packages/container/actions%2Ftestimage-ko-build-t2-with-paths-and-packages-1 || true | |
gh api -X DELETE /orgs/GeoNet/packages/container/actions%2Ftestimage-ko-build-t2-with-paths-and-packages-2 || true | |
t3-no-push: | |
uses: ./.github/workflows/reusable-ko-build.yml | |
with: | |
push: false | |
setup: | | |
mkdir -p testdata-ko-build/cmd/testimage-ko-build-t3-no-push-1 | |
cat << EOF > testdata-ko-build/cmd/testimage-ko-build-t3-no-push-1/main.go | |
package main | |
import "fmt" | |
func main() { | |
fmt.Println("Hello World!") | |
} | |
EOF | |
t3-no-push-check: | |
needs: t3-no-push | |
runs-on: ubuntu-latest | |
steps: | |
- uses: GeoNet/setup-crane@00c9e93efa4e1138c9a7a5c594acd6c75a2fbf0c # main | |
with: | |
version: ${{ env.VERSION_CRANE }} | |
- name: check for images | |
env: | |
IMAGE: ${{ needs.t3-no-push.outputs.images }} | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
! crane manifest $IMAGE || \ | |
( | |
gh api -X DELETE /orgs/GeoNet/packages/container/actions%2Ftestimage-ko-build-t3-no-push-1 || true | |
) | |
t4-custom-config: | |
uses: ./.github/workflows/reusable-ko-build.yml | |
with: | |
push: true | |
configPath: .cool.ko.yaml | |
setup: | | |
mkdir -p testdata-ko-build/cmd/testimage-ko-build-t4-custom-config-{1,2} | |
cat << EOF > testdata-ko-build/cmd/testimage-ko-build-t4-custom-config-1/main.go | |
package main | |
import "fmt" | |
func main() { | |
fmt.Println("Hello World!") | |
} | |
EOF | |
cat << EOF > testdata-ko-build/cmd/testimage-ko-build-t4-custom-config-2/main.go | |
package main | |
import "fmt" | |
func main() { | |
fmt.Println("Hello World!") | |
} | |
EOF | |
cat << EOF > .cool.ko.yaml | |
defaultBaseImage: ghcr.io/geonet/base-images/nginx:latest | |
baseImageOverrides: | |
github.com/GeoNet/Actions/testdata-ko-build/cmd/testimage-ko-build-t4-custom-config-2: ghcr.io/geonet/base-images/alpine:3.18 | |
EOF | |
t4-custom-config-check: | |
needs: t4-custom-config | |
runs-on: ubuntu-latest | |
steps: | |
- uses: GeoNet/setup-crane@00c9e93efa4e1138c9a7a5c594acd6c75a2fbf0c # main | |
with: | |
version: ${{ env.VERSION_CRANE }} | |
- name: check for images | |
env: | |
IMAGES: ${{ needs.t4-custom-config.outputs.images }} | |
run: | | |
echo "$IMAGES" | tr ',' '\n' | xargs -n 1 -I{} crane manifest {} | |
crane manifest "$(echo "$IMAGES" | tr ',' '\n' | grep 'custom-config-1')" | jq -r '.annotations["org.opencontainers.image.base.name"]' | grep -qE 'ghcr.io/geonet/base-images/nginx:latest' | |
crane manifest "$(echo "$IMAGES" | tr ',' '\n' | grep 'custom-config-2')" | jq -r '.annotations["org.opencontainers.image.base.name"]' | grep -qE 'ghcr.io/geonet/base-images/alpine:3.18' | |
- name: cleanup | |
if: always() | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh api -X DELETE /orgs/GeoNet/packages/container/actions%2Ftestimage-ko-build-t4-custom-config-1 || true | |
gh api -X DELETE /orgs/GeoNet/packages/container/actions%2Ftestimage-ko-build-t4-custom-config-2 || true |