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-2719: Wrap image creation with make #17

Merged
merged 38 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f82d0c0
ignore OS packages
alxgomz Jul 29, 2024
252c010
allow fetching artifacts for a subset of targets only
alxgomz Jul 30, 2024
2528f67
add make wrapper and initial doc
alxgomz Jul 30, 2024
cf2006f
fixup
alxgomz Jul 30, 2024
7d0d0bf
remove gitignore dup
alxgomz Jul 31, 2024
e2aee05
ignore and cleanup more archive types
alxgomz Jul 31, 2024
d005260
gitignore cleanup
alxgomz Jul 31, 2024
f06a402
review comment
alxgomz Jul 31, 2024
01ecd17
review comment
alxgomz Jul 31, 2024
de253da
review comment
alxgomz Jul 31, 2024
dea2dd7
test Makefile independently
alxgomz Aug 2, 2024
1ce60b2
Merge branch 'main' into OPSEXP-2719
pmacius Aug 13, 2024
88267de
test
pmacius Aug 13, 2024
349ed02
Merge branch 'main' into OPSEXP-2719
pmacius Aug 13, 2024
38777ba
test
pmacius Aug 13, 2024
828548f
fix
pmacius Aug 13, 2024
99fc99c
fix
pmacius Aug 13, 2024
3706297
revert name of step
pmacius Aug 13, 2024
6f60eb6
free disk space
pmacius Aug 13, 2024
cf733db
add missing connectors inside make
pmacius Aug 13, 2024
99b97f9
skip checking the artfiacts
pmacius Aug 19, 2024
4fbbbc6
skip checking the artfiacts
pmacius Aug 19, 2024
5ae293f
fix
pmacius Aug 19, 2024
40bce95
add missing prepare connectors step
pmacius Aug 19, 2024
6451c67
test
pmacius Aug 19, 2024
051fbef
rebase
pmacius Aug 19, 2024
9c3a898
try different type of overriding probes
pmacius Aug 19, 2024
ba90802
test the workaround
pmacius Aug 19, 2024
b4d3583
try different approach
pmacius Aug 19, 2024
938339a
test
pmacius Aug 19, 2024
cc3ebe1
test alpha
pmacius Aug 19, 2024
85e99e3
disable different way
pmacius Aug 19, 2024
9666e5e
try ussing set
pmacius Aug 20, 2024
2cd5abc
try ussing set
pmacius Aug 20, 2024
a2a8a5c
Remove connectors - will be tested on tf-pipeline
pmacius Aug 20, 2024
2adc3fd
remove outputs
pmacius Aug 20, 2024
b0c6b16
Review comments
pmacius Aug 20, 2024
7f4deaf
uniform
pmacius Aug 20, 2024
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
34 changes: 27 additions & 7 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ on:
push:
branches:
- main
paths-ignore:
- 'Makefile'
- '.github/workflows/test-make.yml'
pull_request:
branches:
- main
paths-ignore:
- 'Makefile'
- '.github/workflows/test-make.yml'

env:
ACS_CHART_VERSION: 8.3.0
ACS_VALUES_VERSION: cfb0d426eff14a8b581c31e61db5e670da09ba3b
ACS_CHART_VERSION: 172410cfb4ad44d4839d9aefd31b4bcefc44f316
ACS_VALUES_VERSION: 172410cfb4ad44d4839d9aefd31b4bcefc44f316
pmacius marked this conversation as resolved.
Show resolved Hide resolved
ARTIFACT_NAME: alfresco-docker-images

concurrency:
Expand Down Expand Up @@ -47,7 +53,7 @@ jobs:
echo "password ${{ secrets.NEXUS_PASSWORD }}" >> ~/.netrc

- name: Fetch artifacts from nexus
run: ./scripts/fetch-artifact.sh
run: ./scripts/fetch-artifacts.sh
alxgomz marked this conversation as resolved.
Show resolved Hide resolved

- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
Expand Down Expand Up @@ -119,6 +125,7 @@ jobs:

- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]


helm-test:
name: helm test
needs: build-test
Expand Down Expand Up @@ -168,13 +175,26 @@ jobs:
ls -l test/helm/enterprise-integration-test-values.yaml &&
cat test/helm/enterprise-integration-test-values.yaml
pmacius marked this conversation as resolved.
Show resolved Hide resolved

- name: Checkout github source
pmacius marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/checkout@v4
with:
repository: Alfresco/acs-deployment
ref: ${{ env.ACS_CHART_VERSION }}
path: github-source

- name: Setup helm repository
working-directory: github-source/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 repo add alfresco https://kubernetes-charts.alfresco.com/stable
helm repo update
helm install acs alfresco/alfresco-content-services \
--version ${{ env.ACS_CHART_VERSION }} \
helm install acs ./github-source/helm/alfresco-content-services \
--set global.search.sharedSecret="$(openssl rand -hex 24)" \
--set global.known_urls=http://localhost \
--set global.alfrescoRegistryPullSecrets=regcred \
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/test-make.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Test building using the make wrapper

on:
push:
gionn marked this conversation as resolved.
Show resolved Hide resolved
paths:
- 'Makefile'
- '.github/workflows/test-make.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

jobs:
make-test:
runs-on: ubuntu-latest
steps:
- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]

- name: Setup nexus authentication
run: |
echo "machine nexus.alfresco.com" >> ~/.netrc
echo "login ${{ secrets.NEXUS_USERNAME }}" >> ~/.netrc
echo "password ${{ secrets.NEXUS_PASSWORD }}" >> ~/.netrc

- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1

- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Make Docker images
id: make
run: |
make all_ci

- name: Check Images are loaded
run: |
echo -n "Checking images are loaded in local Docker Engine..."
docker images --format "{{.Repository}}:{{.Tag}}" | grep alfresco || { echo "No Alfresco image found"; exit 1; }
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
*.zip
*.amp
dist
*.jar
*.rpm
*.deb
*.jar
*.tgz
*.gz
*.tgz

Expand Down
54 changes: 54 additions & 0 deletions Makefile
alxgomz marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
clean:
@echo "Cleaning up Artifacts"
@find . \( -name "*.jar" -o -name "*.zip" -o -name "*.gz" -o -name "*.tgz" -o -name "*.rpm" -o -name "*.deb" \) -type f -delete

prepare_repo: scripts/fetch-artifacts.sh
@echo "Fetching all artifacts for repository target"
@./scripts/fetch-artifacts.sh repository

prepare_tengines: scripts/fetch-artifacts.sh
@echo "Fetching all artifacts for tengines targets"
@./scripts/fetch-artifacts.sh tengine

prepare_ats: scripts/fetch-artifacts.sh
@echo "Fetching all artifacts for ats targets"
@./scripts/fetch-artifacts.sh ats

prepare_search_enterprise: scripts/fetch-artifacts.sh
@echo "Fetching all artifacts for Search Enterprise targets"
@./scripts/fetch-artifacts.sh search/enterprise

prepare_connectors: scripts/fetch-artifacts.sh
@echo "Fetching all artifacts for Connectors targets"
@./scripts/fetch-artifacts.sh connector

prepare_all: scripts/fetch-artifacts.sh
@echo "Fetching all artifacts"
@./scripts/fetch-artifacts.sh

repo: prepare_repo
@echo "Building repository image"
@docker buildx bake --no-cache --progress=plain repository

tengines: prepare_tengines
@echo "Building Transform Egnine images"
@docker buildx bake --no-cache --progress=plain tengines

ats: prepare_ats prepare_tengines
@echo "Building Transform Service images"
@docker buildx bake --no-cache --progress=plain ats tengines

search_enterprise: prepare_search_enterprise
@echo "Building Search Enterprise images"
@docker buildx bake --no-cache --progress=plain enterprise-search

connectors: prepare_connectors
@echo "Building Connectors images"
@docker buildx bake --no-cache --progress=plain connectors

all: docker-bake.hcl prepare_all
@echo "Building all images"
@docker buildx bake --no-cache --progress=plain

all_ci: repo tengines ats search_enterprise clean connectors
@echo "Building all images using individual targets for Continuous Integration"
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Alfresco Docker images builder

This projects aims at providing a quick and easy to build and maintain Alfresco
Docker images.

## Getting started quickly

If you do not plan on applying specific customizations but just want to get
Alfresco images updated (e.g. with the latest OS security patches), you can
simply run the command below from the root of this project:

```bash
make all
```

This command will build locally all the docjker images this project offers.
At the time of writing, these are:

* Alfresco Content Repository (Enterprise) 23.2.2
* Alfresco Search Enterprise 4.4.0
* Alfresco Transformation Services 4.1.3

## Building the specific images

If you want to build a specific image, you can run one of the following make target:

* repo: build the Alfresco Content Repository image
* search_enterprise: build the Alfresco Search Enterprise images
* ats: build the Alfresco Transformation Service images

## Customizing the images

### Customizing the Alfresco Content Repository image

The Alfresco Content Repository image can be customized by adding different
types of files in the right locations:

* Alfresco Module Packages (AMPs) files in the [amps}(repository/amps/README.md) folder
* Additional JAR files for the JRE in the [libs](repository/libs/README.md) folder
24 changes: 14 additions & 10 deletions scripts/fetch-artifact.sh → scripts/fetch-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@ REPO_ROOT=$(dirname $0)
ACS_VERSION=${ACS_VERSION:=23.2.2}
INDEX_KEY=${ACS_VERSION%%.*}

cd ${REPO_ROOT}/..

for i in $(find . -name artifacts.json -mindepth 2); do
for j in $(jq -r ".artifacts.acs${INDEX_KEY} | keys | .[]" $i); do
ARTIFACT_REPO=$(jq -r ".artifacts.acs${INDEX_KEY}[$j].repository" $i)
ARTIFACT_NAME=$(jq -r ".artifacts.acs${INDEX_KEY}[$j].name" $i)
ARTIFACT_VERSION=$(jq -r ".artifacts.acs${INDEX_KEY}[$j].version" $i)
ARTIFACT_EXT=$(jq -r ".artifacts.acs${INDEX_KEY}[$j].classifier" $i)
ARTIFACT_GROUP=$(jq -r ".artifacts.acs${INDEX_KEY}[$j].group" $i)
ARTIFACT_PATH=$(jq -r ".artifacts.acs${INDEX_KEY}[$j].path" $i)
do_fetch_mvn() {
for i in $(jq -r ".artifacts.acs${INDEX_KEY} | keys | .[]" $1); do
ARTIFACT_REPO=$(jq -r ".artifacts.acs${INDEX_KEY}[$i].repository" $1)
ARTIFACT_NAME=$(jq -r ".artifacts.acs${INDEX_KEY}[$i].name" $1)
ARTIFACT_VERSION=$(jq -r ".artifacts.acs${INDEX_KEY}[$i].version" $1)
ARTIFACT_EXT=$(jq -r ".artifacts.acs${INDEX_KEY}[$i].classifier" $1)
ARTIFACT_GROUP=$(jq -r ".artifacts.acs${INDEX_KEY}[$i].group" $1)
ARTIFACT_PATH=$(jq -r ".artifacts.acs${INDEX_KEY}[$i].path" $1)
ARTIFACT_BASEURL="https://nexus.alfresco.com/nexus/repository/${ARTIFACT_REPO}"
ARTIFACT_FINAL_PATH="${ARTIFACT_PATH}/${ARTIFACT_NAME}-${ARTIFACT_VERSION}${ARTIFACT_EXT}"
if [ -f "${ARTIFACT_FINAL_PATH}" ]; then
Expand All @@ -27,4 +25,10 @@ for i in $(find . -name artifacts.json -mindepth 2); do
-O "${ARTIFACT_FINAL_PATH}" \
--no-verbose
done
}

TARGETS=$(find "${REPO_ROOT}/.." -regex "${REPO_ROOT}/../${1:+$1/}.*" -name artifacts.json -mindepth 2 -print)

for i in $TARGETS ; do
do_fetch_mvn $i
done
37 changes: 0 additions & 37 deletions test/helm/test-overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,43 +48,6 @@ alfresco-transform-service:
repository: localhost/alfresco-shared-file-store
tag: latest
#alfresco-sync-service:
alfresco-connector-ms365:
enabled: true
replicaCount: 1
image:
repository: localhost/alfresco-ooi-service
tag: latest
environment:
ALFRESCO_ADMIN_PASSWORD: admin
ALFRESCO_ADMIN_USERNAME: admin
livenessProbe: null
resources:
requests:
cpu: "0.01"
memory: "256Mi"
limits:
cpu: "2"
memory: "512Mi"
alfresco-connector-msteams:
enabled: true
replicaCount: 1
image:
repository: localhost/alfresco-ms-teams-service
tag: latest
readinessProbe:
initialDelaySeconds: 120
livenessProbe: null
microsoft:
app:
id: admin
password: admin
resources:
requests:
cpu: "0.01"
memory: "256Mi"
limits:
cpu: "2"
memory: "512Mi"
dtas:
additionalArgs:
- --tb=short
Expand Down