fix(logging): Log 2 json #79
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 and deploy pipeline | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: {} | |
env: | |
DOCKER_REGISTRY: 821090935708.dkr.ecr.eu-west-1.amazonaws.com | |
SPINNAKER_URL: https://spinnaker-gate.shared.devland.is | |
jobs: | |
docker-build: | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 20 | |
steps: | |
- 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: eu-west-1 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-cache-v2-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx-cache-v2 | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: "${{ env.DOCKER_REGISTRY }}/dss:${{ github.sha }},${{ env.DOCKER_REGISTRY }}/dss:latest" | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new | |
- uses: nelonoel/[email protected] | |
- name: Trigger Deployment for service | |
# if: github.ref == 'refs/heads/main' | |
env: | |
SPINNAKER_WEBHOOK_TOKEN: ${{ secrets.SPINNAKER_WEBHOOK_TOKEN }} | |
run: | | |
echo "Sending webhook with branch: ${BRANCH_NAME}" | |
curl $SPINNAKER_URL/webhooks/webhook/digital-signature-service -H "content-type: application/json" --data-binary @- <<BODY | |
{ | |
"token": "$SPINNAKER_WEBHOOK_TOKEN", | |
"branch": "${BRANCH_NAME}", | |
"parameters": { | |
"docker_tag": "${{ github.sha }}", | |
"feature_name": "$(echo "${BRANCH_NAME}" | cut -d"/" -f2- | tr -cd '[:alnum:].-' | tr '[:upper:]' '[:lower:]' | cut -c1-50)", | |
"images": "dss", | |
"pull_request_number": "$(echo $GITHUB_REF | cut -d'/' -f3)" | |
} | |
} | |
BODY | |
# Temp fix until these are resolved (cache grows forever) | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |