Reuse workflow CI (#10826)
* Reuse workflow CI * Simplify images Makefiles
This commit is contained in:
parent
00db204d86
commit
c9a3571556
39 changed files with 385 additions and 782 deletions
82
.github/workflows/zz-tmpl-images.yaml
vendored
Normal file
82
.github/workflows/zz-tmpl-images.yaml
vendored
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
#### THIS IS A TEMPLATE ####
|
||||
# This workflow is created to be a template for every time an e2e teest is required,
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
name:
|
||||
required: true
|
||||
type: string
|
||||
platforms-test:
|
||||
type: string
|
||||
default: linux/amd64
|
||||
platforms-publish:
|
||||
type: string
|
||||
default: linux/amd64
|
||||
|
||||
env:
|
||||
PLATFORMS: ${{ inputs.platforms-test }}
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
changestag:
|
||||
permissions:
|
||||
contents: read # for dorny/paths-filter to fetch a list of changed files
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
tag: ${{ steps.filter.outputs.tag }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
|
||||
id: filter
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
filters: |
|
||||
tag:
|
||||
- 'images/**/TAG'
|
||||
|
||||
image-build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cd images/ && make NAME=${{ inputs.name }} build
|
||||
|
||||
image-push:
|
||||
name: Push
|
||||
needs: changestag
|
||||
if: |
|
||||
(github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'kubernetes/ingress-nginx' && needs.changestag.outputs.tag == 'true')
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
env:
|
||||
PLATFORMS: ${{ inputs.platforms-publish }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Push
|
||||
run: |
|
||||
cd images/ && make REGISTRY=ghcr.io/kubernetes/ingress-nginx NAME=${{ inputs.name }} push
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue