Compare commits

...

21 Commits

Author SHA1 Message Date
Damian.Ujma@hyland.com
c46f7a1e08 Test multiarch image 2023-03-08 12:57:39 +01:00
Damian.Ujma@hyland.com
807a507fc0 Test multiarch image 2023-03-08 12:25:36 +01:00
Damian.Ujma@hyland.com
3ecb4bb8fa Merge branch 'feature/ACS-4140_Produce_Multi-Arch_Docker_images' into feature/ACS-4063_test_upstream_linked_repos
# Conflicts:
#	docker-alfresco/pom.xml
#	docker-share/ags/pom.xml
2023-03-08 12:18:08 +01:00
Damian.Ujma@hyland.com
d340f5e924 ACS-4140 Inherit required properties 2023-03-07 16:47:48 +01:00
Damian.Ujma@hyland.com
4a2b73ad62 ACS-4140 Add missing properties 2023-03-07 12:51:47 +01:00
Damian.Ujma@hyland.com
5c91f2e2f8 ACS-4140 Remove comments 2023-03-02 15:45:31 +01:00
Damian.Ujma@hyland.com
caaa8f79da ACS-4140 Use build for 'push-docker-images' and 'release' profiles 2023-03-02 15:40:42 +01:00
Damian.Ujma@hyland.com
aa46c09c01 Merge branch 'master' into feature/ACS-4140_Produce_Multi-Arch_Docker_images 2023-03-02 15:31:02 +01:00
Damian.Ujma@hyland.com
a00083058b Test multiarch image 2023-03-02 15:19:00 +01:00
Damian.Ujma@hyland.com
8c49e624f6 Test multiarch image 2023-03-02 14:42:22 +01:00
Damian.Ujma@hyland.com
1e8ab430cb Merge branch 'master' into feature/ACS-4063_test_upstream_linked_repos 2023-03-02 14:28:37 +01:00
Damian.Ujma@hyland.com
b6a9e62a07 ACS-4140 Add 'build-multiarch-docker-images' profile to 'share-community-docker' 2023-03-02 14:27:53 +01:00
Damian.Ujma@hyland.com
be1d598239 ACS-4140 Push docker images to local repository 2023-03-02 12:33:09 +01:00
Wojtek.Swieton
3ae2962ac2 ACS-4140 Added missing <BASE_IMAGE> argument 2023-02-24 11:46:34 +01:00
Damian.Ujma@hyland.com
7e903a237a ACS-4140 Refactor build.sh 2023-02-24 11:16:09 +01:00
Damian.Ujma@hyland.com
4afadf52da ACS-4139 Remove echo 2023-02-23 15:50:04 +01:00
Damian.Ujma@hyland.com
7ad7ce4c8f ACS-4139 Fix intermittent failures 2023-02-23 15:49:30 +01:00
Wojtek.Swieton
47c0c9573c ACS-4140 Fix in prepare_buildx.sh to not duplicate image.tag 2023-02-22 16:47:11 +01:00
Damian.Ujma@hyland.com
bc359d55a8 ACS-4140 Add docker image build mode option in build.sh 2023-02-22 15:15:39 +01:00
Wojtek.Swieton
38911ca270 ACS-4140 Changes in pom and Dockerfile for alfresco-governance-share-community and alfresco-governance-repository-community 2023-02-22 10:19:21 +01:00
Wojtek.Swieton
9c4fe830df ACS-4140 Changes in pom and Dockerfile for alfresco-content-repository-community image 2023-02-21 14:37:42 +01:00
10 changed files with 583 additions and 175 deletions

View File

@@ -33,172 +33,218 @@ env:
DEVELOPMENT_VERSION: 7.4.0-A18-SNAPSHOT
jobs:
tas_tests:
name: ${{ matrix.testSuite }} TAS tests
test_docker:
name: "Update latest docker images"
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, '[skip tas]') && !contains(github.event.head_commit.message, '[skip tests]') }}
strategy:
fail-fast: false
matrix:
include:
- testSuite: REST API part1
pom: tests/tas-restapi/pom.xml
profiles: all-tas-tests,run-restapi-part1
compose-file: docker-compose-minimal+transforms.yml
- testSuite: REST API part2
pom: tests/tas-restapi/pom.xml
profiles: all-tas-tests,run-restapi-part2
compose-file: docker-compose-minimal+transforms.yml
- testSuite: REST API part3
pom: tests/tas-restapi/pom.xml
profiles: all-tas-tests,run-restapi-part3
compose-file: docker-compose-minimal+transforms.yml
- testSuite: CMIS (BROWSER binding)
pom: tests/tas-cmis/pom.xml
profiles: all-tas-tests,run-cmis-browser
compose-file: docker-compose-minimal+transforms.yml
- testSuite: CMIS (ATOM binding)
pom: tests/tas-cmis/pom.xml
profiles: all-tas-tests,run-cmis-atom
compose-file: docker-compose-minimal+transforms.yml
- testSuite: CMIS (WEBSERVICES binding)
pom: tests/tas-cmis/pom.xml
profiles: all-tas-tests,run-cmis-webservices
compose-file: docker-compose-minimal+transforms.yml
- testSuite: Email
pom: tests/tas-email/pom.xml
profiles: all-tas-tests
compose-file: docker-compose-minimal.yml
- testSuite: WebDAV
pom: tests/tas-webdav/pom.xml
profiles: all-tas-tests
compose-file: docker-compose-minimal.yml
- testSuite: Integration
pom: tests/tas-integration/pom.xml
profiles: all-tas-tests
compose-file: docker-compose-minimal.yml
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Init"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: |
bash ./scripts/ci/init.sh
bash ./scripts/ci/build.sh
- name: "Setup the environment"
run: |
${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/${{ matrix.compose-file }}
${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
- name: "Test"
run: mvn -B install -ntp -f ${{ matrix.pom }} -P${{ matrix.profiles }} -Denvironment=default -DrunBugs=false
- name: "Clean Maven cache"
run: bash ./scripts/ci/cleanup_cache.sh
community_zip_tests:
name: Community Distribution Zip content tests
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip tests]')"
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Init"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: |
bash ./scripts/ci/init.sh
bash ./scripts/ci/build.sh
- name: "Build"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: mvn -B -ntp -V clean install -Pags -DskipTests -Dmaven.javadoc.skip=true
- name: "Test"
run: mvn -B install -ntp -f tests/tas-distribution-zip/pom.xml -Prun-distribution-zip-contents-check -DrunBugs=false
- name: "Clean Maven cache"
run: bash ./scripts/ci/cleanup_cache.sh
docker_latest:
name: Update latest Docker images
runs-on: ubuntu-latest
needs: [tas_tests, community_zip_tests]
if: >
!(failure() || cancelled()) &&
!contains(github.event.head_commit.message, '[skip docker_latest]') &&
(github.ref_name == 'master' || startsWith(github.ref_name, 'release/')) &&
github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Init"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: |
bash ./scripts/ci/init.sh
bash ./scripts/ci/build.sh
- name: "Push Docker images"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: mvn -B -ntp -V clean install -DskipTests -Dmaven.javadoc.skip=true -Pags -Ppush-docker-images
- name: "Clean Maven cache"
run: bash ./scripts/ci/cleanup_cache.sh
release:
name: Release and Copy to S3 Staging Bucket
runs-on: ubuntu-latest
needs: [docker_latest]
if: >
!(failure() || cancelled()) &&
contains(github.event.head_commit.message, '[release]') &&
(github.ref_name == 'master' || startsWith(github.ref_name, 'release/')) &&
github.event_name != 'pull_request'
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
- name: "Init"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
version: v0.9.1
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: linux/amd64,linux/arm64
- name: "Build"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: |
bash ./scripts/ci/init.sh
bash ./scripts/ci/build.sh
- name: "Release"
bash ./scripts/ci/build.sh -m true
- name: "Test pushing images"
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: |
bash scripts/ci/verify_release_tag.sh
bash scripts/ci/maven_release.sh
source scripts/ci/prepare_staging_deploy.sh
run: mvn -B -ntp -V clean install -DskipTests -Dmaven.javadoc.skip=true -Pags -Ppush-docker-images
- name: "Clean Maven cache"
run: bash ./scripts/ci/cleanup_cache.sh
- name: "Configure AWS credentials"
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_S3_STAGING_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_S3_STAGING_SECRET_KEY }}
aws-region: eu-west-1
- name: "Deploy to S3 Staging Bucket"
run: |
aws s3 cp --acl private --recursive ./deploy_dir s3://alfresco-artefacts-staging/alfresco-content-services-community/release/${BRANCH_NAME}/${BUILD_NUMBER}
aws s3 cp --acl private --recursive ./deploy_dir_ags s3://alfresco-artefacts-staging/community/RM/${RELEASE_VERSION}
echo "Finished release and deployed to https://s3.console.aws.amazon.com/s3/buckets/alfresco-artefacts-staging/alfresco-content-services-community/release/${BRANCH_NAME}/${BUILD_NUMBER}"
publish:
name: Copy to S3 Release Bucket
runs-on: ubuntu-latest
needs: [release]
if: >
!(failure() || cancelled()) &&
contains(github.event.head_commit.message, '[publish]') &&
(github.ref_name == 'master' || startsWith(github.ref_name, 'release/')) &&
github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v3
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
- name: "Configure AWS credentials"
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_S3_RELEASE_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_S3_RELEASE_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
- name: "Deploy to S3 Release Bucket"
run: |
bash scripts/ci/copy_to_release_bucket.sh
bash scripts/ci/copy_ags_to_release_bucket.sh
# tas_tests:
# name: ${{ matrix.testSuite }} TAS tests
# runs-on: ubuntu-latest
# if: ${{ !contains(github.event.head_commit.message, '[skip tas]') && !contains(github.event.head_commit.message, '[skip tests]') }}
# strategy:
# fail-fast: false
# matrix:
# include:
# - testSuite: REST API part1
# pom: tests/tas-restapi/pom.xml
# profiles: all-tas-tests,run-restapi-part1
# compose-file: docker-compose-minimal+transforms.yml
# - testSuite: REST API part2
# pom: tests/tas-restapi/pom.xml
# profiles: all-tas-tests,run-restapi-part2
# compose-file: docker-compose-minimal+transforms.yml
# - testSuite: REST API part3
# pom: tests/tas-restapi/pom.xml
# profiles: all-tas-tests,run-restapi-part3
# compose-file: docker-compose-minimal+transforms.yml
# - testSuite: CMIS (BROWSER binding)
# pom: tests/tas-cmis/pom.xml
# profiles: all-tas-tests,run-cmis-browser
# compose-file: docker-compose-minimal+transforms.yml
# - testSuite: CMIS (ATOM binding)
# pom: tests/tas-cmis/pom.xml
# profiles: all-tas-tests,run-cmis-atom
# compose-file: docker-compose-minimal+transforms.yml
# - testSuite: CMIS (WEBSERVICES binding)
# pom: tests/tas-cmis/pom.xml
# profiles: all-tas-tests,run-cmis-webservices
# compose-file: docker-compose-minimal+transforms.yml
# - testSuite: Email
# pom: tests/tas-email/pom.xml
# profiles: all-tas-tests
# compose-file: docker-compose-minimal.yml
# - testSuite: WebDAV
# pom: tests/tas-webdav/pom.xml
# profiles: all-tas-tests
# compose-file: docker-compose-minimal.yml
# - testSuite: Integration
# pom: tests/tas-integration/pom.xml
# profiles: all-tas-tests
# compose-file: docker-compose-minimal.yml
# steps:
# - uses: actions/checkout@v3
# - uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
# - uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
# - name: "Init"
# timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
# run: |
# bash ./scripts/ci/init.sh
# bash ./scripts/ci/build.sh
# - name: "Setup the environment"
# run: |
# ${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/${{ matrix.compose-file }}
# ${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
# - name: "Test"
# run: mvn -B install -ntp -f ${{ matrix.pom }} -P${{ matrix.profiles }} -Denvironment=default -DrunBugs=false
# - name: "Clean Maven cache"
# run: bash ./scripts/ci/cleanup_cache.sh
#
# community_zip_tests:
# name: Community Distribution Zip content tests
# runs-on: ubuntu-latest
# if: "!contains(github.event.head_commit.message, '[skip tests]')"
# steps:
# - uses: actions/checkout@v3
# - uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
# - uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
# - name: "Init"
# timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
# run: |
# bash ./scripts/ci/init.sh
# bash ./scripts/ci/build.sh
# - name: "Build"
# timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
# run: mvn -B -ntp -V clean install -Pags -DskipTests -Dmaven.javadoc.skip=true
# - name: "Test"
# run: mvn -B install -ntp -f tests/tas-distribution-zip/pom.xml -Prun-distribution-zip-contents-check -DrunBugs=false
# - name: "Clean Maven cache"
# run: bash ./scripts/ci/cleanup_cache.sh
#
# docker_latest:
# name: Update latest Docker images
# runs-on: ubuntu-latest
# needs: [tas_tests, community_zip_tests]
# if: >
# !(failure() || cancelled()) &&
# !contains(github.event.head_commit.message, '[skip docker_latest]') &&
# (github.ref_name == 'master' || startsWith(github.ref_name, 'release/')) &&
# github.event_name != 'pull_request'
# services:
# registry:
# image: registry:2
# ports:
# - 5000:5000
# steps:
# - uses: actions/checkout@v3
# - uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
# - uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2
# - name: "Init"
# timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
# run: |
# bash ./scripts/ci/init.sh
# bash ./scripts/ci/build.sh -m
# - name: "Push Docker images"
# timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
# run: mvn -B -ntp -V clean install -DskipTests -Dmaven.javadoc.skip=true -Pags -Ppush-docker-images
# - name: "Clean Maven cache"
# run: bash ./scripts/ci/cleanup_cache.sh
#
# release:
# name: Release and Copy to S3 Staging Bucket
# runs-on: ubuntu-latest
# needs: [docker_latest]
# if: >
# !(failure() || cancelled()) &&
# contains(github.event.head_commit.message, '[release]') &&
# (github.ref_name == 'master' || startsWith(github.ref_name, 'release/')) &&
# github.event_name != 'pull_request'
# services:
# registry:
# image: registry:2
# ports:
# - 5000:5000
# steps:
# - uses: actions/checkout@v3
# with:
# persist-credentials: false
# - uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
# - uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v1.33.0
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2
# - name: "Init"
# timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
# run: |
# bash ./scripts/ci/init.sh
# bash ./scripts/ci/build.sh -m
# - name: "Release"
# timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
# run: |
# bash scripts/ci/verify_release_tag.sh
# bash scripts/ci/maven_release.sh
# source scripts/ci/prepare_staging_deploy.sh
# - name: "Clean Maven cache"
# run: bash ./scripts/ci/cleanup_cache.sh
# - name: "Configure AWS credentials"
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_S3_STAGING_ACCESS_KEY }}
# aws-secret-access-key: ${{ secrets.AWS_S3_STAGING_SECRET_KEY }}
# aws-region: eu-west-1
# - name: "Deploy to S3 Staging Bucket"
# run: |
# aws s3 cp --acl private --recursive ./deploy_dir s3://alfresco-artefacts-staging/alfresco-content-services-community/release/${BRANCH_NAME}/${BUILD_NUMBER}
# aws s3 cp --acl private --recursive ./deploy_dir_ags s3://alfresco-artefacts-staging/community/RM/${RELEASE_VERSION}
# echo "Finished release and deployed to https://s3.console.aws.amazon.com/s3/buckets/alfresco-artefacts-staging/alfresco-content-services-community/release/${BRANCH_NAME}/${BUILD_NUMBER}"
#
# publish:
# name: Copy to S3 Release Bucket
# runs-on: ubuntu-latest
# needs: [release]
# if: >
# !(failure() || cancelled()) &&
# contains(github.event.head_commit.message, '[publish]') &&
# (github.ref_name == 'master' || startsWith(github.ref_name, 'release/')) &&
# github.event_name != 'pull_request'
# steps:
# - uses: actions/checkout@v3
# - uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v1.33.0
# - name: "Configure AWS credentials"
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_S3_RELEASE_ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ secrets.AWS_S3_RELEASE_SECRET_ACCESS_KEY }}
# aws-region: eu-west-1
# - name: "Deploy to S3 Release Bucket"
# run: |
# bash scripts/ci/copy_to_release_bucket.sh
# bash scripts/ci/copy_ags_to_release_bucket.sh

View File

@@ -1,4 +1,5 @@
FROM alfresco/alfresco-community-repo-base:${repo.image.tag}
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
# Set default docker_context.
ARG resource_path=target

View File

@@ -1,3 +1,4 @@
ARG BASE_IMAGE
# BUILD STAGE AGS
FROM debian:11-slim AS AGSBUILDER
@@ -12,7 +13,7 @@ RUN unzip -q /build/gs-api-explorer-*.war -d /build/gs-api-explorer && \
chmod -R g-w,o= /build
# ACTUAL IMAGE
FROM alfresco/alfresco-content-repository-community:${image.tag}
FROM ${BASE_IMAGE}
# Alfresco user does not have permissions to modify webapps or configuration. Switch to root.
# The access will be fixed after all operations are done.

View File

@@ -13,6 +13,9 @@
<properties>
<image.name>alfresco/alfresco-governance-repository-community</image.name>
<base.image>alfresco/alfresco-content-repository-community:${image.tag}</base.image>
<scripts.directory>${project.parent.parent.basedir}/scripts/dev</scripts.directory>
<test.tag>alfresco-governance-repository-community</test.tag>
</properties>
<build>

View File

@@ -13,6 +13,11 @@
<properties>
<image.name>alfresco/alfresco-content-repository-community</image.name>
<docker.quay-expires.value>NEVER</docker.quay-expires.value>
<local.registry>127.0.0.1:5000</local.registry>
<base.image>alfresco/alfresco-community-repo-base:latest</base.image>
<builder.name>entitled-builder</builder.name>
<scripts.directory>${project.parent.basedir}/scripts/dev</scripts.directory>
<test.tag>alfresco-content-repository-community</test.tag>
</properties>
<build>
@@ -76,6 +81,12 @@
<images>
<image>
<name>${image.name}:${image.tag}</name>
<build>
<args>
<BASE_IMAGE>${base.image}</BASE_IMAGE>
</args>
<contextDir>${project.basedir}</contextDir>
</build>
</image>
</images>
</configuration>
@@ -93,6 +104,71 @@
</build>
</profile>
<profile>
<id>build-multiarch-docker-images</id>
<!-- builds multi Architecture "images:latest" locally -->
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<image>
<name>${local.registry}/${image.name}:${image.tag}</name>
<build>
<buildx>
<builderName>${builder.name}</builderName>
<platforms>
<platform>linux/amd64</platform>
<platform>linux/arm64</platform>
</platforms>
</buildx>
<dockerFileDir>${project.basedir}</dockerFileDir>
<args>
<BASE_IMAGE>${local.registry}/${base.image}</BASE_IMAGE>
</args>
</build>
</image>
</images>
</configuration>
<executions>
<execution>
<id>build-push-image</id>
<phase>install</phase>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<id>prepare-buildx</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${scripts.directory}/prepare_buildx.sh</executable>
<arguments>
<argument>${builder.name}</argument>
<argument>${image.registry}</argument>
<argument>${image.name}</argument>
<argument>${image.tag}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>push-docker-images</id>
<!-- publishes "image:latest" to Quay -->
@@ -105,8 +181,20 @@
<images>
<!-- Quay image -->
<image>
<name>${image.name}:${image.tag}</name>
<registry>${image.registry}</registry>
<name>quay.io/alfresco/dev:${test.tag}</name>
<build>
<buildx>
<builderName>${builder.name}</builderName>
<platforms>
<platform>linux/amd64</platform>
<platform>linux/arm64</platform>
</platforms>
</buildx>
<dockerFileDir>${project.basedir}</dockerFileDir>
<args>
<BASE_IMAGE>${local.registry}/${base.image}</BASE_IMAGE>
</args>
</build>
</image>
</images>
</configuration>
@@ -121,6 +209,28 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<id>prepare-buildx</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${scripts.directory}/prepare_buildx.sh</executable>
<arguments>
<argument>${builder.name}</argument>
<argument>${image.registry}</argument>
<argument>${image.name}</argument>
<argument>${image.tag}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
@@ -142,6 +252,19 @@
<!-- DockerHub image -->
<image>
<name>${image.name}:${project.version}</name>
<build>
<buildx>
<builderName>${builder.name}</builderName>
<platforms>
<platform>linux/amd64</platform>
<platform>linux/arm64</platform>
</platforms>
</buildx>
<dockerFileDir>${project.basedir}</dockerFileDir>
<args>
<BASE_IMAGE>${local.registry}/${base.image}</BASE_IMAGE>
</args>
</build>
</image>
</images>
</configuration>
@@ -157,8 +280,20 @@
<images>
<!-- Quay image -->
<image>
<name>${image.name}:${project.version}</name>
<registry>${image.registry}</registry>
<name>${image.registry}/${image.name}:${project.version}</name>
<build>
<buildx>
<builderName>${builder.name}</builderName>
<platforms>
<platform>linux/amd64</platform>
<platform>linux/arm64</platform>
</platforms>
</buildx>
<dockerFileDir>${project.basedir}</dockerFileDir>
<args>
<BASE_IMAGE>${local.registry}/${base.image}</BASE_IMAGE>
</args>
</build>
</image>
</images>
</configuration>
@@ -169,6 +304,28 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<id>prepare-buildx</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${scripts.directory}/prepare_buildx.sh</executable>
<arguments>
<argument>${builder.name}</argument>
<argument>${image.registry}</argument>
<argument>${image.name}</argument>
<argument>${image.tag}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

View File

@@ -1,5 +1,6 @@
### Apply AGS community share AMP to Share image
FROM alfresco/alfresco-share-base:${share.image.tag}
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
LABEL quay.expires-after=${docker.quay-expires.value}

View File

@@ -14,6 +14,11 @@
<properties>
<image.name>alfresco/alfresco-governance-share-community</image.name>
<docker.quay-expires.value>NEVER</docker.quay-expires.value>
<base.image>alfresco/alfresco-share-base:latest</base.image>
<scripts.directory>${project.parent.parent.basedir}/scripts/dev</scripts.directory>
<local.registry>127.0.0.1:5000</local.registry>
<builder.name>entitled-builder</builder.name>
<test.tag>alfresco-governance-share-community</test.tag>
</properties>
<build>
@@ -58,6 +63,12 @@
<images>
<image>
<name>${image.name}:${image.tag}</name>
<build>
<args>
<BASE_IMAGE>${base.image}</BASE_IMAGE>
</args>
<contextDir>${project.basedir}</contextDir>
</build>
</image>
</images>
</configuration>
@@ -75,6 +86,70 @@
</build>
</profile>
<profile>
<id>build-multiarch-docker-images</id>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<image>
<name>${local.registry}/${image.name}:${image.tag}</name>
<build>
<buildx>
<builderName>${builder.name}</builderName>
<platforms>
<platform>linux/amd64</platform>
<platform>linux/arm64</platform>
</platforms>
</buildx>
<dockerFileDir>${project.basedir}</dockerFileDir>
<args>
<BASE_IMAGE>${local.registry}/${base.image}</BASE_IMAGE>
</args>
</build>
</image>
</images>
</configuration>
<executions>
<execution>
<id>build-push-image</id>
<phase>install</phase>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<id>prepare-buildx</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${scripts.directory}/prepare_buildx.sh</executable>
<arguments>
<argument>${builder.name}</argument>
<argument>${image.registry}</argument>
<argument>${image.name}</argument>
<argument>${image.tag}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>push-docker-images</id>
<!-- publishes "image:latest" to Quay -->
@@ -87,8 +162,20 @@
<images>
<!-- Quay image -->
<image>
<name>${image.name}:${image.tag}</name>
<registry>${image.registry}</registry>
<name>quay.io/alfresco/dev:${test.tag}</name>
<build>
<buildx>
<builderName>${builder.name}</builderName>
<platforms>
<platform>linux/amd64</platform>
<platform>linux/arm64</platform>
</platforms>
</buildx>
<dockerFileDir>${project.basedir}</dockerFileDir>
<args>
<BASE_IMAGE>${local.registry}/${base.image}</BASE_IMAGE>
</args>
</build>
</image>
</images>
</configuration>
@@ -103,6 +190,28 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<id>prepare-buildx</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${scripts.directory}/prepare_buildx.sh</executable>
<arguments>
<argument>${builder.name}</argument>
<argument>${image.registry}</argument>
<argument>${image.name}</argument>
<argument>${image.tag}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
@@ -124,6 +233,19 @@
<!-- DockerHub image -->
<image>
<name>${image.name}:${project.version}</name>
<build>
<buildx>
<builderName>${builder.name}</builderName>
<platforms>
<platform>linux/amd64</platform>
<platform>linux/arm64</platform>
</platforms>
</buildx>
<dockerFileDir>${project.basedir}</dockerFileDir>
<args>
<BASE_IMAGE>${local.registry}/${base.image}</BASE_IMAGE>
</args>
</build>
</image>
</images>
</configuration>
@@ -139,8 +261,20 @@
<images>
<!-- Quay image -->
<image>
<name>${image.name}:${project.version}</name>
<registry>${image.registry}</registry>
<name>${image.registry}/${image.name}:${project.version}</name>
<build>
<buildx>
<builderName>${builder.name}</builderName>
<platforms>
<platform>linux/amd64</platform>
<platform>linux/arm64</platform>
</platforms>
</buildx>
<dockerFileDir>${project.basedir}</dockerFileDir>
<args>
<BASE_IMAGE>${local.registry}/${base.image}</BASE_IMAGE>
</args>
</build>
</image>
</images>
</configuration>
@@ -151,6 +285,28 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<id>prepare-buildx</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${scripts.directory}/prepare_buildx.sh</executable>
<arguments>
<argument>${builder.name}</argument>
<argument>${image.registry}</argument>
<argument>${image.name}</argument>
<argument>${image.tag}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

View File

@@ -9,12 +9,12 @@
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<relativePath>../alfresco-community-repo/pom.xml</relativePath>
<version>20.89</version>
<version>20.90-SNAPSHOT</version>
</parent>
<properties>
<dependency.alfresco-community-repo.version>20.89</dependency.alfresco-community-repo.version>
<dependency.alfresco-community-share.version>20.81</dependency.alfresco-community-share.version>
<dependency.alfresco-community-repo.version>20.90-SNAPSHOT</dependency.alfresco-community-repo.version>
<dependency.alfresco-community-share.version>20.85-SNAPSHOT</dependency.alfresco-community-share.version>
<dependency.acs-packaging.version>7.4.0-A17</dependency.acs-packaging.version> <!-- for Share distribution zip -->
<repo.image.tag>${dependency.alfresco-community-repo.version}</repo.image.tag>

View File

@@ -6,6 +6,28 @@ pushd "$(dirname "${BASH_SOURCE[0]}")/../../"
source "$(dirname "${BASH_SOURCE[0]}")/build_functions.sh"
usage() {
echo "Builds the upstream projects first, then the current one." 1>&2;
echo 1>&2;
echo "Usage: $0 [-m]" 1>&2;
echo " -m: Flag to build Docker images with multi-architecture" 1>&2;
echo " -h: Display the usage information" 1>&2;
exit 1;
}
while getopts "mh" option; do
case $option in
m)
DOCKER_BUILD_PROFILE=build-multiarch-docker-images
;;
h)
usage
;;
esac
done
BUILD_PROFILE=${DOCKER_BUILD_PROFILE:-build-docker-images}
COM_DEPENDENCY_VERSION="$(retrievePomProperty "dependency.alfresco-community-repo.version")"
REPO_IMAGE=$([[ "${COM_DEPENDENCY_VERSION}" =~ ^.+-SNAPSHOT$ ]] && echo "-Drepo.image.tag=latest" || echo)
@@ -32,9 +54,9 @@ UPSTREAM_REPO="github.com/Alfresco/alfresco-community-repo.git"
# Search, checkout and build the same branch on the upstream project in case of SNAPSHOT dependencies
# Otherwise, checkout the upstream tag and build its Docker image (use just "mvn package", without "mvn install")
if [[ "${COM_DEPENDENCY_VERSION}" =~ ^.+-SNAPSHOT$ ]] ; then
pullAndBuildSameBranchOnUpstream "${UPSTREAM_REPO}" "-Pbuild-docker-images -Pags -Dlicense.failOnNotUptodateHeader=true"
pullAndBuildSameBranchOnUpstream "${UPSTREAM_REPO}" "-P$BUILD_PROFILE -Pags -Dlicense.failOnNotUptodateHeader=true"
else
pullUpstreamTagAndBuildDockerImage "${UPSTREAM_REPO}" "${COM_DEPENDENCY_VERSION}" "-Pbuild-docker-images -Pags -Dlicense.failOnNotUptodateHeader=true"
pullUpstreamTagAndBuildDockerImage "${UPSTREAM_REPO}" "${COM_DEPENDENCY_VERSION}" "-P$BUILD_PROFILE -Pags -Dlicense.failOnNotUptodateHeader=true"
fi
SHARE_DEPENDENCY_VERSION="$(retrievePomProperty "dependency.alfresco-community-share.version")"
@@ -55,13 +77,13 @@ fi
SHARE_UPSTREAM_REPO="github.com/Alfresco/alfresco-community-share.git"
# Checkout the upstream share project (tag or branch; + build if the latter)
if [[ "${SHARE_DEPENDENCY_VERSION}" =~ ^.+-SNAPSHOT$ ]] ; then
pullAndBuildSameBranchOnUpstream "${SHARE_UPSTREAM_REPO}" "-Pbuild-docker-images -Pags -Dlicense.failOnNotUptodateHeader=true -Ddocker.quay-expires.value=NEVER ${REPO_IMAGE} -Ddependency.alfresco-community-repo.version=${COM_DEPENDENCY_VERSION}"
pullAndBuildSameBranchOnUpstream "${SHARE_UPSTREAM_REPO}" "-P$BUILD_PROFILE -Pags -Dlicense.failOnNotUptodateHeader=true -Ddocker.quay-expires.value=NEVER ${REPO_IMAGE} -Ddependency.alfresco-community-repo.version=${COM_DEPENDENCY_VERSION}"
else
pullUpstreamTagAndBuildDockerImage "${SHARE_UPSTREAM_REPO}" "${SHARE_DEPENDENCY_VERSION}" "-Pbuild-docker-images -Pags -Dlicense.failOnNotUptodateHeader=true -Ddocker.quay-expires.value=NEVER -Ddependency.alfresco-community-repo.version=${COM_DEPENDENCY_VERSION}"
pullUpstreamTagAndBuildDockerImage "${SHARE_UPSTREAM_REPO}" "${SHARE_DEPENDENCY_VERSION}" "-P$BUILD_PROFILE -Pags -Dlicense.failOnNotUptodateHeader=true -Ddocker.quay-expires.value=NEVER -Ddependency.alfresco-community-repo.version=${COM_DEPENDENCY_VERSION}"
fi
# Build the current project
mvn -B -ntp -V -q install -DskipTests -Dmaven.javadoc.skip=true -Pbuild-docker-images -Pags ${REPO_IMAGE} ${SHARE_IMAGE}
mvn -B -ntp -V -q install -DskipTests -Dmaven.javadoc.skip=true -P$BUILD_PROFILE -Pags ${REPO_IMAGE} ${SHARE_IMAGE}
popd

21
scripts/dev/prepare_buildx.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
BUILDER_NAME="${1}"
TARGET_REGISTRY="${2}"
TARGET_IMAGE="${3}"
IMAGE_TAG="${4}"
#Create a `docker-container` builder with host networking and required flags (quay.io)
docker --config target/docker/"${TARGET_REGISTRY}"/"${TARGET_IMAGE}"/"${IMAGE_TAG}"/docker \
buildx create --use --name "${BUILDER_NAME}" --driver-opt network=host \
--buildkitd-flags '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host'
#Create a `docker-container` builder with host networking and required flags (docker.io)
docker --config target/docker/"${TARGET_IMAGE}"/"${IMAGE_TAG}"/docker \
buildx create --use --name "${BUILDER_NAME}" --driver-opt network=host \
--buildkitd-flags '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host'
#Create a `docker-container` builder with host networking and required flags (local registry)
docker --config target/docker/127.0.0.1/5000/"${TARGET_IMAGE}"/"${IMAGE_TAG}"/docker \
buildx create --use --name "${BUILDER_NAME}" --driver-opt network=host \
--buildkitd-flags '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host'