Files
alfresco-content-app/.github/actions/deploy-local-acs/action.yml
Akash RathodandGiovanni Toraldo 3b66da91a6 ACS-12055 Align local ACS deploy with upstream pre-release values (#5266)
* ACS-12055 Align local ACS deploy with upstream pre-release values

* ACS-12055 add log for acs version

* ACS-12055 Align local ACS deploy with acs-deployment pre-release image tags

* ACS-12055 Align local ACS deploy with acs-deployment pre-release image tags

* fix pr review comment

* fix pr review copilot  comment

* use pre-release_values.yaml only when deploying master branch

* fix pr review copilot comment to imporve logging

* fix pr review copilot comment to imporve logging

---------

Co-authored-by: Giovanni Toraldo <giovanni.toraldo@hyland.com>
2026-07-06 15:40:46 +02:00

192 lines
7.4 KiB
YAML

name: deploy-local-acs
description: Deploy local ACS for E2E testing
inputs:
docker_username:
description: 'Docker username'
required: true
docker_password:
description: 'Docker password'
required: true
quay_username:
description: 'Quay username'
required: true
quay_password:
description: 'Quay password'
required: true
acs_deployment_version:
description: >-
Git ref (tag, branch, or commit SHA) of the Alfresco/acs-deployment
repository to check out. Use the special value 'latest' (the default)
to resolve to the latest GA release tag at runtime.
When set to 'master', pre-release_values.yaml is included in the Helm
install to pick up pre-release image tags; any other ref uses the
chart's standard values.yaml instead.
required: false
default: 'latest'
runs:
using: "composite"
steps:
- uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310
with:
version: "3.14.3"
- name: Login to Docker Hub
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
username: ${{ inputs.docker_username }}
password: ${{ inputs.docker_password }}
- name: Login to Quay.io
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
registry: quay.io
username: ${{ inputs.quay_username }}
password: ${{ inputs.quay_password }}
- name: Setup cluster
uses: Alfresco/alfresco-build-tools/.github/actions/setup-kind@v18.13.0
with:
ingress-nginx-ref: controller-v1.8.2
ingress-creation-timeout: 180s
- name: Set nginx ingress config
shell: bash
run: >-
kubectl -n ingress-nginx patch cm ingress-nginx-controller
-p '{"data": {"allow-snippet-annotations":"true"}}'
- name: Create registries auth secret
shell: bash
run: >-
kubectl create secret generic regcred
--from-file=.dockerconfigjson=$HOME/.docker/config.json
--type=kubernetes.io/dockerconfigjson
- name: Add dependency chart repos
shell: bash
run: |
helm repo add self https://alfresco.github.io/alfresco-helm-charts/
helm repo add elastic https://helm.elastic.co/
- name: Resolve acs-deployment ref
id: get-acs-version
shell: bash
env:
ACS_VERSION_INPUT: ${{ inputs.acs_deployment_version }}
GITHUB_TOKEN: ${{ github.token }}
run: |
if [ "$ACS_VERSION_INPUT" != "latest" ]; then
echo "Using specified acs-deployment ref: $ACS_VERSION_INPUT"
echo "version=$ACS_VERSION_INPUT" >> "$GITHUB_OUTPUT"
exit 0
fi
auth_header=()
[ -n "$GITHUB_TOKEN" ] && auth_header=(-H "Authorization: Bearer $GITHUB_TOKEN")
max_retries=3
retry_count=0
while [ $retry_count -lt $max_retries ]; do
echo "Attempt $((retry_count + 1)) of $max_retries to fetch latest ACS deployment version..."
response=$(curl -s "${auth_header[@]}" https://api.github.com/repos/Alfresco/acs-deployment/releases/latest)
latest_tag=$(echo "$response" | jq -r .tag_name 2>/dev/null || echo "")
if [ "$latest_tag" != "null" ] && [ -n "$latest_tag" ]; then
echo "Successfully fetched latest ACS deployment version: $latest_tag"
echo "version=$latest_tag" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "Warning: Received invalid response (tag_name: $latest_tag)"
retry_count=$((retry_count + 1))
if [ $retry_count -lt $max_retries ]; then
sleep_time=$((2 ** retry_count))
echo "Retrying in $sleep_time seconds..."
sleep $sleep_time
fi
done
echo "Error: Failed to fetch latest ACS deployment version after $max_retries attempts"
echo "Last response: $response"
exit 1
- name: Checkout acs-deployment ${{ steps.get-acs-version.outputs.version }}
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
repository: Alfresco/acs-deployment
ref: ${{ steps.get-acs-version.outputs.version }}
path: acs-deployment
- name: Helm install
shell: bash
env:
ACS_VERSION_INPUT: ${{ inputs.acs_deployment_version }}
run: |
[ "$ACS_VERSION_INPUT" = "master" ] && chart_values="pre-release_values.yaml" || chart_values="values.yaml"
helm dep build acs-deployment/helm/alfresco-content-services
helm install acs acs-deployment/helm/alfresco-content-services \
--set global.search.sharedSecret="$(openssl rand -hex 24)" \
--values "acs-deployment/helm/alfresco-content-services/${chart_values}" \
--values acs-deployment/test/enterprise-integration-test-values.yaml \
--values .github/acs-deployment-values-override.yaml
- name: Wait for pods to be ready
uses: Alfresco/alfresco-build-tools/.github/actions/kubectl-wait@v18.13.0
- name: Report deployed ACS versions
if: always()
shell: bash
env:
ACS_DEPLOYMENT_VERSION: ${{ steps.get-acs-version.outputs.version }}
run: |
pre_release_values="acs-deployment/helm/alfresco-content-services/pre-release_values.yaml"
pod_images=$(kubectl get pods -A \
-o jsonpath='{range .items[*]}{.metadata.namespace}{"/"}{.metadata.name}{"\t"}{range .spec.containers[*]}{.name}{"="}{.image}{"\n"}{end}{end}' \
2>/dev/null | sort -u || true)
cluster_images=$(echo "${pod_images}" | awk -F'\t' 'NF > 1 { sub(/^[^=]*=/, "", $NF); print $NF }' | sort -u)
acs_repository_image=$(echo "${cluster_images}" | grep -m1 'alfresco-content-repository:' || echo "(alfresco-content-repository pod not found)")
acs_repository_tag="${acs_repository_image##*:}"
# ACS_DEPLOYMENT_VERSION is a git ref (branch, tag, or SHA) — resolve it to the
# exact commit SHA that was checked out so past runs can be reproduced even
# when moving refs like `master` have advanced.
acs_deployment_commit=$(git -C acs-deployment rev-parse HEAD 2>/dev/null || echo "(unknown)")
{
echo "### 🐳 Deployed ACS versions"
echo "- **ACS repository:** \`${acs_repository_tag}\`"
echo "- **acs-deployment ref:** \`${ACS_DEPLOYMENT_VERSION}\`"
echo "- **acs-deployment commit:** \`${acs_deployment_commit}\`"
echo "**Container images in cluster:**"
echo "${cluster_images:-(no pods found)}"
} >> "$GITHUB_STEP_SUMMARY"
echo "::group::ACS repository image tag"
echo "${acs_repository_image}"
echo "::endgroup::"
echo "::group::acs-deployment ref"
echo "${ACS_DEPLOYMENT_VERSION}"
echo "::endgroup::"
echo "::group::acs-deployment commit"
echo "${acs_deployment_commit}"
echo "::endgroup::"
values_path="acs-deployment/helm/alfresco-content-services/values.yaml"
[ "$ACS_DEPLOYMENT_VERSION" = "master" ] && values_path="$pre_release_values"
echo "::group::Chart values file used ($(basename "$values_path"))"
if [ -f "$values_path" ]; then
cat "$values_path"
else
echo "(file not found: $values_path)"
fi
echo "::endgroup::"
echo "::group::Actual container images running in the cluster"
echo "${pod_images:-(no pods found)}"
echo "::endgroup::"