Skip to content
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
127 changes: 91 additions & 36 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,78 @@ on:
- 'false'

jobs:
build-images:
runs-on: ubuntu-latest
outputs:
wb_custom: ${{ steps.wb_params.outputs.branch != '' }}
steps:
- name: Checkout test repository
uses: actions/checkout@v4
with:
path: e2e-tests

- name: Build Elasticsearch image with Kuromoji (amd64)
working-directory: e2e-tests
run: |
docker build -t elasticsearch-kuromoji:amd64 \
-f docker/elasticsearch/Dockerfile.amd64 docker/elasticsearch
mkdir -p ../prebuilt-images
docker save -o ../prebuilt-images/elasticsearch-kuromoji.tar elasticsearch-kuromoji:amd64

- name: Build MinIO images from source
working-directory: e2e-tests
run: |
docker build -t minio-source:local -f docker/minio/Dockerfile.minio docker/minio
docker build -t minio-mc-source:local -f docker/minio/Dockerfile.mc docker/minio
docker save -o ../prebuilt-images/minio.tar minio-source:local minio-mc-source:local

- name: Parse WaterButler parameters
id: wb_params
env:
PR_BODY: ${{ github.event.pull_request.body }}
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
printf '%s\n' "$PR_BODY" > /tmp/pr_body.txt
echo "repository=$(grep -oP '^-\s*WB_REPOSITORY:\s*\K.*$' /tmp/pr_body.txt | head -1 | tr -d ' \r' || true)" >> $GITHUB_OUTPUT
echo "branch=$(grep -oP '^-\s*WB_BRANCH:\s*\K.*$' /tmp/pr_body.txt | head -1 | tr -d ' \r' || true)" >> $GITHUB_OUTPUT
else
echo "repository=${{ github.event.inputs.wb_repository }}" >> $GITHUB_OUTPUT
echo "branch=${{ github.event.inputs.wb_branch }}" >> $GITHUB_OUTPUT
fi

- name: Build custom WaterButler image
if: steps.wb_params.outputs.branch != ''
run: |
WB_REPO="${{ steps.wb_params.outputs.repository || 'RCOSDP/RDM-waterbutler' }}"
WB_BRANCH="${{ steps.wb_params.outputs.branch }}"
WB_BASE_BRANCH="develop"

echo "Building custom WaterButler image from ${WB_REPO}@${WB_BRANCH}"

# Clone base branch
git clone --depth=50 -b "$WB_BASE_BRANCH" "https://github.com/${WB_REPO}.git" RDM-waterbutler
cd RDM-waterbutler

# Merge custom branch
git fetch origin "$WB_BRANCH"
git config user.name "github-actions[bot]"
git config user.email "RDM-e2e-test-nb@example.com"
git merge --no-ff FETCH_HEAD -m "Merge ${WB_BRANCH} for E2E tests"

# Build Docker image
docker build -t rdm-waterbutler:custom .
cd ..
docker save -o prebuilt-images/rdm-waterbutler-custom.tar rdm-waterbutler:custom

- name: Upload prebuilt images
uses: actions/upload-artifact@v4
with:
name: prebuilt-images
path: prebuilt-images/
retention-days: 7

e2e-test:
needs: build-images
runs-on: ubuntu-latest
timeout-minutes: 120
strategy:
Expand Down Expand Up @@ -601,13 +672,29 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Elasticsearch image with Kuromoji (amd64)
working-directory: e2e-tests
- name: Download prebuilt images
uses: actions/download-artifact@v4
with:
name: prebuilt-images
path: prebuilt-images

- name: Load prebuilt images
run: |
docker build -t elasticsearch-kuromoji:amd64 \
-f docker/elasticsearch/Dockerfile.amd64 docker/elasticsearch
docker load -i prebuilt-images/elasticsearch-kuromoji.tar
echo "ELASTICSEARCH_IMAGE=elasticsearch-kuromoji:amd64" >> "$GITHUB_ENV"

if [ "${MINIO_ENABLED}" = "true" ]; then
docker load -i prebuilt-images/minio.tar
echo "MINIO_IMAGE=minio-source:local" >> "$GITHUB_ENV"
echo "MINIO_MC_IMAGE=minio-mc-source:local" >> "$GITHUB_ENV"
fi

if [ "${{ needs.build-images.outputs.wb_custom }}" = "true" ]; then
docker load -i prebuilt-images/rdm-waterbutler-custom.tar
echo "WB_IMAGE=rdm-waterbutler:custom" >> "$GITHUB_ENV"
fi
rm -rf prebuilt-images

- name: Install Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/v2.40.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Expand Down Expand Up @@ -775,9 +862,6 @@ jobs:
cat > /tmp/pr_body.txt << 'EOF'
${{ github.event.pull_request.body }}
EOF
echo "WB_CUSTOM_REPO=$(grep -oP '^-\s*WB_REPOSITORY:\s*\K.*$' /tmp/pr_body.txt | head -1 | tr -d ' \r' || true)" >> $GITHUB_ENV
echo "WB_CUSTOM_BRANCH=$(grep -oP '^-\s*WB_BRANCH:\s*\K.*$' /tmp/pr_body.txt | head -1 | tr -d ' \r' || true)" >> $GITHUB_ENV

# Wiki parameters from PR body
WIKI_ENABLED_OVERRIDE=$(grep -oP '^-\s*WIKI_ENABLED:\s*\K.*$' /tmp/pr_body.txt | head -1 | tr -d ' \r' | tr '[:upper:]' '[:lower:]' || true)
WIKI_REPO_OVERRIDE=$(grep -oP '^-\s*WIKI_REPOSITORY:\s*\K.*$' /tmp/pr_body.txt | head -1 | tr -d ' \r' || true)
Expand All @@ -796,41 +880,12 @@ jobs:
echo "Y_WEBSOCKET_CUSTOM_REPO=${Y_WEBSOCKET_REPO_OVERRIDE}" >> $GITHUB_ENV
echo "Y_WEBSOCKET_CUSTOM_BRANCH=${Y_WEBSOCKET_BRANCH_OVERRIDE}" >> $GITHUB_ENV
else
echo "WB_CUSTOM_REPO=${{ github.event.inputs.wb_repository }}" >> $GITHUB_ENV
echo "WB_CUSTOM_BRANCH=${{ github.event.inputs.wb_branch }}" >> $GITHUB_ENV
echo "WIKI_CUSTOM_REPO=${{ github.event.inputs.wiki_repository }}" >> $GITHUB_ENV
echo "WIKI_CUSTOM_BRANCH=${{ github.event.inputs.wiki_branch }}" >> $GITHUB_ENV
echo "Y_WEBSOCKET_CUSTOM_REPO=${{ github.event.inputs.y_websocket_repository }}" >> $GITHUB_ENV
echo "Y_WEBSOCKET_CUSTOM_BRANCH=${{ github.event.inputs.y_websocket_branch }}" >> $GITHUB_ENV
fi

- name: Build custom WaterButler image
if: env.WB_CUSTOM_BRANCH != ''
run: |
WB_REPO="${WB_CUSTOM_REPO:-RCOSDP/RDM-waterbutler}"
WB_BRANCH="${WB_CUSTOM_BRANCH}"
WB_BASE_BRANCH="develop"

echo "Building custom WaterButler image from ${WB_REPO}@${WB_BRANCH}"

# Clone base branch
git clone --depth=50 -b "$WB_BASE_BRANCH" "https://github.com/${WB_REPO}.git" RDM-waterbutler
cd RDM-waterbutler

# Merge custom branch
git fetch origin "$WB_BRANCH"
git config user.name "github-actions[bot]"
git config user.email "RDM-e2e-test-nb@example.com"
git merge --no-ff FETCH_HEAD -m "Merge ${WB_BRANCH} for E2E tests"

# Build Docker image
docker build -t rdm-waterbutler:custom .
cd ..

# Override WB_IMAGE for subsequent steps
echo "WB_IMAGE=rdm-waterbutler:custom" >> $GITHUB_ENV
echo "Custom WaterButler image built successfully"

- name: Build Wiki bundle and OSF image
if: env.WIKI_ENABLED == 'true'
run: |
Expand Down
15 changes: 15 additions & 0 deletions docker/minio/Dockerfile.mc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# syntax=docker/dockerfile:1
# minio/mc is no longer published on Docker Hub; build the last release from source.
FROM golang:1.24-alpine AS build
ARG MC_RELEASE_TAG=RELEASE.2025-08-13T08-35-41Z
RUN apk add --no-cache git
RUN git clone --depth 1 --branch "${MC_RELEASE_TAG}" https://github.com/minio/mc.git /src
WORKDIR /src
RUN CGO_ENABLED=0 go build -trimpath \
-ldflags "$(MC_RELEASE=RELEASE go run buildscripts/gen-ldflags.go "${MC_RELEASE_TAG#RELEASE.}")" \
-o /out/mc .

FROM alpine:3.22
RUN apk add --no-cache ca-certificates
COPY --from=build /out/mc /usr/bin/mc
ENTRYPOINT ["/usr/bin/mc"]
15 changes: 15 additions & 0 deletions docker/minio/Dockerfile.minio
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# syntax=docker/dockerfile:1
# minio/minio is no longer published on Docker Hub; build the last release from source.
FROM golang:1.24-alpine AS build
ARG MINIO_RELEASE_TAG=RELEASE.2025-10-15T17-29-55Z
RUN apk add --no-cache git
RUN git clone --depth 1 --branch "${MINIO_RELEASE_TAG}" https://github.com/minio/minio.git /src
WORKDIR /src
RUN CGO_ENABLED=0 go build -trimpath \
-ldflags "$(MINIO_RELEASE=RELEASE go run buildscripts/gen-ldflags.go "${MINIO_RELEASE_TAG#RELEASE.}")" \
-o /out/minio .

FROM alpine:3.22
RUN apk add --no-cache ca-certificates curl
COPY --from=build /out/minio /usr/bin/minio
ENTRYPOINT ["/usr/bin/minio"]
Loading