diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index f051998b..d037cbcc 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -17,6 +17,9 @@ on: env: ACS_CHART_VERSION: 172410cfb4ad44d4839d9aefd31b4bcefc44f316 ARTIFACT_NAME: alfresco-docker-images + REGISTRY: ghcr.io + REGISTRY_NAMESPACE: alfresco + TAG: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || github.sha }} concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name || github.run_id }} @@ -24,7 +27,12 @@ concurrency: permissions: contents: read + # telemetry actions: read + # ghcr push + packages: write + attestations: write + id-token: write jobs: pre-commit: @@ -51,9 +59,35 @@ jobs: echo "login ${{ secrets.NEXUS_USERNAME }}" >> ~/.netrc echo "password ${{ secrets.NEXUS_PASSWORD }}" >> ~/.netrc + - name: Restore packages artifacts + uses: actions/cache/restore@v4 + id: artifacts-cache + with: + key: ${{ runner.os }}-packages-${{ hashFiles('**/artifacts.json') }} + path: | + **/*.jar + **/*.zip + **/*.amp + **/*.tgz + **/*.gz + **/*.rpm + - name: Fetch artifacts from nexus run: ./scripts/fetch-artifacts.sh + - name: Save packages artifacts + id: cache-primes-save + uses: actions/cache/save@v4 + with: + key: ${{ steps.artifacts-cache.outputs.cache-primary-key }} + path: | + **/*.jar + **/*.zip + **/*.amp + **/*.tgz + **/*.gz + **/*.rpm + - name: Set up QEMU uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 @@ -67,6 +101,13 @@ jobs: username: ${{ secrets.QUAY_USERNAME }} password: ${{ secrets.QUAY_PASSWORD }} + - name: Log in to the Container registry + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Collect Workflow Telemetry uses: catchpoint/workflow-telemetry-action@v2 with: @@ -74,50 +115,31 @@ jobs: - name: Bake Docker images uses: docker/bake-action@a4d7f0b5b91c14a296d792d4ec53a9db17f02e67 # v5.5.0 + with: + push: true - name: Show all built images run: docker images - - name: Docker save all baked images whose name include `alfresco` - 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 - 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-test runs-on: ubuntu-latest steps: + - name: Log in to the Container registry + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - 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 }} @@ -130,22 +152,12 @@ jobs: 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/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 @@ -160,6 +172,13 @@ jobs: username: ${{ secrets.QUAY_USERNAME }} password: ${{ secrets.QUAY_PASSWORD }} + - name: Log in to the Container registry + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Create registries auth secret run: >- kubectl create secret generic regcred @@ -182,6 +201,14 @@ jobs: helm repo add elastic https://helm.elastic.co helm dependency build + - name: Preprocess test-overrides.yaml + 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|tag: latest|tag: ${TAG}|g" ${{ env.OVERRIDES_VALUES_FILE }} + cat ${{ env.OVERRIDES_VALUES_FILE }} + - name: Helm install id: helm_install run: | diff --git a/docker-bake.hcl b/docker-bake.hcl index 96a1e7de..b5995966 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -22,6 +22,18 @@ group "connectors" { targets = ["connector_msteams", "connector_ms365"] } +variable "REGISTRY" { + default = "localhost" +} + +variable "REGISTRY_NAMESPACE" { + default = "alfresco" +} + +variable "TAG" { + default = "latest" +} + variable "LABEL_VENDOR" { default = "Hyland Software, Inc." } @@ -121,7 +133,7 @@ target "java_base" { "org.opencontainers.image.source" = "$LABEL_SOURCE" "org.opencontainers.image.authors" = "${LABEL_AUTHOR}" } - tags = ["localhost/alfresco-base-java:${JDIST}${JAVA_MAJOR}-${DISTRIB_NAME}${DISTRIB_MAJOR}"] + tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-base-java:${JDIST}${JAVA_MAJOR}-${DISTRIB_NAME}${DISTRIB_MAJOR}"] output = ["type=cacheonly"] } @@ -164,7 +176,7 @@ target "tomcat_base" { "org.opencontainers.image.title" = "${PRODUCT_LINE} Tomcat" "org.opencontainers.image.description" = "A base image shipping Tomcat for Alfresco Products" } - tags = ["localhost/alfresco-base-tomcat:tomcat${TOMCAT_MAJOR}-${JDIST}${JAVA_MAJOR}-${DISTRIB_NAME}${DISTRIB_MAJOR}"] + tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-base-tomcat:tomcat${TOMCAT_MAJOR}-${JDIST}${JAVA_MAJOR}-${DISTRIB_NAME}${DISTRIB_MAJOR}"] output = ["type=cacheonly"] } @@ -185,7 +197,7 @@ target "repository" { "org.opencontainers.image.title" = "${PRODUCT_LINE} Content Repository" "org.opencontainers.image.description" = "Alfresco Content Services Repository" } - tags = ["localhost/alfresco-content-repository:latest"] + tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-content-repository:${TAG}"] output = ["type=docker"] } @@ -224,7 +236,7 @@ target "search_liveindexing" { "org.opencontainers.image.title" = "${PRODUCT_LINE} Enterprise Search - ${liveindexing.name}" "org.opencontainers.image.description" = "${PRODUCT_LINE} Enterprise Search - ${liveindexing.name} live indexing" } - tags = ["localhost/${liveindexing.artifact}:latest"] + tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/${liveindexing.artifact}:${TAG}"] output = ["type=docker"] } @@ -253,7 +265,7 @@ target "ats_trouter" { "org.opencontainers.image.title" = "${PRODUCT_LINE} ATS Trouter" "org.opencontainers.image.description" = "Alfresco Transform Service Trouter" } - tags = ["localhost/alfresco-transform-router:latest"] + tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-transform-router:${TAG}"] output = ["type=docker"] } @@ -282,7 +294,7 @@ target "ats_sfs" { "org.opencontainers.image.title" = "${PRODUCT_LINE} ATS Shared File Store" "org.opencontainers.image.description" = "Alfresco Transform Service ATS Shared File Store" } - tags = ["localhost/alfresco-shared-file-store:latest"] + tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-shared-file-store:${TAG}"] output = ["type=docker"] } @@ -311,7 +323,7 @@ target "tengine_imagemagick" { "org.opencontainers.image.title" = "${PRODUCT_LINE} Transform Engine Imagemagick" "org.opencontainers.image.description" = "Alfresco Transform Engine Imagemagick" } - tags = ["localhost/alfresco-imagemagick:latest"] + tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-imagemagick:${TAG}"] output = ["type=docker"] } @@ -340,7 +352,7 @@ target "tengine_libreoffice" { "org.opencontainers.image.title" = "${PRODUCT_LINE} Transform Engine LibreOffice" "org.opencontainers.image.description" = "Alfresco Transform Engine LibreOffice" } - tags = ["localhost/alfresco-libreoffice:latest"] + tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-libreoffice:${TAG}"] output = ["type=docker"] } @@ -369,7 +381,7 @@ target "tengine_misc" { "org.opencontainers.image.title" = "${PRODUCT_LINE} Transform Engine Misc" "org.opencontainers.image.description" = "Alfresco Transform Engine Misc" } - tags = ["localhost/alfresco-misc:latest"] + tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-misc:${TAG}"] output = ["type=docker"] } @@ -398,7 +410,7 @@ target "tengine_tika" { "org.opencontainers.image.title" = "${PRODUCT_LINE} Transform Engine Tika" "org.opencontainers.image.description" = "Alfresco Transform Engine Tika" } - tags = ["localhost/alfresco-tika:latest"] + tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-tika:${TAG}"] output = ["type=docker"] } @@ -427,7 +439,7 @@ target "tengine_pdfrenderer" { "org.opencontainers.image.title" = "${PRODUCT_LINE} Transform Engine PDF Renderer" "org.opencontainers.image.description" = "Alfresco Transform Engine PDF Renderer" } - tags = ["localhost/alfresco-pdf-renderer:latest"] + tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-pdf-renderer:${TAG}"] output = ["type=docker"] } @@ -456,7 +468,7 @@ target "tengine_aio" { "org.opencontainers.image.title" = "${PRODUCT_LINE} Transform Engine All In One" "org.opencontainers.image.description" = "Alfresco Transform Engine All In One" } - tags = ["localhost/alfresco-transform-core-aio:latest"] + tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-transform-core-aio:${TAG}"] output = ["type=docker"] } @@ -485,7 +497,7 @@ target "connector_msteams" { "org.opencontainers.image.title" = "${PRODUCT_LINE} Connector Microsoft Teams" "org.opencontainers.image.description" = "Alfresco Connector Microsoft Teams" } - tags = ["localhost/alfresco-ms-teams-service:latest"] + tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-ms-teams-service:${TAG}"] output = ["type=docker"] } @@ -514,6 +526,6 @@ target "connector_ms365" { "org.opencontainers.image.title" = "${PRODUCT_LINE} Microsoft 365 Connector" "org.opencontainers.image.description" = "Alfresco Microsoft 365 Connector" } - tags = ["localhost/alfresco-ooi-service:latest"] + tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-ooi-service:${TAG}"] output = ["type=docker"] } diff --git a/test/docker-compose.yml b/test/docker-compose.yml index 21c1b5dd..ab3dfc89 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -2,7 +2,7 @@ version: "2" services: alfresco: - image: localhost/alfresco-content-repository:latest + image: ${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-content-repository:${TAG} mem_limit: 1900m environment: JAVA_TOOL_OPTIONS: >- @@ -50,7 +50,7 @@ services: start_period: 1m transform-router: mem_limit: 512m - image: localhost/alfresco-transform-router:latest + image: ${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-transform-router:${TAG} environment: ACTIVEMQ_URL: nio://activemq:61616 CORE_AIO_URL: http://transform-core-aio:8090 @@ -61,7 +61,7 @@ services: depends_on: - activemq transform-core-aio: - image: localhost/alfresco-transform-core-aio:latest + image: ${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-transform-core-aio:${TAG} mem_limit: 1536m environment: JAVA_OPTS: >- @@ -75,7 +75,7 @@ services: depends_on: - activemq shared-file-store: - image: localhost/alfresco-shared-file-store:latest + image: ${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-shared-file-store:${TAG} mem_limit: 512m environment: scheduler.content.age.millis: 86400000 @@ -177,7 +177,7 @@ services: ports: - "9090:9090" live-indexing: - image: localhost/alfresco-elasticsearch-live-indexing:latest + image: ${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-elasticsearch-live-indexing:${TAG} environment: SPRING_ELASTICSEARCH_REST_URIS: http://elasticsearch:9200 SPRING_ACTIVEMQ_BROKERURL: nio://activemq:61616