Skip to content

test multitags

test multitags #20

Workflow file for this run

name: Build

Check failure on line 1 in .github/workflows/build-kubectl.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build-kubectl.yml

Invalid workflow file

(Line: 11, Col: 3): Unexpected value 'BASE_IMAGE="ghcr.io/cooptilleuls/sre/kubectl" IMAGE_REPOSITORY=ghcr.io/cooptilleuls/sre', (Line: 46, Col: 14): Unrecognized named-value: 'BASE_IMAGE'. Located at position 1 within expression: BASE_IMAGE
on:
workflow_call:
inputs:
tags:
type: string
description: The Docker Tags (see docker/metadata-action@v4 for available values)
required: true
env:
BASE_IMAGE="ghcr.io/cooptilleuls/sre/kubectl"
IMAGE_REPOSITORY=ghcr.io/cooptilleuls/sre
jobs:
fetch-data:
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.data.outputs.versions }}
tags: ${{ steps.data.outputs.tags }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: 'Set up skopeo'
uses: warjiang/setup-skopeo@main
with:
version: latest
- id: data
run: |
python --version
export ALL_VERSIONS=$(skopeo list-tags docker://registry.k8s.io/kubectl | jq -r '.Tags | .[]| select(. | match("v[0-9].[0-9]{2}.[0-9]$"))')
python ./get_kubectl_versions.py > data.json
echo "versions=$(cat data.json )" >> "$GITHUB_OUTPUT"
echo "tags=$(cat data.json | jq -c 'keys')" >> "$GITHUB_OUTPUT"
build-kubectl:
runs-on: ubuntu-latest
needs: fetch-data
strategy:
fail-fast: false
matrix:
tag: ${{ fromJSON(needs.fetch-data.outputs.tags) }}
steps:
- name: test
run: echo "$OUTPUT1 $OUTPUT2 ${{matrix.tag}}"
- name: data
id: data
run: |
KUBECTL_VERSION=$(echo '${{needs.fetch-data.outputs.versions }}' | jq -r --arg KEY "${{ matrix.tag }}" '.[$KEY]')
echo "build_args=KUBECTL_VERSION=$KUBECTL_VERSION" >> "$GITHUB_OUTPUT"
echo "tags=${{ env.BASE_IMAGE }}:${KUBECTL_VERSION},${{BASE_IMAGE}}:${{matrix.tag}}" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
id: buildx
uses: docker/[email protected]
- name: Login to registry
uses: docker/login-action@v1
with:
registry: ${{ env.IMAGE_REPOSITORY }}
username: _json_key
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image and push to registry
uses: docker/build-push-action@v6
id: docker_build_push
env:
DOCKER_BUILD_SUMMARY: true
with:
context: ./kubectl
tags: ${{ steps.data.outputs.tags }}
build-args: ${{ steps.data.outputs.build_args }}
target: debian-kubectl
push: true
cache-from: |
type=gha
cache-to: |
type=gha,mode=max