Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
pmacius committed Aug 5, 2024
2 parents 8c48843 + 78028f7 commit 4e4cbd0
Show file tree
Hide file tree
Showing 7 changed files with 190 additions and 218 deletions.
145 changes: 128 additions & 17 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,31 @@ on:
branches:
- main

env:
ACS_CHART_VERSION: 8.3.0
ARTIFACT_NAME: alfresco-docker-images

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name || github.run_id }}
cancel-in-progress: true

permissions:
contents: read
actions: read

jobs:
pre-commit:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
with:
auto-commit: "true"

build-test:
runs-on: ubuntu-latest
needs: pre-commit
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
Expand All @@ -31,27 +49,32 @@ jobs:
run: ./scripts/fetch-artifact.sh

- name: Set up QEMU
uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3.1.0
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@2ad185228a349d19414702819e06df9fa4314287 # v3.4.0
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1

- name: Login to Quay.io
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Collect Workflow Telemetry
uses: catchpoint/workflow-telemetry-action@v2
with:
comment_on_pr: false

- name: Bake Docker images
uses: docker/bake-action@eac74531aa56a9266bfedfe5edb6b851ce2cca2b # v5.4.0
uses: docker/bake-action@a4d7f0b5b91c14a296d792d4ec53a9db17f02e67 # v5.5.0

- name: Show all built images
run: docker images

- name: Docker save all baked images whose name include `alfresco`
run: |
docker save -o /tmp/alfresco-docker-images.tar $(docker images --format "{{.Repository}}:{{.Tag}}" | grep alfresco)
docker save -o /tmp/${{ env.ARTIFACT_NAME }}.tar $(docker images --format "{{.Repository}}:{{.Tag}}" | grep alfresco)
- name: Check disk space
run: df -h
Expand All @@ -60,40 +83,128 @@ jobs:
- name: Upload images as artifact
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: docker-images
path: /tmp/alfresco-docker-images.tar
name: ${{ env.ARTIFACT_NAME }}
path: /tmp/${{ env.ARTIFACT_NAME }}.tar
retention-days: 1
compression-level: 0

compose-test:
name: compose-test ${{ matrix.docker-compose-file }}
name: compose-test
needs: build-test
runs-on: ubuntu-latest
strategy:
matrix:
docker-compose-file: [docker-compose.yml, docker-compose-components.yml]
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@2ad185228a349d19414702819e06df9fa4314287 # v3.4.0
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1

- name: Download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
path: /tmp
name: docker-images
name: ${{ env.ARTIFACT_NAME }}

- name: Load Docker images
run: |
ls -1 /tmp/*.tar | xargs --no-run-if-empty -L 1 docker load -i
docker load -i /tmp/${{ env.ARTIFACT_NAME }}.tar
docker image ls -a
- name: Verify docker-compose
uses: Alfresco/alfresco-build-tools/.github/actions/dbp-charts/verify-compose@v5.34.0
uses: Alfresco/alfresco-build-tools/.github/actions/dbp-charts/verify-compose@v6.0.0
timeout-minutes: 10
with:
compose_pull: false
compose_file_path: docker-compose/${{ matrix.docker-compose-file }}
compose_file_path: test/docker-compose.yml
quay_username: ${{ secrets.QUAY_USERNAME }}
quay_password: ${{ secrets.QUAY_PASSWORD }}

- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]

helm-test:
name: helm test
needs: build-test
runs-on: alfrescoPub-ubuntu2204-16G-4CPU
steps:
- name: Download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
path: /tmp
name: ${{ env.ARTIFACT_NAME }}

- name: Setup cluster
uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
with:
ingress-nginx-ref: controller-v1.8.2
metrics: "true"

- name: Load Docker images
run: |
kind load image-archive -n chart-testing /tmp/${{ env.ARTIFACT_NAME }}.tar
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
with:
version: "3.15.2"

- name: Login to Quay.io
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Create registries auth secret
run: >-
kubectl create secret generic regcred
--from-file=.dockerconfigjson=$HOME/.docker/config.json
--type=kubernetes.io/dockerconfigjson
- name: Fetch upstream values for tests
run: >-
curl -ssfL
https://raw.githubusercontent.com/Alfresco/acs-deployment/v${{ env.ACS_CHART_VERSION }}/test/enterprise-integration-test-values.yaml
-o test/helm/enterprise-integration-test-values.yaml &&
ls -l test/helm/enterprise-integration-test-values.yaml &&
cat test/helm/enterprise-integration-test-values.yaml
- name: Helm install
id: helm_install
run: |
helm repo add alfresco https://kubernetes-charts.alfresco.com/stable
helm repo update
helm install acs alfresco/alfresco-content-services \
--version ${{ env.ACS_CHART_VERSION }} \
--set global.search.sharedSecret="$(openssl rand -hex 24)" \
--set global.known_urls=http://localhost \
--set global.alfrescoRegistryPullSecrets=regcred \
--values test/helm/enterprise-integration-test-values.yaml \
--values test/helm/test-overrides.yaml
- name: Watch Helm deployment
env:
HELM_INSTALL_TIMEOUT: 7m
run: |
kubectl get pods --watch &
KWPID=$!
kubectl wait --timeout=${{ env.HELM_INSTALL_TIMEOUT }} --all=true --for=condition=Ready pods
kill $KWPID
echo "Waiting for ESC Reindexing job to complete... "
kubectl wait --timeout=5m --for=condition=complete job/acs-alfresco-search-enterprise-reindexing
- name: Debug cluster status after install
if: always() && steps.helm_install.outcome != 'skipped'
run: |
helm ls --all-namespaces --all
kubectl get all --all-namespaces
kubectl describe pod
- name: Run helm test
id: helm_test
run: helm test acs

- name: Debug cluster status after helm test
if: always() && steps.helm_test.outcome != 'skipped'
run: |
kubectl logs -l app.kubernetes.io/component=dtas --tail=-1
kubectl get all --all-namespaces
kubectl describe pod
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ dist
*.rpm
*.gz
*.tgz
test/helm/enterprise-integration-test-values.yaml
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
repos:
# General hooks section
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: check-yaml
args: [--allow-multiple-documents]
Expand All @@ -12,6 +12,6 @@ repos:
args: ["--fix=lf"]
- id: end-of-file-fixer
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.14.3
rev: 0.29.1
hooks:
- id: check-github-workflows
Loading

0 comments on commit 4e4cbd0

Please sign in to comment.