Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide better experience for forked PRs #653

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@ permissions:
contents: read

jobs:
setup:
if: github.event_name == 'pull_request'
outputs:
is_fork: ${{ steps.fork.outputs.is_fork }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Identify if the PR comes from a fork
id: fork
run: echo "is_fork=$(gh pr view --json isCrossRepository --jq .isCrossRepository)" >> $GITHUB_OUTPUT
docker-build:
needs: setup
permissions:
contents: read
packages: write
Expand All @@ -21,3 +32,4 @@ jobs:
name: runner-manager
namespace: ${{ github.repository_owner }}
tag: ${{ github.ref_name == 'main' && 'latest' || github.sha }}
push: ${{ needs.setup.outputs.is_fork == 'true' && false || true }}
29 changes: 18 additions & 11 deletions .github/workflows/test-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,31 @@ permissions:
packages: write

jobs:
docker-build:
permissions:
contents: write
packages: write
uses: scality/workflows/.github/workflows/docker-build.yaml@v2
with:
name: runner-manager
namespace: ${{ github.repository_owner }}

test-deployment:
needs: docker-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build runner-manager image
uses: docker/build-push-action@v5
with:
context: .
push: false
load: true
tags: ghcr.io/${{ github.repository }}:${{ github.sha }}
cache-from: type=gha,scope=runner-manager
cache-to: type=gha,mode=max,scope=runner-manager
- uses: helm/kind-action@v1
with:
cluster_name: kind
- name: Wait for kind node to be ready
run: kubectl wait --for=condition=Ready node/kind-control-plane --timeout=120s
- name: Load image to kind cluster
run: kind load docker-image ghcr.io/${{ github.repository }}:${{ github.sha }}
- name: Edit the runner-manager image
working-directory: manifests
run: kustomize edit set image ghcr.io/${{ github.repository_owner }}/runner-manager:${{ github.sha }}
run: kustomize edit set image ghcr.io/${{ github.repository }}:${{ github.sha }}
- name: Deploy runner-manager
run: kubectl apply -k manifests
- name: Check if deployment is ready
Expand Down
Loading