Skip to content
Open
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
42 changes: 29 additions & 13 deletions .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,12 @@ jobs:

build-docker:

name: Build Docker image
name: Build Docker image (Java ${{ matrix.java }})
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
java: [21, 25]

steps:
- name: Checkout repository
Expand All @@ -96,17 +99,18 @@ jobs:
with:
context: .
load: true
tags: ${{ env.IMAGE_NAME }}:ci-${{ github.sha }}
build-args: JAVA_VERSION=${{ matrix.java }}
tags: ${{ env.IMAGE_NAME }}:ci-java${{ matrix.java }}-${{ github.sha }}
cache-from: type=gha,scope=openfire-${{ steps.cache-hash.outputs.hash }}
cache-to: type=gha,mode=max,scope=openfire-${{ steps.cache-hash.outputs.hash }}

- name: Save Docker image to tar archive
run: docker save ${{ env.IMAGE_NAME }}:ci-${{ github.sha }} | gzip > openfire-docker-image.tar.gz
run: docker save ${{ env.IMAGE_NAME }}:ci-java${{ matrix.java }}-${{ github.sha }} | gzip > openfire-docker-image.tar.gz

- name: Upload Docker image archive
uses: actions/upload-artifact@v7
with:
name: Openfire Docker Image
name: Openfire Docker Image Java ${{ matrix.java }}
path: openfire-docker-image.tar.gz
retention-days: 1

Expand All @@ -121,13 +125,13 @@ jobs:
- name: Download Docker image archive
uses: actions/download-artifact@v8
with:
name: Openfire Docker Image
name: Openfire Docker Image Java 21
path: .

- name: Load Docker image
run: |
docker load < openfire-docker-image.tar.gz
docker tag ${{ env.IMAGE_NAME }}:ci-${{ github.sha }} openfire:latest
docker tag ${{ env.IMAGE_NAME }}:ci-java21-${{ github.sha }} openfire:latest

- name: Checkout Integration Tests
uses: actions/checkout@v7
Expand Down Expand Up @@ -1244,10 +1248,13 @@ jobs:
IGNITE_REALTIME_MAVEN_PASSWORD: ${{ secrets.IGNITE_REALTIME_MAVEN_PASSWORD }}

publish-docker:
name: Publish to GitHub's Docker registry
name: Publish to GitHub's Docker registry (Java ${{ matrix.java }})
runs-on: ubuntu-latest
needs: [build-docker, aioxmpp, connectivity, integration, xitf, check_branch, hsqldb-install, hsqldb-upgrade, sqlserver-install, sqlserver-upgrade, postgres-install, postgres-upgrade, cockroachdb-install, cockroachdb-upgrade, firebird-install, firebird-upgrade, mysql-install, mysql-upgrade, mariadb-install, mariadb-upgrade, oracle-install, oracle-upgrade]
if: ${{ github.repository == 'igniterealtime/Openfire' && github.event_name == 'push' && needs.check_branch.outputs.is_publishable_branch == 'true' }}
strategy:
matrix:
java: [21, 25]

permissions:
contents: read
Expand All @@ -1262,7 +1269,7 @@ jobs:
- name: Download Docker image archive
uses: actions/download-artifact@v8
with:
name: Openfire Docker Image
name: Openfire Docker Image Java ${{ matrix.java }}
path: .

- name: Load Docker image
Expand All @@ -1275,19 +1282,28 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for image registry
- name: Extract metadata (plain tags, default Java version only)
id: meta
if: ${{ matrix.java == 21 }}
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/igniterealtime/${{ env.IMAGE_NAME }}

- name: Extract metadata (versioned tags)
id: meta-versioned
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/igniterealtime/${{ env.IMAGE_NAME }}
flavor: suffix=-java${{ matrix.java }}
Comment on lines +1285 to +1297

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify both metadata-action invocations declare the minor semver alias.
python - <<'PY'
from pathlib import Path
text = Path(".github/workflows/continuous-integration-workflow.yml").read_text()
needle = "type=semver,pattern={{major}}.{{minor}}"
count = text.count(needle)
print(f"{needle}: {count}")
raise SystemExit(0 if count >= 2 else 1)
PY

Repository: igniterealtime/Openfire

Length of output: 204


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the workflow around the referenced lines and search for all metadata-action tag definitions.
python3 - <<'PY'
from pathlib import Path
p = Path(".github/workflows/continuous-integration-workflow.yml")
lines = p.read_text().splitlines()
start, end = 1260, 1325
for i in range(start, min(end, len(lines)) + 1):
    print(f"{i:4d}: {lines[i-1]}")
PY

printf '\n--- SEARCH: metadata-action tag patterns ---\n'
rg -n -C 3 'docker/metadata-action@v6|type=semver|flavor:|type=ref,event=tag|type=ref,event=branch' .github/workflows/continuous-integration-workflow.yml

Repository: igniterealtime/Openfire

Length of output: 3793


🌐 Web query:

docker/metadata-action v6 default tags semver minor pattern explicit tags documentation

💡 Result:

In docker/metadata-action v6, the tags input is used to define image tags dynamically [1][2]. Default Tags If the tags input is left empty, the action automatically generates the following tags [1][2]: type=schedule type=ref,event=branch type=ref,event=tag type=ref,event=pr Semver Pattern The type=semver attribute uses Handlebars templates to extract version components from Git tags [3][4]. Common patterns include [2][3]: pattern={{version}}: Uses the full version (e.g., 1.2.3). pattern={{major}}.{{minor}}: Uses the major and minor versions (e.g., 1.2). pattern={{major}}: Uses only the major version (e.g., 1). Explicit Tags You can define explicit (static or custom) tags using the type=raw attribute [2][5]. For example: tags: | type=raw,value=latest type=raw,value=stable # Or simply by listing them: my-custom-tag another-tag Configuration Example The following snippet demonstrates how to combine these in a workflow [1]: steps: - name: Docker meta id: meta uses: docker/metadata-action@v6 with: images: name/app tags: | type=schedule type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=ref,event=branch type=raw,value=latest

Citations:


Add the semver minor alias to both metadata steps. The release images need type=semver,pattern={{major}}.{{minor}} so the workflow publishes 5.1 and 5.1-java25, not just the full version tags.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/continuous-integration-workflow.yml around lines 1285 -
1297, The two docker/metadata-action@v6 steps in the workflow metadata setup
need the semver minor alias added so release images publish both full tags and
minor-version tags. Update the metadata configuration in the “Extract metadata
(plain tags, default Java version only)” step and the “Extract metadata
(versioned tags)” step to include a semver rule using
pattern={{major}}.{{minor}}, and keep the existing java suffix behavior in the
meta-versioned step so it produces tags like 5.1 and 5.1-java25.


- name: Retag and push final image
- name: Tag and push image
id: push
run: |
FIRST_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n1)
docker tag ${{ env.IMAGE_NAME }}:ci-${{ github.sha }} $FIRST_TAG
ALL_TAGS=$(printf '%s\n' "${{ steps.meta.outputs.tags }}" "${{ steps.meta-versioned.outputs.tags }}" | grep -v '^$')
FIRST_TAG=$(echo "$ALL_TAGS" | head -n1)
docker tag ${{ env.IMAGE_NAME }}:ci-java${{ matrix.java }}-${{ github.sha }} $FIRST_TAG
DIGEST=$(docker push $FIRST_TAG | grep -oP 'digest: \K\S+')
for tag in $(echo "${{ steps.meta.outputs.tags }}" | tail -n +2); do
for tag in $(echo "$ALL_TAGS" | tail -n +2); do
docker tag $FIRST_TAG $tag
docker push $tag
done
Expand Down
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# This stage extracts all the pom.xml files.
# It'll get rebuilt with any source change, but that's OK.
# It doesn't matter what image we're using, really, so we may as well use one of the same images as elsewhere.
FROM eclipse-temurin:17-jre AS poms
ARG JAVA_VERSION=21
FROM eclipse-temurin:${JAVA_VERSION}-jre AS poms
WORKDIR /usr/src
COPY . .
# Wipe any files not called pom.xml or *.jar
Expand All @@ -10,7 +11,7 @@ RUN find . -type f -and \! -name pom.xml -and \! -name '*.jar' -delete
RUN find . -type d -empty -delete

# Now we build:
FROM eclipse-temurin:17 AS build
FROM eclipse-temurin:${JAVA_VERSION} AS build
WORKDIR /tmp/
WORKDIR /usr/src
COPY mvnw ./
Expand Down Expand Up @@ -41,7 +42,7 @@ RUN sed -i 's/\r//g' /usr/src/distribution/target/distribution-base/bin/openfire

# Might as well create the user in a different stage if only to eliminate
# the ugly && chaining and increase parallelization
FROM eclipse-temurin:17-jre AS skeleton-runtime
FROM eclipse-temurin:${JAVA_VERSION}-jre AS skeleton-runtime

ENV OPENFIRE_USER=openfire \
OPENFIRE_DIR=/usr/local/openfire \
Expand All @@ -53,7 +54,7 @@ RUN apt-get install -yyq adduser
RUN adduser --disabled-password --quiet --system --home $OPENFIRE_DATA_DIR --gecos "Openfire XMPP server" --group $OPENFIRE_USER

# Final stage, build the runtime container:
FROM eclipse-temurin:17-jre AS runtime
FROM eclipse-temurin:${JAVA_VERSION}-jre AS runtime

ENV OPENFIRE_USER=openfire \
OPENFIRE_DIR=/usr/local/openfire \
Expand Down
Loading