diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 97b6ecf8..1e6f5a72 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -1,4 +1,4 @@ -name: Build, Run and Test Docker Image +name: CI on: push: @@ -19,7 +19,7 @@ on: - 'README.md' env: - ACS_CHART_VERSION: 172410cfb4ad44d4839d9aefd31b4bcefc44f316 + ACS_CHART_VERSION: 8a819c9b90b9015e5ab2654c47961fef4183cbcf # v8.5.1 plus the fix for community test values ARTIFACT_NAME: alfresco-docker-images REGISTRY: ghcr.io REGISTRY_NAMESPACE: alfresco @@ -48,9 +48,9 @@ jobs: with: auto-commit: "true" - build-test: - runs-on: ubuntu-latest + build: needs: pre-commit + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 @@ -126,8 +126,7 @@ jobs: *.output=type=registry,push=true compose-test: - name: compose-test - needs: build-test + needs: build runs-on: ubuntu-latest strategy: fail-fast: false @@ -160,13 +159,13 @@ jobs: output-archive-name: ${{ matrix.edition }}-logs helm-test: + needs: build + runs-on: ${{ matrix.arch == 'arm64' && 'alfrescoARM-ubuntu2404-16G-4CPU' || 'alfrescoPub-ubuntu2204-16G-4CPU' }} strategy: fail-fast: false matrix: arch: [arm64, amd64] - name: helm test - needs: build-test - runs-on: ${{ matrix.arch == 'arm64' && 'alfrescoARM-ubuntu2404-16G-4CPU' || 'alfrescoPub-ubuntu2204-16G-4CPU' }} + edition: [enterprise, community] steps: - name: Setup cluster uses: Alfresco/alfresco-build-tools/.github/actions/setup-kind@v7.1.1 @@ -206,10 +205,10 @@ jobs: with: repository: Alfresco/acs-deployment ref: ${{ env.ACS_CHART_VERSION }} - path: github-source + path: acs-deployment - name: Setup helm repository - working-directory: github-source/helm/alfresco-content-services + 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 @@ -221,19 +220,26 @@ jobs: env: OVERRIDES_VALUES_FILE: test/helm/test-overrides.yaml run: | - sed -i "s|localhost/|${REGISTRY}/${REGISTRY_NAMESPACE}/|g" ${{ env.OVERRIDES_VALUES_FILE }} + sed -i "s|localhost/alfresco/|${REGISTRY}/${REGISTRY_NAMESPACE}/|g" ${{ env.OVERRIDES_VALUES_FILE }} sed -i "s|tag: latest|tag: ${TAG}|g" ${{ env.OVERRIDES_VALUES_FILE }} + + if [ "${{ matrix.edition }}" = "community" ]; then + sed -i "s|/alfresco-content-repository|/alfresco-content-repository-community|g" ${{ env.OVERRIDES_VALUES_FILE }} + fi + cat ${{ env.OVERRIDES_VALUES_FILE }} - name: Helm install id: helm_install run: | - helm install acs ./github-source/helm/alfresco-content-services \ + helm install acs ./acs-deployment/helm/alfresco-content-services \ --set global.search.sharedSecret="$(openssl rand -hex 24)" \ --set global.known_urls=http://localhost \ --set global.alfrescoRegistryPullSecrets=regcred \ - --values ./github-source/test/enterprise-integration-test-values.yaml \ - --values test/helm/test-overrides.yaml + --values ./acs-deployment/helm/alfresco-content-services/${{ matrix.edition == 'community' && 'community_' || '' }}values.yaml \ + --values ./acs-deployment/test/${{ matrix.edition }}-integration-test-values.yaml \ + --values test/helm/test-overrides.yaml \ + --values test/helm/test-overrides-${{ matrix.edition }}.yaml - name: Watch Helm deployment env: @@ -243,8 +249,11 @@ jobs: 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 + + if [ "${{ matrix.edition }}" = "enterprise" ]; then + echo "Waiting for Enterprise Search Reindexing job to complete... " + kubectl wait --timeout=5m --for=condition=complete job/acs-alfresco-search-enterprise-reindexing + fi - name: Debug cluster status after install if: always() && steps.helm_install.outcome != 'skipped' @@ -265,7 +274,7 @@ jobs: if: always() && steps.helm_install.outcome != 'skipped' uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 #v4.4.0 with: - name: k8s-logs-${{ matrix.arch }} + name: k8s-logs-${{ matrix.arch }}-${{ matrix.edition }} path: logs - name: Run helm test diff --git a/README.md b/README.md index d49afe4d..b9449785 100644 --- a/README.md +++ b/README.md @@ -159,3 +159,14 @@ export REGISTRY=myecr.domain.tld REGISTRY_NAMESPACE=myorg TARGETARCH=linux/amd64 docker login $REGISTRY docker buildx bake repo --set *.output=type=registry,push=true ``` + +### Testing locally + +You can easily load all the built image in a local kind cluster with: + +```sh +kind load docker-image $(docker images --format "{{.Repository}}" | grep "^localhost/alfresco" | xargs) +``` + +Then you can run an helm install passing as values the provided +[test-overrides.yaml](./test/helm/test-overrides.yaml). diff --git a/docker-bake.hcl b/docker-bake.hcl index feb509c8..a2f36176 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -2,6 +2,10 @@ group "default" { targets = ["content_service", "enterprise-search", "ats", "tengines", "connectors", "search_service"] } +group "community" { + targets = ["repository_community", "share", "search_service", "tengine_aio"] +} + group "content_service" { targets = ["repository", "share"] } @@ -197,14 +201,33 @@ target "repository" { ALFRESCO_REPO_GROUP_NAME = "${ALFRESCO_GROUP_NAME}" ALFRESCO_REPO_USER_ID = "${ALFRESCO_REPO_USER_ID}" ALFRESCO_REPO_USER_NAME = "${ALFRESCO_REPO_USER_NAME}" + ALFRESCO_REPO_ARTIFACT = "${repository_editions.artifact}" + ALFRESCO_REPO_EDITION = "${repository_editions.name}" } labels = { - "org.opencontainers.image.title" = "${PRODUCT_LINE} Content Repository" - "org.opencontainers.image.description" = "Alfresco Content Services Repository" + "org.opencontainers.image.title" = "${PRODUCT_LINE} Content Repository (${repository_editions.name})" + "org.opencontainers.image.description" = "Alfresco Content Services Repository ${repository_editions.name} edition" } - tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-content-repository:${TAG}"] + tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/${repository_editions.image_name}:${TAG}"] output = ["type=docker"] platforms = split(",", "${TARGETARCH}") + + name = "repository_${repository_editions.name}" + + matrix = { + repository_editions = [ + { + artifact = "alfresco-content-services-community-distribution", + image_name = "alfresco-content-repository-community", + name = "community" + }, + { + artifact = "alfresco-content-services-distribution", + image_name = "alfresco-content-repository", + name = "enterprise" + } + ] + } } variable "ALFRESCO_LIVEINDEX_USER_ID" { diff --git a/repository/Dockerfile b/repository/Dockerfile index ab1a63ed..a881b76a 100644 --- a/repository/Dockerfile +++ b/repository/Dockerfile @@ -5,10 +5,13 @@ ARG ALFRESCO_REPO_GROUP_ID FROM tomcat_base AS repo_build +ARG ALFRESCO_REPO_ARTIFACT +ARG ALFRESCO_REPO_EDITION + USER root RUN yum install -y unzip -ADD distribution /tmp/ +COPY distribution/${ALFRESCO_REPO_ARTIFACT}-*.zip /tmp/ ENV DISTDIR="/tmp/distribution" RUN unzip /tmp/*.zip -d ${DISTDIR} @@ -28,8 +31,9 @@ RUN sed -i \ -re "s|(appender.rolling.filePattern=)(alfresco.log.%d\{yyyy-MM-dd\})|\1${CATALINA_HOME}/logs\/\2|" \ ${CATALINA_HOME}/webapps/alfresco/WEB-INF/classes/log4j2.properties -ADD amps /tmp/amps -ADD libs ${CATALINA_HOME}/lib/ +COPY amps /tmp/amps +COPY amps_${ALFRESCO_REPO_EDITION} /tmp/amps +COPY libs ${CATALINA_HOME}/lib/ RUN if [ -f /tmp/amps/alfresco-aos-module-*.amp ]; then umask 0027; \ unzip ${DISTDIR}/web-server/webapps/ROOT.war -d ${CATALINA_HOME}/webapps/ROOT/; \ cp ${CATALINA_HOME}/webapps/ROOT/META-INF/context.xml ${CATALINA_HOME}/conf/Catalina/localhost/ROOT.xml; \ @@ -55,9 +59,11 @@ RUN groupadd -g ${ALFRESCO_REPO_GROUP_ID} ${ALFRESCO_REPO_GROUP_NAME} && \ yum install -y fontconfig && \ yum clean all && rm -rf /var/cache/yum +COPY entrypoint.sh /entrypoint.sh + FROM repo-rhlike AS repo-rockylinux9 FROM repo-${DISTRIB_NAME}${DISTRIB_MAJOR} USER ${ALFRESCO_REPO_USER_NAME} -CMD ["catalina.sh", "run"] +CMD ["/entrypoint.sh"] diff --git a/repository/amps/README.md b/repository/amps/README.md index 507b3292..da885a00 100644 --- a/repository/amps/README.md +++ b/repository/amps/README.md @@ -23,7 +23,6 @@ By default the `scripts/fetch-artifacts.sh` script will fetch the following AMPs * alfresco-aos-module * alfresco-device-sync-repo * alfresco-googledrive-repo-enterprise -* alfresco-content-services-distribution You can replace those, remove them to keep only the ones you need or add more. Be careful though as some AMPs may depend on one another (e.g. diff --git a/repository/amps_community/.gitkeep b/repository/amps_community/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/repository/amps_enterprise/.gitkeep b/repository/amps_enterprise/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/repository/artifacts.json b/repository/artifacts.json index 400d662f..c19b6b7e 100644 --- a/repository/artifacts.json +++ b/repository/artifacts.json @@ -28,7 +28,7 @@ { "name": "alfresco-device-sync-repo", "version": "5.0.0", - "path": "repository/amps", + "path": "repository/amps_enterprise", "classifier": ".amp", "group": "org.alfresco.services.sync", "repository": "enterprise-releases" @@ -36,7 +36,7 @@ { "name": "alfresco-googledrive-repo-enterprise", "version": "4.1.0", - "path": "repository/amps", + "path": "repository/amps_enterprise", "classifier": ".amp", "group": "org.alfresco.integrations", "repository": "enterprise-releases" @@ -48,6 +48,14 @@ "classifier": ".zip", "group": "org.alfresco", "repository": "enterprise-releases" + }, + { + "name": "alfresco-content-services-community-distribution", + "version": "23.2.0", + "path": "repository/distribution", + "classifier": ".zip", + "group": "org.alfresco", + "repository": "public" } ] } diff --git a/repository/entrypoint.sh b/repository/entrypoint.sh new file mode 100755 index 00000000..e9a674a3 --- /dev/null +++ b/repository/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +exec catalina.sh run "$@" diff --git a/share/Dockerfile b/share/Dockerfile index eef83ca0..5c3b194b 100644 --- a/share/Dockerfile +++ b/share/Dockerfile @@ -1,6 +1,6 @@ ARG DISTRIB_NAME ARG DISTRIB_MAJOR -FROM tomcat_base as share_build +FROM tomcat_base AS share_build USER root EXPOSE 8000 diff --git a/test/community-docker-compose.yml b/test/community-docker-compose.yml index f9d35ca5..bbb6d4e6 100644 --- a/test/community-docker-compose.yml +++ b/test/community-docker-compose.yml @@ -1,7 +1,7 @@ # Do not move this file to a folder that is not a first level folder services: alfresco: - image: alfresco/alfresco-content-repository-community:23.2.0 + image: ${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-content-repository-community:${TAG} mem_limit: 1900m environment: JAVA_TOOL_OPTIONS: >- diff --git a/test/helm/test-overrides-community.yaml b/test/helm/test-overrides-community.yaml new file mode 100644 index 00000000..3725c4e1 --- /dev/null +++ b/test/helm/test-overrides-community.yaml @@ -0,0 +1,11 @@ +--- +dtas: + config: + assertions: + acs: + edition: Community + version: 23.2.0 + modules: + - id: alfresco-aos-module + version: 3.0.0 + installed: true diff --git a/test/helm/test-overrides-enterprise.yaml b/test/helm/test-overrides-enterprise.yaml new file mode 100644 index 00000000..5faae049 --- /dev/null +++ b/test/helm/test-overrides-enterprise.yaml @@ -0,0 +1,13 @@ +dtas: + config: + assertions: + acs: + edition: Enterprise + version: 23.2.2 + modules: + - id: alfresco-aos-module + version: 3.0.0 + installed: true + - id: org.alfresco.integrations.google.docs + version: 4.1.0 + installed: true diff --git a/test/helm/test-overrides.yaml b/test/helm/test-overrides.yaml index 2df6a689..0402cd3f 100644 --- a/test/helm/test-overrides.yaml +++ b/test/helm/test-overrides.yaml @@ -1,62 +1,63 @@ --- alfresco-repository: image: - repository: localhost/alfresco-content-repository + repository: localhost/alfresco/alfresco-content-repository tag: latest share: image: - repository: localhost/alfresco-share + repository: localhost/alfresco/alfresco-share tag: latest alfresco-search-enterprise: reindexing: image: - repository: localhost/alfresco-elasticsearch-reindexing + repository: localhost/alfresco/alfresco-elasticsearch-reindexing tag: latest + hookExecution: false liveIndexing: content: image: - repository: localhost/alfresco-elasticsearch-live-indexing-content + repository: localhost/alfresco/alfresco-elasticsearch-live-indexing-content tag: latest metadata: image: - repository: localhost/alfresco-elasticsearch-live-indexing-metadata + repository: localhost/alfresco/alfresco-elasticsearch-live-indexing-metadata tag: latest path: image: - repository: localhost/alfresco-elasticsearch-live-indexing-path + repository: localhost/alfresco/alfresco-elasticsearch-live-indexing-path tag: latest mediation: image: - repository: localhost/alfresco-elasticsearch-live-indexing-mediation + repository: localhost/alfresco/alfresco-elasticsearch-live-indexing-mediation tag: latest alfresco-transform-service: pdfrenderer: image: - repository: localhost/alfresco-pdf-renderer + repository: localhost/alfresco/alfresco-pdf-renderer tag: latest imagemagick: image: - repository: localhost/alfresco-imagemagick + repository: localhost/alfresco/alfresco-imagemagick tag: latest libreoffice: image: - repository: localhost/alfresco-libreoffice + repository: localhost/alfresco/alfresco-libreoffice tag: latest transformmisc: image: - repository: localhost/alfresco-misc + repository: localhost/alfresco/alfresco-misc tag: latest tika: image: - repository: localhost/alfresco-tika + repository: localhost/alfresco/alfresco-tika tag: latest transformrouter: image: - repository: localhost/alfresco-transform-router + repository: localhost/alfresco/alfresco-transform-router tag: latest filestore: image: - repository: localhost/alfresco-shared-file-store + repository: localhost/alfresco/alfresco-shared-file-store tag: latest alfresco-sync-service: enabled: false ## disable till release of 5.0.1 @@ -67,4 +68,4 @@ dtas: - not test_api_explorer_reachability config: config: - search_timeout_seconds: 360 + search_timeout_seconds: "360"