-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d5d5108
commit 82fdd94
Showing
3 changed files
with
122 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Build | ||
concurrency: | ||
group: "${{ github.repository }}${{ github.ref }}buildfork" | ||
cancel-in-progress: true | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
|
||
env: | ||
REGISTRY: "ghcr.io" | ||
|
||
jobs: | ||
|
||
build: | ||
name: Build | ||
if: github.repository != 'otterize/network-mapper' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'otterize/network-mapper') | ||
runs-on: ubuntu-latest | ||
outputs: | ||
registry: ${{ steps.registry.outputs.registry }} # workaround since env is not available outside of steps, i.e. in calling external workflows like we later do in e2e-test | ||
strategy: | ||
matrix: | ||
service: | ||
- mapper | ||
- sniffer | ||
- kafka-watcher | ||
- istio-watcher | ||
|
||
steps: | ||
- id: registry | ||
run: echo "registry=${{ env.REGISTRY }}" >> "$GITHUB_OUTPUT" | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@master | ||
with: | ||
driver-opts: network=host | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Test & Build production image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: src/ | ||
file: build/${{ matrix.service }}.Dockerfile | ||
tags: ${{ env.REGISTRY }}/${{ github.actor }}-${{ matrix.service }}:${{ github.sha }} | ||
push: true | ||
network: host | ||
platforms: linux/amd64,linux/arm64 | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
build-args: | | ||
"VERSION=${{ github.run_id }}" | ||
e2e-test: | ||
uses: ./.github/workflows/e2e-test.yaml | ||
name: Trigger e2e tests | ||
# Must pass the secrets as the called workflow does not have access to the same context | ||
with: | ||
registry: ${{ needs.build.outputs.registry }} | ||
mapper-tag: ${{ github.sha }} | ||
sniffer-tag: ${{ github.sha }} | ||
mapper-image: ${{ github.actor }}/mapper | ||
sniffer-image: ${{ github.actor }}/sniffer | ||
|
||
needs: | ||
- build |
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
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