diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index fcb33230..dc051e5d 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -100,17 +100,123 @@ jobs: compression-level: 0 compose-test: - uses: ./.github/workflows/compose-test.yml + name: compose-test needs: build-test - with: - artifact_name: ${{ needs.build-test.outputs.ARTIFACT_NAME }} - secrets: inherit + runs-on: ubuntu-latest + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 + + - name: Download artifacts + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + path: /tmp + name: ${{ env.ARTIFACT_NAME }} + + - name: Load Docker images + run: | + 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@v6.0.1 + timeout-minutes: 10 + with: + compose_pull: false + compose_file_path: test/docker-compose.yml + quay_username: ${{ secrets.QUAY_USERNAME }} + quay_password: ${{ secrets.QUAY_PASSWORD }} + + - uses: Alfresco/alfresco-build-tools/.github/actions/docker-dump-containers-logs@v6.0.0 + helm-test: - uses: ./.github/workflows/helm-test.yml + name: helm test needs: build-test - with: - artifact_name: ${{ needs.build-test.outputs.ARTIFACT_NAME }} - ACS_VALUES_VERSION: ${{ needs.build-test.outputs.ACS_VALUES_VERSION }} - ACS_CHART_VERSION: ${{ needs.build-test.outputs.ACS_CHART_VERSION }} - secrets: inherit + 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/setup-kind@v5.35.0 + 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/${{ env.ACS_VALUES_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: 8m + 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 diff --git a/.github/workflows/compose-test.yml b/.github/workflows/compose-test.yml deleted file mode 100644 index b86566b6..00000000 --- a/.github/workflows/compose-test.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Compose Test - -on: - workflow_call: - inputs: - ARTIFACT_NAME: - required: true - type: string - secrets: - QUAY_PASSWORD: - required: true - QUAY_USERNAME: - required: true - -jobs: - compose-test: - name: compose-test - runs-on: ubuntu-latest - steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 - - - name: Download artifacts - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - path: /tmp - name: ${{ inputs.ARTIFACT_NAME }} - - - name: Load Docker images - run: | - docker load -i /tmp/${{ inputs.ARTIFACT_NAME }}.tar - docker image ls -a - - - name: Verify docker-compose - uses: Alfresco/alfresco-build-tools/.github/actions/dbp-charts/verify-compose@v6.0.1 - timeout-minutes: 10 - with: - compose_pull: false - compose_file_path: test/docker-compose.yml - quay_username: ${{ secrets.QUAY_USERNAME }} - quay_password: ${{ secrets.QUAY_PASSWORD }} - - - uses: Alfresco/alfresco-build-tools/.github/actions/docker-dump-containers-logs@v6.0.0 diff --git a/.github/workflows/helm-test.yml b/.github/workflows/helm-test.yml deleted file mode 100644 index 740421fc..00000000 --- a/.github/workflows/helm-test.yml +++ /dev/null @@ -1,110 +0,0 @@ -name: Compose Test - -on: - workflow_call: - inputs: - ARTIFACT_NAME: - required: true - type: string - ACS_VALUES_VERSION: - required: true - type: string - ACS_CHART_VERSION: - required: true - type: string - secrets: - QUAY_PASSWORD: - required: true - QUAY_USERNAME: - required: true - -jobs: - helm-test: - name: helm test - runs-on: alfrescoPub-ubuntu2204-16G-4CPU - steps: - - name: Download artifacts - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - path: /tmp - name: ${{ inputs.ARTIFACT_NAME }} - - - name: Setup cluster - uses: Alfresco/alfresco-build-tools/.github/actions/setup-kind@v5.35.0 - with: - ingress-nginx-ref: controller-v1.8.2 - metrics: "true" - - - name: Load Docker images - run: | - kind load image-archive -n chart-testing /tmp/${{ inputs.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/${{ inputs.ACS_VALUES_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 ${{ inputs.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: 8m - 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 diff --git a/.github/workflows/test-make.yml b/.github/workflows/test-make.yml index 88ff69e1..9101ccd9 100644 --- a/.github/workflows/test-make.yml +++ b/.github/workflows/test-make.yml @@ -10,17 +10,8 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref_name }} cancel-in-progress: true -env: - ACS_CHART_VERSION: 8.3.0 - ACS_VALUES_VERSION: cfb0d426eff14a8b581c31e61db5e670da09ba3b - ARTIFACT_NAME: alfresco-docker-images - jobs: make-test: - outputs: - ARTIFACT_NAME: ${{ env.ARTIFACT_NAME }} - ACS_VALUES_VERSION: ${{ env.ACS_VALUES_VERSION }} - ACS_CHART_VERSION: ${{ env.ACS_CHART_VERSION }} runs-on: ubuntu-latest steps: - name: Setup nexus authentication @@ -41,39 +32,15 @@ jobs: - name: Make Docker images id: make run: | - make all - - - name: Show all built images - run: docker images + make all_ci + echo "du=$(du -s | cut -f1)" >> $GITHUB_OUTPUT - - name: Docker save all baked images whose name include `alfresco` + - name: Check Images are loaded and artifacts are cleanup run: | - docker save -o /tmp/${{ env.ARTIFACT_NAME }}.tar $(docker images --format "{{.Repository}}:{{.Tag}}" | grep alfresco) - - - name: Check disk space - run: df -h - if: always() - - - name: Upload images as artifact and set outputs with envs - uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 - with: - name: ${{ env.ARTIFACT_NAME }} - path: /tmp/${{ env.ARTIFACT_NAME }}.tar - retention-days: 1 - compression-level: 0 - - compose-test: - uses: ./.github/workflows/compose-test.yml - needs: make-test - with: - artifact_name: ${{ needs.make-test.outputs.ARTIFACT_NAME }} - secrets: inherit - - helm-test: - uses: ./.github/workflows/helm-test.yml - needs: make-test - with: - artifact_name: ${{ needs.make-test.outputs.ARTIFACT_NAME }} - ACS_VALUES_VERSION: ${{ needs.make-test.outputs.ACS_VALUES_VERSION }} - ACS_CHART_VERSION: ${{ needs.make-test.outputs.ACS_CHART_VERSION }} - secrets: inherit + echo -n "Checking images are loaded in local Docker Engine..." + docker images --format "{{.Repository}}:{{.Tag}}" | grep alfresco || echo "No Alfresco image found" && exit 1 + echo "Checking artifacts clean up worked" + if [ ${{ steps.make.outputs.DU }} -lt $(du -s | cut -f1) ]; then + echo "Artifacts were not cleaned up" + exit 1 + fi