diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 29cb8780..5f9ad2c4 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -67,15 +67,9 @@ jobs: uses: actions/cache/restore@2cdf405574d6ef1f33a1d12acccd3ae82f47b3f2 # v4.1.0 id: artifacts-cache with: - key: ${{ runner.os }}-packages-${{ hashFiles('**/artifacts.json') }} - restore-keys: ${{ runner.os }}-packages- - path: | - **/*.jar - **/*.zip - **/*.amp - **/*.tgz - **/*.gz - **/*.rpm + key: ${{ runner.os }}-packages-v2-${{ hashFiles('**/artifacts.json') }} + restore-keys: ${{ runner.os }}-packages-v2- + path: artifacts_cache/** - name: Fetch artifacts from nexus run: ./scripts/fetch-artifacts.sh @@ -85,13 +79,7 @@ jobs: uses: actions/cache/save@2cdf405574d6ef1f33a1d12acccd3ae82f47b3f2 # v4.1.0 with: key: ${{ steps.artifacts-cache.outputs.cache-primary-key }} - path: | - **/*.jar - **/*.zip - **/*.amp - **/*.tgz - **/*.gz - **/*.rpm + path: artifacts_cache/** - name: Set up QEMU uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 @@ -255,6 +243,7 @@ jobs: if [ "${{ matrix.edition }}" = "community" ]; then sed -i "s|/alfresco-content-repository|/alfresco-content-repository-community|g" ${{ env.OVERRIDES_VALUES_FILE }} + sed -i "s|/alfresco-share|/alfresco-share-community|g" ${{ env.OVERRIDES_VALUES_FILE }} fi cat ${{ env.OVERRIDES_VALUES_FILE }} diff --git a/.github/workflows/build_forks.yml b/.github/workflows/build_forks.yml new file mode 100644 index 00000000..88bc4526 --- /dev/null +++ b/.github/workflows/build_forks.yml @@ -0,0 +1,213 @@ +name: CI from forks + +on: + pull_request: + branches: + - main + paths: + - '.github/workflows/build_forks.yml' + +env: + ACS_CHART_VERSION: 8a819c9b90b9015e5ab2654c47961fef4183cbcf # v8.5.1 plus the fix for community test values + ARTIFACT_NAME: alfresco-docker-images + REGISTRY: localhost + REGISTRY_NAMESPACE: alfresco + TAG: latest + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name || github.run_id }} + cancel-in-progress: true + +jobs: + pre-commit: + runs-on: ubuntu-latest + # if github.event.pull_request.head.repo.fork TODO: enable when repo is public + steps: + - uses: Alfresco/alfresco-build-tools/.github/actions/pre-commit@v7.1.1 + + build: + needs: pre-commit + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + + - uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.1 + + - name: Restore packages artifacts + uses: actions/cache/restore@2cdf405574d6ef1f33a1d12acccd3ae82f47b3f2 # v4.1.0 + id: artifacts-cache + with: + key: ${{ runner.os }}-packages-community-v2-${{ hashFiles('**/artifacts.json') }} + restore-keys: ${{ runner.os }}-packages-community-v2 + path: artifacts_cache/** + + - name: Fetch artifacts from nexus + run: ./scripts/fetch-artifacts.sh + + - name: Save packages artifacts + if: steps.artifacts-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@2cdf405574d6ef1f33a1d12acccd3ae82f47b3f2 # v4.1.0 + with: + key: ${{ steps.artifacts-cache.outputs.cache-primary-key }} + path: artifacts_cache/** + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1 + + - name: Bake Docker images + env: + TARGETARCH: linux/amd64 + DOCKER_PUSH: ${{ github.actor != 'dependabot[bot]'}} + uses: docker/bake-action@2e3d19baedb14545e5d41222653874f25d5b4dfb # v5.10.0 + with: + targets: community + + - name: Export all baked images whose name include `alfresco` + run: | + docker save -o /tmp/${{ env.ARTIFACT_NAME }}.tar $(docker images --format "{{.Repository}}:{{.Tag}}" | grep alfresco) + + - name: Upload images as artifact + 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: + name: compose-test + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + + - name: Download artifacts + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + path: /tmp + name: ${{ env.ARTIFACT_NAME }} + + - name: Load docker images from artifact + run: | + docker load -i /tmp/${{ env.ARTIFACT_NAME }}.tar + docker image ls -a + + - name: Verify docker-compose + id: verify_compose + uses: Alfresco/alfresco-build-tools/.github/actions/dbp-charts/verify-compose@v7.1.1 + timeout-minutes: 10 + with: + compose_pull: false + compose_file_path: test/community-docker-compose.yml + + - name: Save containers logs + if: always() && steps.verify_compose.outcome != 'skipped' + uses: Alfresco/alfresco-build-tools/.github/actions/docker-dump-containers-logs@v7.1.1 + with: + output-archive-name: community-logs + + helm-test: + name: helm test + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + + - name: Download artifacts + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + path: /tmp + name: ${{ env.ARTIFACT_NAME }} + + - name: Setup KinD cluster + uses: Alfresco/alfresco-build-tools/.github/actions/setup-kind@v7.1.1 + 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 + + - uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0 + with: + version: "3.15.2" + + - name: Create configmaps for adf apps + run: | + kubectl create configmap acc-config --from-file=app.config.json=test/configs/acc.json + kubectl create configmap adw-config --from-file=app.config.json=test/configs/adw.json + + - name: Checkout acs-deployment sources + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + with: + repository: Alfresco/acs-deployment + ref: ${{ env.ACS_CHART_VERSION }} + path: acs-deployment + + - name: Setup helm repository + working-directory: acs-deployment/helm/alfresco-content-services + run: | + helm repo add self https://alfresco.github.io/alfresco-helm-charts/ + helm repo add activiti https://activiti.github.io/activiti-cloud-helm-charts + helm repo add bitnami https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami/ + helm repo add elastic https://helm.elastic.co + helm dependency build + + - name: Helm install + id: helm_install + run: | + helm install acs ./acs-deployment/helm/alfresco-content-services \ + --set global.search.sharedSecret="$(openssl rand -hex 24)" \ + --set global.known_urls=http://localhost \ + --set alfresco-repository.image.repository=localhost/alfresco/alfresco-content-repository-community \ + --set share.image.repository=localhost/alfresco/alfresco-share-community \ + --values ./acs-deployment/helm/alfresco-content-services/community_values.yaml \ + --values ./acs-deployment/test/community-integration-test-values.yaml \ + --values test/helm/test-overrides.yaml \ + --values test/helm/test-overrides-community.yaml + + - name: Watch Helm deployment + env: + HELM_INSTALL_TIMEOUT: 10m + run: | + kubectl get pods --watch & + KWPID=$! + kubectl wait --timeout=${{ env.HELM_INSTALL_TIMEOUT }} --all=true --for=condition=Ready pods + kill $KWPID + + - 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 + + - name: Collect logs from all containers + if: always() && steps.helm_install.outcome != 'skipped' + run: | + mkdir -p logs + for pod in $(kubectl get pods -n default -o jsonpath='{.items[*].metadata.name}'); do + kubectl logs $pod -n default > logs/${pod}.log + done + + - name: Upload logs as artifact + if: always() && steps.helm_install.outcome != 'skipped' + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 #v4.4.0 + with: + name: k8s-logs-community + path: logs diff --git a/Makefile b/Makefile index 0cf3ed92..b605f168 100644 --- a/Makefile +++ b/Makefile @@ -83,7 +83,7 @@ ats: prepare_ats prepare_tengines search_enterprise: prepare_search_enterprise @echo "Building Search Enterprise images" - docker buildx bake ${DOCKER_BAKE_ARGS} enterprise-search + docker buildx bake ${DOCKER_BAKE_ARGS} enterprise_search connectors: prepare_connectors @echo "Building Connectors images" diff --git a/docker-bake.hcl b/docker-bake.hcl index 80aa66f2..81d3bcfb 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -1,16 +1,24 @@ group "default" { - targets = ["content_service", "enterprise-search", "ats", "tengines", "connectors", "search_service", "adf_apps", "sync"] + targets = ["enterprise", "community"] +} + +group "enterprise" { + targets = ["content_service_enterprise", "enterprise_search", "ats", "tengines", "connectors", "adf_apps", "sync"] } group "community" { - targets = ["repository_community", "share", "search_service", "tengine_aio", "acc"] + targets = ["content_service_community", "search_service", "tengines", "acc"] +} + +group "content_service_enterprise" { + targets = ["repository_enterprise", "share_enterprise"] } -group "content_service" { - targets = ["repository", "share"] +group "content_service_community" { + targets = ["repository_community", "share_community"] } -group "enterprise-search" { +group "enterprise_search" { targets = ["search_liveindexing", "search_reindexing"] } @@ -658,15 +666,33 @@ target "share" { ALFRESCO_SHARE_GROUP_ID = "${ALFRESCO_GROUP_ID}" ALFRESCO_SHARE_USER_NAME = "${ALFRESCO_SHARE_USER_NAME}" ALFRESCO_SHARE_USER_ID = "${ALFRESCO_SHARE_USER_ID}" + ALFRESCO_SHARE_ARTIFACT = "${share_editions.artifact}" } labels = { "org.label-schema.name" = "${PRODUCT_LINE} Share" "org.opencontainers.image.title" = "${PRODUCT_LINE} Share" "org.opencontainers.image.description" = "Alfresco Share" } - tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-share:${TAG}"] + tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/${share_editions.image_name}:${TAG}"] output = ["type=docker"] platforms = split(",", "${TARGETARCH}") + + name = "share_${share_editions.name}" + + matrix = { + share_editions = [ + { + artifact = "alfresco-content-services-community-distribution", + image_name = "alfresco-share-community", + name = "community" + }, + { + artifact = "alfresco-content-services-share-distribution", + image_name = "alfresco-share", + name = "enterprise" + } + ] + } } variable "ALFRESCO_SOLR_DIST_DIR" { diff --git a/repository/artifacts.json b/repository/artifacts.json index c19b6b7e..5f52eedd 100644 --- a/repository/artifacts.json +++ b/repository/artifacts.json @@ -6,7 +6,7 @@ "version": "42.6.0", "classifier": ".jar", "group": "org.postgresql", - "repository": "central", + "repository": "public", "path": "repository/libs" }, { diff --git a/search/service/Dockerfile b/search/service/Dockerfile index fe43e3fc..53519de1 100644 --- a/search/service/Dockerfile +++ b/search/service/Dockerfile @@ -1,7 +1,7 @@ ARG DISTRIB_NAME ARG DISTRIB_MAJOR -FROM java_base as solr_build +FROM java_base AS solr_build ARG ALFRESCO_SOLR_DIST_DIR diff --git a/share/Dockerfile b/share/Dockerfile index 02d452ea..7322fb9f 100644 --- a/share/Dockerfile +++ b/share/Dockerfile @@ -8,24 +8,30 @@ EXPOSE 8000 RUN mkdir -p ${CATALINA_HOME}/shared/classes/alfresco/web-extension \ ${CATALINA_HOME}/conf/Catalina/localhost +RUN yum install -y unzip + COPY entrypoint.sh ${CATALINA_HOME}/shared/classes/alfresco -ADD amps /tmp/amps -ADD distribution /tmp/ +ARG ALFRESCO_SHARE_ARTIFACT + +COPY distribution/${ALFRESCO_SHARE_ARTIFACT}-*.zip /tmp/ +COPY distribution/share-config-custom.xml /tmp/ +COPY amps /tmp/amps + ENV DISTDIR="/tmp/distribution" -RUN yum install -y unzip RUN unzip /tmp/*.zip -d ${DISTDIR} -RUN unzip ${DISTDIR}/alfresco*/web-server/webapps/share.war -d ${CATALINA_HOME}/webapps/share/ -RUN cp -r ${DISTDIR}/alfresco*/amps/ /tmp/amps/ +RUN if ls ${DISTDIR}/alfresco* > /dev/null 2>&1; then mv ${DISTDIR}/alfresco*/* ${DISTDIR}/; fi +RUN unzip ${DISTDIR}/web-server/webapps/share.war -d ${CATALINA_HOME}/webapps/share +RUN cp -r ${DISTDIR}/amps/ /tmp/amps/ RUN cp /tmp/share-config-custom.xml ${CATALINA_HOME}/shared/classes/alfresco/web-extension -RUN cp ${DISTDIR}/alfresco*/web-server/conf/Catalina/localhost/share.xml ${CATALINA_HOME}/conf/Catalina/localhost +RUN cp ${DISTDIR}/web-server/conf/Catalina/localhost/share.xml ${CATALINA_HOME}/conf/Catalina/localhost RUN sed -i 's|../modules/share|modules/share|' ${CATALINA_HOME}/conf/Catalina/localhost/share.xml RUN sed -i "s/shared.loader=/shared.loader=\${catalina.base}\/shared\/classes/" ${CATALINA_HOME}/conf/catalina.properties RUN chmod +x ${CATALINA_HOME}/shared/classes/alfresco/entrypoint.sh -RUN java -jar ${DISTDIR}/alfresco*/bin/alfresco-mmt.jar install \ - /tmp/amps/ ${CATALINA_HOME}/webapps/share -directory -nobackup -force +RUN java -jar ${DISTDIR}/bin/alfresco-mmt.jar install \ + /tmp/amps/ ${CATALINA_HOME}/webapps/share -directory -nobackup -force FROM tomcat_base AS share-rhlike ARG ALFRESCO_SHARE_USER_ID diff --git a/share/artifacts.json b/share/artifacts.json index b0906f9b..a367aac8 100644 --- a/share/artifacts.json +++ b/share/artifacts.json @@ -9,6 +9,14 @@ "group": "org.alfresco", "repository": "enterprise-releases" }, + { + "name": "alfresco-content-services-community-distribution", + "version": "23.2.0", + "path": "share/distribution", + "classifier": ".zip", + "group": "org.alfresco", + "repository": "public" + }, { "name": "alfresco-googledrive-share", "version": "4.1.0", diff --git a/sync/artifacts.json b/sync/artifacts.json index 49d704dc..957f39d9 100644 --- a/sync/artifacts.json +++ b/sync/artifacts.json @@ -14,7 +14,7 @@ "version": "42.6.0", "classifier": ".jar", "group": "org.postgresql", - "repository": "central", + "repository": "public", "path": "sync/configs/connectors" } ] diff --git a/test/community-docker-compose.yml b/test/community-docker-compose.yml index 72682822..e5d30cb2 100644 --- a/test/community-docker-compose.yml +++ b/test/community-docker-compose.yml @@ -52,7 +52,7 @@ services: ports: - "8090:8090" share: - image: ${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-share:${TAG} + image: ${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-share-community:${TAG} mem_limit: 1g environment: CSRF_FILTER_ORIGIN: http://localhost:8080 diff --git a/test/helm/test-overrides-community.yaml b/test/helm/test-overrides-community.yaml index 7bce092f..87d54f2d 100644 --- a/test/helm/test-overrides-community.yaml +++ b/test/helm/test-overrides-community.yaml @@ -15,3 +15,22 @@ dtas: - id: alfresco-aos-module version: 3.0.0 installed: true +alfresco-repository: + startupProbe: + initialDelaySeconds: 120 +alfresco-transform-service: + pdfrenderer: + livenessProbe: + initialDelaySeconds: 120 + imagemagick: + livenessProbe: + initialDelaySeconds: 120 + libreoffice: + livenessProbe: + initialDelaySeconds: 120 + tika: + livenessProbe: + initialDelaySeconds: 120 + transformmisc: + livenessProbe: + initialDelaySeconds: 120