Skip to content

Commit

Permalink
Merge branch 'master' into feature/collapse-groups
Browse files Browse the repository at this point in the history
  • Loading branch information
theunrepentantgeek authored Jun 21, 2021
2 parents 7bfe460 + cc42aa3 commit 5d6cc9e
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 1 deletion.
49 changes: 49 additions & 0 deletions .github/workflows/build-devcontainer-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build Devcontainer image
on:
workflow_dispatch:
# no content, allows manual triggering

schedule:
# 5:30 pm every Sunday (UTC)
# to pick up any important bug fixes etc in base image
- cron: '30 17 * * 0'

push:
# run when changes pushed to master if any devcontainer files changed
branches:
- master
paths:
- .devcontainer/**

jobs:
# Based on: https://docs.github.com/en/actions/guides/publishing-docker-images#publishing-images-to-github-packages
build-devcontainer-image:
runs-on: ubuntu-latest

permissions:
packages: write
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: 'true'

- name: Log in to GitHub Docker Registry
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }

- name: Build & push Devcontainer image
uses: docker/build-push-action@v2
with:
context: .devcontainer
push: true
# Build an image usable as cache-from, per: https://docs.docker.com/engine/reference/commandline/build/#specifying-external-cache-sources
build-args: BUILDKIT_INLINE_CACHE=1
tags: |
docker.pkg.github.com/${{ github.repository }}/devcontainer:latest
docker.pkg.github.com/${{ github.repository }}/devcontainer:${{ github.sha }}
24 changes: 23 additions & 1 deletion .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,30 @@ jobs:
run: |
docker buildx build --tag devcontainer:1.0 --cache-from=type=local,src=docker-cache --load .devcontainer
- name: Run devcontainer image
id: devcontainer
run: |
container_id=$(docker create -w /workspace -v $GITHUB_WORKSPACE:/workspace -v /var/run/docker.sock:/var/run/docker.sock devcontainer:1.0)
docker start "$container_id"
echo "::set-output name=id::$container_id"
- name: Run CI tasks
run: docker run -w /workspace -v $GITHUB_WORKSPACE:/workspace -e AZURE_TENANT_ID -e AZURE_CLIENT_ID -e AZURE_CLIENT_SECRET -e AZURE_SUBSCRIPTION_ID devcontainer:1.0 task ci
run: |
docker exec "${{steps.devcontainer.outputs.id}}" task ci
- name: Build docker image
run: |
container_id=${{steps.devcontainer.outputs.id}}
docker exec "$container_id" task controller:docker-build
docker cp "$container_id:/workspace/hack/generated/bin" .
mv bin/*.tar azure-service-operator.tar
- name: Archive Docker image
uses: actions/upload-artifact@v2
with:
name: controller-image
path: azure-service-operator.tar
if-no-files-found: error

- name: Upload code coverage to Codecov
run: bash <(curl -s https://codecov.io/bash)
1 change: 1 addition & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ tasks:
- Dockerfile
cmds:
- docker build . -t {{.CONTROLLER_DOCKER_IMAGE}}
- docker save {{.CONTROLLER_DOCKER_IMAGE}} > bin/{{.CONTROLLER_DOCKER_IMAGE}}.tar

controller:test-integration-envtest:
desc: Run integration tests with envtest using record/replay.
Expand Down

0 comments on commit 5d6cc9e

Please sign in to comment.