Skip to content

Commit 5d3c8d7

Browse files
committed
ci: Make ci.yaml valid for both pushes and prs
I didn't really see the reason to keep the files split, when ci.yaml is pretty easily made to work for both scenarios. We end up losing pushes pushing new container images for non-main branch builds if not created by dependabot. That was a lot to keep in context and also the correct thing to do. A push to a branch by someone with write permissions would end up pushing to the one and only/main use tags. This was just *wrong*. So all in all we get better determenisitc behavior with this setup. Signed-off-by: Manuel Mendez <mmendez@equinix.com>
1 parent 31e8a48 commit 5d3c8d7

File tree

2 files changed

+29
-59
lines changed

2 files changed

+29
-59
lines changed

.github/workflows/ci.yaml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
name: For each PR
1+
name: For each PR and Push
22
on:
33
pull_request:
44
paths-ignore:
55
- kernel/**
6+
push:
7+
paths-ignore:
8+
- kernel/**
9+
env:
10+
LINUXKIT_CONFIG: hook-ci.yaml
11+
ORG: localhost:5000/tinkerbell
612
jobs:
713
validation:
814
runs-on: ubuntu-20.04
@@ -19,11 +25,18 @@ jobs:
1925
uses: docker/setup-qemu-action@v1.1.0
2026

2127
- name: Set up Docker Buildx
22-
id: buildx
2328
uses: docker/setup-buildx-action@v1.3.0
2429
with:
2530
driver-opts: network=host
2631

32+
- name: Login to quay.io
33+
if: github.ref == 'refs/heads/main'
34+
uses: docker/login-action@v1
35+
with:
36+
registry: quay.io
37+
username: ${{ secrets.QUAY_USERNAME }}
38+
password: ${{ secrets.QUAY_PASSWORD }}
39+
2740
- uses: cachix/install-nix-action@v16
2841
with:
2942
nix_path: nixpkgs=channel:nixos-unstable
@@ -34,12 +47,24 @@ jobs:
3447
# Replace hook-{bootkit,docker} but not hook-kernel
3548
- run: sed -E -e 's,quay.io/tinkerbell/hook-(bootkit|docker),localhost:5000/tinkerbell/hook-\1,g' hook.yaml | tee hook-ci.yaml
3649

50+
- name: Override the LINUXKIT_CONFIG & ORG env vars
51+
if: github.ref == 'refs/heads/main'
52+
run: |
53+
{
54+
echo 'LINUXKIT_CONFIG=hook.yaml'
55+
echo 'ORG=quay.io/tinkerbell'
56+
} | tee -a "$GITHUB_ENV"
57+
3758
- name: Build Hook tarballs
3859
run: nix-shell --run 'make dist'
3960
env:
4061
GIT_VERSION: ${{ github.sha }}
41-
LINUXKIT_CONFIG: hook-ci.yaml
42-
ORG: localhost:5000/tinkerbell
62+
63+
- name: Publish Hook tarballs
64+
if: github.ref == 'refs/heads/main'
65+
run: nix-shell --run 'make deploy'
66+
env:
67+
GIT_VERSION: ${{ github.sha }}
4368

4469
- uses: actions/upload-artifact@v2
4570
with:

.github/workflows/push.yaml

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)