Fix Istio CRD name and add log message #554
Workflow file for this run
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
name: Build | |
concurrency: | |
group: "${{ github.repository }}${{ github.ref }}" | |
cancel-in-progress: true | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
push: | |
branches: | |
- main | |
env: | |
REGISTRY: 353146681200.dkr.ecr.us-east-1.amazonaws.com | |
REPOSITORY_NAME: otterize | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
service: | |
- intents-operator | |
- watcher | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 1 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@master | |
with: | |
driver-opts: network=host | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: otterize | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build & Test | |
uses: docker/build-push-action@v2 | |
with: | |
context: src/ | |
file: src/${{ matrix.service }}.Dockerfile | |
tags: ${{ env.REGISTRY }}/${{ env.REPOSITORY_NAME }}:${{ matrix.service }}-${{ github.sha }} | |
push: true | |
network: host | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
netpol-e2e-test: | |
uses: ./.github/workflows/netpol-e2e-test.yaml | |
name: Trigger e2e tests | |
# Must pass the secrets as the called workflow does not have access to the same context | |
secrets: | |
OTTERIZEBOT_GITHUB_TOKEN: ${{ secrets.OTTERIZEBOT_GITHUB_TOKEN }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
with: | |
operator-tag: intents-operator-${{ github.sha }} | |
watcher-tag: watcher-${{ github.sha }} | |
needs: | |
- build | |
tag-latest-dev: | |
name: Tag latest | |
if: github.ref == 'refs/heads/main' | |
needs: | |
- build | |
- netpol-e2e-test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- id: install-aws-cli | |
uses: unfor19/install-aws-cli-action@v1 | |
# Push the Docker image to AWS ECR | |
- name: Tag Images as latest | |
run: |- | |
retag_image_as_latest() { MANIFEST=$(aws ecr batch-get-image --repository-name ${{ env.REPOSITORY_NAME }} --image-ids imageTag="$1-${{ github.sha }}" --query "images[].imageManifest" --output text); if [ -z "$MANIFEST" ]; then echo Manifest not found; exit 1; fi; OUTPUT=$(aws ecr put-image --repository-name ${{ env.REPOSITORY_NAME }} --image-tag "$1-latest" --image-manifest "$MANIFEST" 2>&1 || true); if echo $OUTPUT | grep 'An error occurred' >/dev/null && ! echo $OUTPUT | grep ImageAlreadyExistsException >/dev/null; then echo $OUTPUT; exit 1; fi; } | |
retag_image_as_latest intents-operator | |
retag_image_as_latest watcher |