Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPSEXP-2844 Build community from forks #75

Merged
merged 24 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 5 additions & 16 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 }}
Expand Down
213 changes: 213 additions & 0 deletions .github/workflows/build_forks.yml
gionn marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -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/[email protected]

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/[email protected]

- 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/[email protected]
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/[email protected]
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/[email protected]
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
38 changes: 32 additions & 6 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -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"]
}

Expand Down Expand Up @@ -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" {
Expand Down
2 changes: 1 addition & 1 deletion repository/artifacts.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"version": "42.6.0",
"classifier": ".jar",
"group": "org.postgresql",
"repository": "central",
"repository": "public",
"path": "repository/libs"
},
{
Expand Down
2 changes: 1 addition & 1 deletion search/service/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
22 changes: 14 additions & 8 deletions share/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,30 @@
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
Expand All @@ -45,7 +51,7 @@

FROM share-rhlike AS share-rockylinux9

FROM share-${DISTRIB_NAME}${DISTRIB_MAJOR}

Check warning on line 54 in share/Dockerfile

View workflow job for this annotation

GitHub Actions / build

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG share-${DISTRIB_NAME}${DISTRIB_MAJOR} results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

Check warning on line 54 in share/Dockerfile

View workflow job for this annotation

GitHub Actions / build

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG share-${DISTRIB_NAME}${DISTRIB_MAJOR} results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/
USER ${ALFRESCO_SHARE_USER_NAME}

ENTRYPOINT ["/usr/local/tomcat/shared/classes/alfresco/entrypoint.sh"]
Loading
Loading