Skip to content

Commit

Permalink
Update to separate out crossplane
Browse files Browse the repository at this point in the history
  • Loading branch information
theunrepentantgeek committed Sep 25, 2023
1 parent 8aa284c commit 9a57947
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 10 deletions.
94 changes: 84 additions & 10 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,6 @@ jobs:
name: test-output
path: reports/*.json

- name: Build docker image & build configuration YAML
run: |
container_id=${{ env.container_id }}
docker exec "$container_id" task controller:docker-build-and-save
docker exec "$container_id" task controller:run-kustomize-for-envtest
if: steps.check-changes.outputs.code-changed == 'true'

- name: Archive outputs
uses: actions/upload-artifact@v3.1.2
with:
Expand Down Expand Up @@ -309,13 +302,94 @@ jobs:
name: test-output
path: reports/*.json

- name: Build docker image & build configuration YAML
- name: Archive outputs
uses: actions/upload-artifact@v3.1.2
with:
name: output
path: v2/bin/*
if-no-files-found: error
if: steps.check-changes.outputs.code-changed == 'true'

- name: Upload code coverage to Codecov
run: bash <(curl -s https://codecov.io/bash)
if: steps.check-changes.outputs.code-changed == 'true'

test-crossplane:
runs-on: [self-hosted, 1ES.Pool=aso-1es-pool]
permissions:
packages: read

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # required to access tags
submodules: 'true'

- name: check-changes
id: check-changes
run: scripts/v2/check-changes.sh

- name: Log in to GitHub Docker Registry
uses: docker/login-action@v2
with:
registry: docker.pkg.github.com # ghcr.io not yet enabled for Azure org
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
if: steps.check-changes.outputs.code-changed == 'true'

# Note: Changes to this step must also be mirrored into pr-validation-with-secrets.yaml
- name: Build devcontainer image
# We must issue a manual pull before the build so the image gets copied locally, because
# docker.pkg.github.com is not a valid Docker registry and doesn't work with --cache-from,
# however, `docker pull` will fall back to other methods that do work and get the image loaded.
#
# This message comes from "docker pull":
#
# Run docker pull docker.pkg.github.com/azure/azure-service-operator/aso-devcontainer:latest
# WARNING: ⚠️ Failed to pull manifest by the resolved digest. This registry does not
# appear to conform to the distribution registry specification; falling back to
# pull by tag. This fallback is DEPRECATED, and will be removed in a future
# release. Please contact admins of https://docker.pkg.github.com. ⚠️
#
# See: https://github.com/moby/moby/issues/41687#issuecomment-733826074 and related issues
run: |
docker pull docker.pkg.github.com/azure/azure-service-operator/aso-devcontainer:latest
docker build --cache-from docker.pkg.github.com/azure/azure-service-operator/aso-devcontainer:latest --tag devcontainer:latest .devcontainer
env:
DOCKER_BUILDKIT: 1
if: steps.check-changes.outputs.code-changed == 'true'

- 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 --network=host devcontainer:latest)
docker start "$container_id"
echo "container_id=$container_id" >> $GITHUB_ENV
if: steps.check-changes.outputs.code-changed == 'true'

- name: Run CI tasks
run: |
container_id=${{ env.container_id }}
docker exec "$container_id" task controller:docker-build-and-save
docker exec "$container_id" task controller:run-kustomize-for-envtest
set +e # don't exit instantly on failure, we need to produce Markdown summary
docker exec "$container_id" task crossplane:ci
EXIT_CODE=$?
set -e
# generate summary Markdown file for display in Actions
cat reports/*.md > $GITHUB_STEP_SUMMARY
exit $EXIT_CODE
if: steps.check-changes.outputs.code-changed == 'true'

- name: Save JSON logs on failure
if: ${{ failure() }}
uses: actions/upload-artifact@v3.1.2
with:
name: test-output
path: reports/*.json

- name: Archive outputs
uses: actions/upload-artifact@v3.1.2
with:
Expand Down
3 changes: 3 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,9 @@ tasks:
deps:
- basic-checks
- crossplane:generate-crds
cmds:
- task: verify-no-changes


############### Documentation targets ###############

Expand Down

0 comments on commit 9a57947

Please sign in to comment.