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
56 changes: 53 additions & 3 deletions .github/workflows/image-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,63 @@ concurrency:
cancel-in-progress: true

jobs:
determine-version:
name: Determine Bundle Version
runs-on: ubuntu-latest
outputs:
bundle_version: ${{ steps.version.outputs.bundle_version }}
is_release: ${{ steps.version.outputs.is_release }}
steps:
- name: Determine version from git ref
id: version
run: |
# Translate upstream 0.x tags to downstream 1.x artifact versions.
# Anchor: v0.9.1 == 1.0.0
# 0.9.P (P>=1) -> 1.0.(P-1)
# 0.M.P (M>=10) -> 1.(M-9).P
# 1.x.y+ -> pass-through
translate_version() {
local raw="$1" base suffix=""
# Separate pre-release suffix (e.g., -rc.1, -alpha.2)
if [[ "$raw" == *-* ]]; then
suffix="-${raw#*-}"
base="${raw%%-*}"
else
base="$raw"
fi
IFS='.' read -r major minor patch <<< "$base"
if [[ "$major" -ge 1 ]]; then
echo "${base}${suffix}"
elif [[ "$minor" -ge 10 ]]; then
echo "1.$((minor - 9)).${patch}${suffix}"
elif [[ "$minor" -eq 9 && "$patch" -ge 1 ]]; then
echo "1.0.$((patch - 1))${suffix}"
else
echo "${base}${suffix}"
fi
}
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
RAW_VERSION="${GITHUB_REF#refs/tags/v}"
VERSION=$(translate_version "$RAW_VERSION")
echo "bundle_version=${VERSION}" >> $GITHUB_OUTPUT
echo "is_release=true" >> $GITHUB_OUTPUT
echo "Tag: v${RAW_VERSION} -> artifact version: ${VERSION}"
else
echo "bundle_version=1.1.0-SNAPSHOT" >> $GITHUB_OUTPUT
echo "is_release=false" >> $GITHUB_OUTPUT
echo "Building SNAPSHOT version: 1.1.0-SNAPSHOT"
fi
image-build:
needs: determine-version
uses: konveyor/release-tools/.github/workflows/build-push-images.yaml@main
with:
registry: "quay.io/konveyor"
image_name: "jdtls-server-base"
containerfile: "./Dockerfile"
architectures: '[ "amd64", "arm64" ]'
extra-args: "--build-arg BUNDLE_VERSION=${{ needs.determine-version.outputs.bundle_version }}"
publish: ${{ github.event_name == 'pull_request' && 'false' || 'true' }}
secrets:
registry_username: ${{ secrets.QUAY_PUBLISH_ROBOT }}
Expand All @@ -33,7 +83,7 @@ jobs:
build_image_analyzer:
name: trigger java provider rebuild
runs-on: ubuntu-latest
needs: image-build
needs: [determine-version, image-build]
if: github.event_name == 'push'
steps:
- name: Get Token
Expand All @@ -43,10 +93,10 @@ jobs:
application_id: ${{ vars.KONVEYOR_BOT_ID }}
application_private_key: ${{ secrets.KONVEYOR_BOT_KEY }}

# Tell the analyzer to re-build it's images to get the update image.
# Tell the analyzer to re-build its images to get the updated image.
- uses: peter-evans/repository-dispatch@v4
with:
token: ${{ steps.get_workflow_token.outputs.token }}
repository: "konveyor/analyzer-lsp"
event-type: rebuild-java-provider
client-payload: '{"ref": "${{ github.ref}}", "ref_name": "${{ github.ref_name }}"}'
client-payload: '{"ref": "${{ github.ref }}", "ref_name": "${{ github.ref_name }}", "bundle_version": "${{ needs.determine-version.outputs.bundle_version }}"}'
116 changes: 116 additions & 0 deletions .github/workflows/post-release-bump.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Post-Release Version Bump

on:
push:
tags:
- 'v*'

jobs:
bump-version:
name: Bump to next SNAPSHOT version
runs-on: ubuntu-latest
# Only bump for final releases (skip pre-releases like v0.9.2-rc.1)
if: ${{ !contains(github.ref_name, '-') }}

steps:
- name: Get Token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v3
with:
application_id: ${{ vars.KONVEYOR_BOT_ID }}
application_private_key: ${{ secrets.KONVEYOR_BOT_KEY }}

- uses: actions/checkout@v4
with:
ref: main
token: ${{ steps.get_workflow_token.outputs.token }}

- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: '21'
distribution: 'temurin'
cache: maven

- name: Calculate next version
id: next_version
run: |
# Same translation logic as image-build.yaml
# Anchor: v0.9.1 == 1.0.0
translate_version() {
local raw="$1" base
IFS='.' read -r major minor patch <<< "$raw"
if [[ "$major" -ge 1 ]]; then
echo "${raw}"
elif [[ "$minor" -ge 10 ]]; then
echo "1.$((minor - 9)).${patch}"
elif [[ "$minor" -eq 9 && "$patch" -ge 1 ]]; then
echo "1.0.$((patch - 1))"
else
echo "${raw}"
fi
}

RAW_VERSION="${GITHUB_REF_NAME#v}"
RELEASE_VERSION=$(translate_version "$RAW_VERSION")
IFS='.' read -r MAJOR MINOR PATCH <<< "$RELEASE_VERSION"
NEXT_VERSION="${MAJOR}.$((MINOR + 1)).0-SNAPSHOT"

echo "raw_version=${RAW_VERSION}" >> $GITHUB_OUTPUT
echo "release_version=${RELEASE_VERSION}" >> $GITHUB_OUTPUT
echo "next_version=${NEXT_VERSION}" >> $GITHUB_OUTPUT
echo "Tag: v${RAW_VERSION} -> released: ${RELEASE_VERSION} -> next dev: ${NEXT_VERSION}"

- name: Set next SNAPSHOT version in POMs and MANIFESTs
run: |
mvn -B org.eclipse.tycho:tycho-versions-plugin:4.0.7:set-version \
-DnewVersion=${{ steps.next_version.outputs.next_version }}

- name: Update Dockerfile ARG defaults
run: |
NEXT="${{ steps.next_version.outputs.next_version }}"
sed -i "s/^ARG BUNDLE_VERSION=.*/ARG BUNDLE_VERSION=${NEXT}/" Dockerfile Dockerfile.test

- name: Configure git
run: |
git config user.name "konveyor-bot[bot]"
git config user.email "konveyor-bot[bot]@users.noreply.github.com"

- name: Create branch and commit
run: |
NEXT="${{ steps.next_version.outputs.next_version }}"
BRANCH="chore/bump-version-${NEXT}"
git checkout -b "$BRANCH"
git add -A
git commit --signoff \
-m "chore: bump version to ${NEXT} after ${{ github.ref_name }} release"
git push origin "$BRANCH"

- name: Create Pull Request
env:
GH_TOKEN: ${{ steps.get_workflow_token.outputs.token }}
run: |
RAW="${{ steps.next_version.outputs.raw_version }}"
RELEASE="${{ steps.next_version.outputs.release_version }}"
NEXT="${{ steps.next_version.outputs.next_version }}"
gh pr create \
--title "chore: bump version to ${NEXT}" \
--body "$(cat <<EOF
## Post-Release Version Bump

Automated version bump after the **${{ github.ref_name }}** release.

- Upstream tag: \`v${RAW}\`
- Artifact version: \`${RELEASE}\`
- Next development version: \`${NEXT}\`

### Changes
- Updated all POM versions via \`tycho-versions:set-version\`
- Updated MANIFEST.MF Bundle-Version (qualifier)
- Updated Dockerfile ARG defaults

_This PR was automatically created by the post-release version bump workflow._
EOF
)" \
--base main \
--head "chore/bump-version-${NEXT}"
16 changes: 13 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,23 @@ RUN ./gradlew build -x test && rm -rf /root/.gradle
RUN mkdir /output && cp ./build/libs/fernflower.jar /output

FROM registry.access.redhat.com/ubi9/ubi AS addon-build
ARG BUNDLE_VERSION=1.1.0-SNAPSHOT
RUN dnf install -y java-21-openjdk-devel wget zip --nodocs --setopt=install_weak_deps=0 && dnf clean all && rm -rf /var/cache/dnf
RUN curl -fsSL -o /tmp/apache-maven.tar.gz https://dlcdn.apache.org/maven/maven-3/3.9.14/binaries/apache-maven-3.9.14-bin.tar.gz && \
tar -xzf /tmp/apache-maven.tar.gz -C /usr/local/ && \
rm /tmp/apache-maven.tar.gz
WORKDIR /app
COPY ./ /app/
ENV JAVA_HOME /usr/lib/jvm/java-21-openjdk
RUN /usr/local/apache-maven-3.9.14/bin/mvn clean install -DskipTests=true
# For release builds (non-SNAPSHOT), update all POM and MANIFEST.MF versions via Tycho.
# NOTE: The Tycho plugin version here must match <tycho.version> in pom.xml.
RUN case "$BUNDLE_VERSION" in \
*-SNAPSHOT) echo "SNAPSHOT build: $BUNDLE_VERSION" ;; \
*) echo "Setting release version: $BUNDLE_VERSION"; \
/usr/local/apache-maven-3.9.14/bin/mvn -B org.eclipse.tycho:tycho-versions-plugin:4.0.7:set-version \
-DnewVersion=$BUNDLE_VERSION ;; \
esac
RUN /usr/local/apache-maven-3.9.14/bin/mvn -B clean install -DskipTests=true
# Download maven index data
WORKDIR /maven-index-data
RUN set -e; \
Expand Down Expand Up @@ -56,8 +65,9 @@ COPY hack/maven.default.index /usr/local/etc/maven.default.index
COPY --from=jdtls-download /jdtls /jdtls/
COPY --from=addon-build /usr/local/apache-maven-3.9.14/ /usr/local/apache-maven-3.9.14/
RUN ln -s /usr/local/apache-maven-3.9.14/bin/mvn /usr/bin/mvn
COPY --from=addon-build /root/.m2/repository/io/konveyor/tackle/java-analyzer-bundle.core/1.0.0-SNAPSHOT/java-analyzer-bundle.core-1.0.0-SNAPSHOT.jar /jdtls/plugins/
COPY --from=addon-build /root/.m2/repository/io/konveyor/tackle/java-analyzer-bundle.core/1.0.0-SNAPSHOT/java-analyzer-bundle.core-1.0.0-SNAPSHOT.jar /jdtls/java-analyzer-bundle/java-analyzer-bundle.core/target/java-analyzer-bundle.core-1.0.0-SNAPSHOT.jar
ARG BUNDLE_VERSION=1.1.0-SNAPSHOT
COPY --from=addon-build /root/.m2/repository/io/konveyor/tackle/java-analyzer-bundle.core/${BUNDLE_VERSION}/java-analyzer-bundle.core-${BUNDLE_VERSION}.jar /jdtls/plugins/
COPY --from=addon-build /root/.m2/repository/io/konveyor/tackle/java-analyzer-bundle.core/${BUNDLE_VERSION}/java-analyzer-bundle.core-${BUNDLE_VERSION}.jar /jdtls/java-analyzer-bundle/java-analyzer-bundle.core/target/java-analyzer-bundle.core-${BUNDLE_VERSION}.jar
COPY --from=fernflower /output/fernflower.jar /bin/fernflower.jar
COPY --from=addon-build /maven-index-data/central.archive-metadata.txt /usr/local/etc/maven-index.txt

Expand Down
3 changes: 2 additions & 1 deletion Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@ COPY --from=index-download /maven-index-data/central.archive-metadata.idx /usr/l
RUN microdnf install -y golang

RUN ln -sf /root/.m2 /.m2 && chgrp -R 0 /root && chmod -R g=u /root
COPY java-analyzer-bundle.core/target/java-analyzer-bundle.core-1.0.0-SNAPSHOT.jar /jdtls/plugins/
ARG BUNDLE_VERSION=1.1.0-SNAPSHOT
COPY java-analyzer-bundle.core/target/java-analyzer-bundle.core-${BUNDLE_VERSION}.jar /jdtls/plugins/
CMD [ "/jdtls/bin/jdtls" ]
31 changes: 26 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Makefile for Java Analyzer Bundle
# Replicates GitHub Actions CI/CD pipeline for local verification

.PHONY: help all ci clean clean-containers clean-go phase1 phase2 unit-tests build-container run-integration-tests
.PHONY: help all ci clean clean-containers clean-go phase1 phase2 unit-tests build-container run-integration-tests set-version

# Detect container runtime (prefer Podman, fallback to Docker)
CONTAINER_RUNTIME := $(shell command -v podman 2>/dev/null || command -v docker 2>/dev/null)
Expand All @@ -20,6 +20,8 @@ endif
IMAGE_NAME := jdtls-analyzer:test
REPO_ROOT := $(shell pwd)
GO_MODULE := java-analyzer-bundle.test/integration
BUNDLE_VERSION ?= 1.1.0-SNAPSHOT
TYCHO_VERSION := 4.0.7

# Default target
help:
Expand All @@ -40,11 +42,19 @@ help:
@echo " make build-container - Build JDT.LS container image"
@echo " make run-integration-tests - Run integration tests in container"
@echo ""
@echo "Version targets:"
@echo " make set-version - Set bundle version (uses BUNDLE_VERSION)"
@echo ""
@echo "Utility targets:"
@echo " make clean - Clean all build artifacts"
@echo " make clean-containers - Remove container images"
@echo " make clean-go - Clean Go build artifacts"
@echo ""
@echo "Variables:"
@echo " BUNDLE_VERSION - Bundle version (default: 1.1.0-SNAPSHOT)"
@echo " Set to release version for non-SNAPSHOT builds"
@echo " Example: make ci BUNDLE_VERSION=1.2.0"
@echo ""
@echo "Container runtime: $(CONTAINER_RUNTIME)"
@echo "======================================================================"

Expand Down Expand Up @@ -72,10 +82,21 @@ phase2: build-container run-integration-tests
@echo "✓ Phase 2 Complete: Integration tests passed"
@echo "======================================================================"

# Version management
set-version:
ifeq ($(findstring -SNAPSHOT,$(BUNDLE_VERSION)),)
@echo "======================================================================"
@echo "Setting release version: $(BUNDLE_VERSION)"
@echo "======================================================================"
mvn -B org.eclipse.tycho:tycho-versions-plugin:$(TYCHO_VERSION):set-version -DnewVersion=$(BUNDLE_VERSION)
else
@echo "Using SNAPSHOT version: $(BUNDLE_VERSION)"
endif

# Phase 1 Targets
unit-tests:
unit-tests: set-version
@echo "======================================================================"
@echo "Phase 1: Running Unit Tests"
@echo "Phase 1: Running Unit Tests (version: $(BUNDLE_VERSION))"
@echo "======================================================================"
@echo ""
mvn clean integration-test
Expand All @@ -84,12 +105,12 @@ unit-tests:
build-container:
@echo ""
@echo "======================================================================"
@echo "Phase 2: Building JDT.LS Container Image"
@echo "Phase 2: Building JDT.LS Container Image (version: $(BUNDLE_VERSION))"
@echo "======================================================================"
@echo ""
@echo "Using container runtime: $(CONTAINER_RUNTIME)"
@echo ""
$(CONTAINER_RUNTIME) build -t $(IMAGE_NAME) -f Dockerfile.test .
$(CONTAINER_RUNTIME) build -t $(IMAGE_NAME) -f Dockerfile.test --build-arg BUNDLE_VERSION=$(BUNDLE_VERSION) .
@echo ""
@echo "✓ Container image built: $(IMAGE_NAME)"

Expand Down
2 changes: 1 addition & 1 deletion java-analyzer-bundle.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: java-analyzer-bundle Core Extension
Bundle-SymbolicName: java-analyzer-bundle.core;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 1.1.0.qualifier
Bundle-Activator: io.konveyor.tackle.core.internal.ExtensionActivator
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.jdt.ls.core,
Expand Down
2 changes: 1 addition & 1 deletion java-analyzer-bundle.core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>java-analyzer-bundle</artifactId>
<groupId>io.konveyor.tackle</groupId>
<version>1.0.0-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>java-analyzer-bundle.core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion java-analyzer-bundle.site/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>java-analyzer-bundle</artifactId>
<groupId>io.konveyor.tackle</groupId>
<version>1.0.0-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
</parent>
<artifactId>java-analyzer-bundle.site</artifactId>
<packaging>eclipse-repository</packaging>
Expand Down
4 changes: 2 additions & 2 deletions java-analyzer-bundle.test/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: java-analyzer-bundle Test Fragment
Bundle-SymbolicName: java-analyzer-bundle.test
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 1.1.0.qualifier
Fragment-Host: java-analyzer-bundle.core;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-21
Require-Bundle: org.eclipse.jdt.junit4.runtime;bundle-version="1.1.0",
org.apache.commons.io,
org.apache.commons.lang3,
org.junit;bundle-version="4.12",
org.eclipse.m2e.core,
org.eclipse.buildship.core
org.eclipse.buildship.core
Loading
Loading