-
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 b7056a0
Showing
3 changed files
with
113 additions
and
17 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.repository }}:${{ matrix.service }}-${{ github.sha }} | ||
push: false | ||
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: mapper-${{ github.sha }} | ||
sniffer-tag: sniffer-${{ github.sha }} | ||
mapper-image: ${{ github.repository }} | ||
sniffer-image: ${{ github.repository }} | ||
|
||
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