From 308d65649b74b00375a8f55f2b4137f853ff44aa Mon Sep 17 00:00:00 2001 From: Andy Damevin Date: Wed, 26 Nov 2025 12:13:42 +0100 Subject: [PATCH 1/5] Add support for custom repositories --- deploy/build_deploy.sh | 9 +- justfile | 12 +- pom.xml | 3 +- src/main/java/GlobalConstants.java | 14 +++ src/main/java/IBMConstants.java | 69 ++++++++++ src/main/java/OfferingPlatformOverride.java | 118 +++++++----------- src/main/java/RedHatCamelConstants.java | 41 ++++++ src/main/java/RedHatConstants.java | 38 ++++++ src/main/resources/application.properties | 11 +- src/main/resources/web/redhat-app/theme.scss | 7 +- .../resources/web/redhat-camel-app/theme.scss | 7 +- src/test/java/IBMOfferingTest.java | 24 ++++ ...rightTest.java => PlaywrightTestBase.java} | 12 +- src/test/java/RedHatCamelOfferingTest.java | 30 +++++ src/test/java/RedHatOfferingTest.java | 24 ++++ 15 files changed, 319 insertions(+), 100 deletions(-) create mode 100644 src/main/java/GlobalConstants.java create mode 100644 src/main/java/IBMConstants.java create mode 100644 src/main/java/RedHatCamelConstants.java create mode 100644 src/main/java/RedHatConstants.java create mode 100644 src/test/java/IBMOfferingTest.java rename src/test/java/{CodeQuarkusRedHatPlaywrightTest.java => PlaywrightTestBase.java} (87%) create mode 100644 src/test/java/RedHatCamelOfferingTest.java create mode 100644 src/test/java/RedHatOfferingTest.java diff --git a/deploy/build_deploy.sh b/deploy/build_deploy.sh index ed2f9d3..09b369c 100755 --- a/deploy/build_deploy.sh +++ b/deploy/build_deploy.sh @@ -7,7 +7,14 @@ GIT_REV_SHORT=$(git rev-parse --short=7 HEAD) IMAGE=${IMAGE-"quay.io/redhat-developer/code-quarkus"} IMAGE_TAG=${IMAGE_TAG-$GIT_REV_SHORT} -docker build --compress -f docker/Dockerfile.redhat-app.multistage --build-arg MAVEN_BUILD_EXTRA_ARGS="-Dgit.commit.id=$GIT_REV" -t "${IMAGE}:${IMAGE_TAG}" . +STAGE=false + +if [[ $(git --no-pager log --oneline -1) == *[STAGE]* ]]; then + echo "This is commit is flagged with [STAGE] and won't go to production" + STAGE=true +fi + +docker build --compress -f docker/Dockerfile.redhat-app.multistage --build-arg MAVEN_BUILD_EXTRA_ARGS="-Dgit.commit.id=$GIT_REV -Dio.quarkus.code.build.stage=$STAGE"" -t "${IMAGE}:${IMAGE_TAG}" . if [[ -n "$QUAY_USER" && -n "$QUAY_TOKEN" ]]; then DOCKER_CONF="$PWD/.docker" diff --git a/justfile b/justfile index 6e112df..bb320f7 100644 --- a/justfile +++ b/justfile @@ -6,25 +6,25 @@ export QUARKUS_REGISTRY_REGISTRY_QUARKUS_IO_RECOMMEND_STREAMS_FROM_COM_REDHAT_QU dev-rh: - export IO_QUARKUS_CODE_OFFERING_SUPPORT_TAG="redhat-support" + export QUARKUS_REGISTRY_REGISTRY_QUARKUS_REDHAT_COM_OFFERING="redhat" quarkus dev -Dquarkus.profile=dev,redhat dev-ibm: - export IO_QUARKUS_CODE_OFFERING_SUPPORT_TAG="ibm-support" + export QUARKUS_REGISTRY_REGISTRY_QUARKUS_REDHAT_COM_OFFERING="ibm" quarkus dev -Dquarkus.profile=dev,ibm dev-camel: - export IO_QUARKUS_CODE_OFFERING_SUPPORT_TAG="camel-support" + export QUARKUS_REGISTRY_REGISTRY_QUARKUS_REDHAT_COM_OFFERING="redhat-camel" quarkus dev -Dquarkus.profile=dev,redhat-camel build: quarkus build -DskipTests start-ibm: - export IO_QUARKUS_CODE_OFFERING_SUPPORT_TAG="ibm-support" + export QUARKUS_REGISTRY_REGISTRY_QUARKUS_REDHAT_COM_OFFERING="ibm" QUARKUS_PROFILE="prod,ibm" java -jar target/quarkus-app/quarkus-run.jar start-rh: - export IO_QUARKUS_CODE_OFFERING_SUPPORT_TAG="redhat-support" + export QUARKUS_REGISTRY_REGISTRY_QUARKUS_REDHAT_COM_OFFERING="redhat" QUARKUS_PROFILE="prod,redhat" java -jar target/quarkus-app/quarkus-run.jar start-camel: - export IO_QUARKUS_CODE_OFFERING_SUPPORT_TAG="redhat-camel-support" + export QUARKUS_REGISTRY_REGISTRY_QUARKUS_REDHAT_COM_OFFERING="redhat-camel" QUARKUS_PROFILE="prod,redhat-camel" java -jar target/quarkus-app/quarkus-run.jar diff --git a/pom.xml b/pom.xml index e3bbf69..23f52de 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.quarkus.code code-quarkus-parent - 59 + 61 code-quarkus-redhat-app @@ -151,6 +151,7 @@ ${maven.home} + diff --git a/src/main/java/GlobalConstants.java b/src/main/java/GlobalConstants.java new file mode 100644 index 0000000..3e18655 --- /dev/null +++ b/src/main/java/GlobalConstants.java @@ -0,0 +1,14 @@ +import java.util.Set; + +class GlobalConstants { + + private GlobalConstants() { + } + + static final String ICONS_ASSETS_URL = "/assets/icons"; + + static final Set TAGS = Set.of( + "with:starter-code", "status:stable", "status:preview", "status:experimental", "status:deprecated", + "support:full-support", "support:supported-in-jvm", "support:dev-support", "support:tech-preview", + "support:deprecated"); +} diff --git a/src/main/java/IBMConstants.java b/src/main/java/IBMConstants.java new file mode 100644 index 0000000..bef3885 --- /dev/null +++ b/src/main/java/IBMConstants.java @@ -0,0 +1,69 @@ +import io.quarkus.code.model.Preset; + +import java.util.List; + +class IBMConstants { + + private IBMConstants() { + } + + public static final List IBM_PRESETS = List.of( + // Some presets are duplicated to support platforms before and after the Big Reactive Renaming + new Preset("rest-service", "REST service", + GlobalConstants.ICONS_ASSETS_URL + "/ibm-presets/rest-service.svg", + List.of("io.quarkus:quarkus-rest")), + new Preset("db-service", "REST service with database", + GlobalConstants.ICONS_ASSETS_URL + "/ibm-presets/db-service.svg", + List.of("io.quarkus:quarkus-rest", "io.quarkus:quarkus-rest-jackson", + "io.quarkus:quarkus-hibernate-orm-panache", "io.quarkus:quarkus-jdbc-postgresql")), + new Preset("event-driven-kafka", "Event driven service with Kafka", + GlobalConstants.ICONS_ASSETS_URL + "/ibm-presets/event-driven.svg", + List.of("io.quarkus:quarkus-messaging-kafka")), + new Preset("cli", "Command-line tool", + GlobalConstants.ICONS_ASSETS_URL + "/ibm-presets/cli.svg", + List.of("io.quarkus:quarkus-picocli")), + new Preset("webapp-mvc", "Web app with Model-View-Controller", + GlobalConstants.ICONS_ASSETS_URL + "/ibm-presets/webapp-mvc.svg", + List.of("io.quarkiverse.renarde:quarkus-renarde", "io.quarkiverse.web-bundler:quarkus-web-bundler")), + new Preset("webapp-npm", "Web app with NPM UI", + GlobalConstants.ICONS_ASSETS_URL + "/ibm-presets/webapp-npm.svg", + List.of("io.quarkus:quarkus-rest", "io.quarkus:quarkus-rest-jackson", + "io.quarkiverse.quinoa:quarkus-quinoa")), + new Preset("webapp-qute", "Web app with ServerSide Rendering", + GlobalConstants.ICONS_ASSETS_URL + "/ibm-presets/webapp-qute.svg", + List.of("io.quarkiverse.qute.web:quarkus-qute-web", "io.quarkiverse.web-bundler:quarkus-web-bundler")), + new Preset("ai-infused", "AI Infused service", + GlobalConstants.ICONS_ASSETS_URL + "/ibm-presets/ai-infused.svg", + List.of("io.quarkiverse.langchain4j:quarkus-langchain4j-openai", + "io.quarkiverse.langchain4j:quarkus-langchain4j-easy-rag"))); + + //language=xml + static final List IBM_POM_REPOSITORIES = """ + + + ibm-enterprise-maven-repository + https://maven.repository.ibm.com/releases/ + + true + + + true + + + + + + ibm-enterprise-maven-repository + https://maven.repository.ibm.com/releases/ + + true + + + true + + + + + """.lines().toList(); + +} diff --git a/src/main/java/OfferingPlatformOverride.java b/src/main/java/OfferingPlatformOverride.java index 8ec5104..39f0135 100644 --- a/src/main/java/OfferingPlatformOverride.java +++ b/src/main/java/OfferingPlatformOverride.java @@ -1,90 +1,29 @@ import io.quarkus.code.model.CodeQuarkusExtension; import io.quarkus.code.model.Preset; +import io.quarkus.code.model.ProjectDefinition; import io.quarkus.code.service.PlatformOverride; import io.quarkus.code.service.PlatformService; import jakarta.inject.Inject; import jakarta.inject.Singleton; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardOpenOption; import java.util.List; import java.util.Objects; +import java.util.OptionalInt; import java.util.Set; import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.IntStream; @Singleton public class OfferingPlatformOverride implements PlatformOverride { - public static final String ICONS_ASSETS_URL = "/assets/icons"; - - public static final List IBM_PRESETS = List.of( - // Some presets are duplicated to support platforms before and after the Big Reactive Renaming - new Preset("rest-service", "REST service", - ICONS_ASSETS_URL + "/ibm-presets/rest-service.svg", - List.of("io.quarkus:quarkus-rest")), - new Preset("db-service", "REST service with database", - ICONS_ASSETS_URL + "/ibm-presets/db-service.svg", - List.of("io.quarkus:quarkus-rest", "io.quarkus:quarkus-rest-jackson", - "io.quarkus:quarkus-hibernate-orm-panache", "io.quarkus:quarkus-jdbc-postgresql")), - new Preset("event-driven-kafka", "Event driven service with Kafka", - ICONS_ASSETS_URL + "/ibm-presets/event-driven.svg", - List.of("io.quarkus:quarkus-messaging-kafka")), - new Preset("cli", "Command-line tool", - ICONS_ASSETS_URL + "/ibm-presets/cli.svg", - List.of("io.quarkus:quarkus-picocli")), - new Preset("webapp-mvc", "Web app with Model-View-Controller", - ICONS_ASSETS_URL + "/ibm-presets/webapp-mvc.svg", - List.of("io.quarkiverse.renarde:quarkus-renarde", "io.quarkiverse.web-bundler:quarkus-web-bundler")), - new Preset("webapp-npm", "Web app with NPM UI", - ICONS_ASSETS_URL + "/ibm-presets/webapp-npm.svg", - List.of("io.quarkus:quarkus-rest", "io.quarkus:quarkus-rest-jackson", - "io.quarkiverse.quinoa:quarkus-quinoa")), - new Preset("webapp-qute", "Web app with ServerSide Rendering", - ICONS_ASSETS_URL + "/ibm-presets/webapp-qute.svg", - List.of("io.quarkiverse.qute.web:quarkus-qute-web", "io.quarkiverse.web-bundler:quarkus-web-bundler")), - new Preset("ai-infused", "AI Infused service", - ICONS_ASSETS_URL + "/ibm-presets/ai-infused.svg", - List.of("io.quarkiverse.langchain4j:quarkus-langchain4j-openai", - "io.quarkiverse.langchain4j:quarkus-langchain4j-easy-rag"))); - - public static final List REDHAT_CAMEL_PRESETS = List.of( - // Some presets are duplicated to support platforms before and after the Big Reactive Renaming - new Preset("web-service", "Web service", - ICONS_ASSETS_URL + "/redhat-camel-presets/orange-rest_pos.svg", - List.of("org.apache.camel.quarkus:camel-quarkus-rest", - "org.apache.camel.quarkus:camel-quarkus-rest-openapi", - "org.apache.camel.quarkus:camel-quarkus-cxf-soap", - "io.quarkiverse.cxf:quarkus-cxf")), - new Preset("db-service", "REST service with database", - ICONS_ASSETS_URL + "/redhat-camel-presets/orange-db-service_pos.svg", - List.of("org.apache.camel.quarkus:camel-quarkus-rest", - "org.apache.camel.quarkus:camel-quarkus-aws2-ddb", - "org.apache.camel.quarkus:camel-quarkus-cassandraql", - "org.apache.camel.quarkus:camel-quarkus-jdbc", - "org.apache.camel.quarkus:camel-quarkus-jpa", - "org.apache.camel.quarkus:camel-quarkus-kudu", - "org.apache.camel.quarkus:camel-quarkus-ldap", - "org.apache.camel.quarkus:camel-quarkus-mongodb", - "org.apache.camel.quarkus:camel-quarkus-mybatis", - "org.apache.camel.quarkus:camel-quarkus-sql")), - new Preset("event-driven-kafka", "Event driven service with Kafka", - ICONS_ASSETS_URL + "/redhat-camel-presets/orange-event-driven-kafka_pos.svg", - List.of("org.apache.camel.quarkus:camel-quarkus-kafka", - "org.apache.camel.quarkus:camel-quarkus-jms")), - new Preset("ai-infused", "AI Infused service", - ICONS_ASSETS_URL + "/redhat-camel-presets/orange-ai-infused_pos.svg", - List.of("org.apache.camel.quarkus:camel-quarkus-langchain4j-agent", - "org.apache.camel.quarkus:camel-quarkus-langchain4j-chat", - "org.apache.camel.quarkus:camel-quarkus-langchain4j-tokenizer", - "org.apache.camel.quarkus:camel-quarkus-langchain4j-tools", - "org.apache.camel.quarkus:camel-quarkus-langchain4j-web-search"))); - @Inject OfferingConfig config; - private static final Set TAGS = Set.of( - "with:starter-code", "status:stable", "status:preview", "status:experimental", "status:deprecated", - "support:full-support", "support:supported-in-jvm", "support:dev-support", "support:tech-preview", - "support:deprecated"); - @Override public Function extensionMapper() { return Function.identity(); @@ -94,9 +33,9 @@ public Function extensionMapper() { public List presets() { switch (config.id()) { case "ibm": - return IBM_PRESETS; + return IBMConstants.IBM_PRESETS; case "redhat-camel": - return REDHAT_CAMEL_PRESETS; + return RedHatCamelConstants.REDHAT_CAMEL_PRESETS; default: return PlatformService.DEFAULT_PRESETS.stream() .map(p -> new Preset(p.key(), p.title(), p.icon().replace("_neg", "_pos"), p.extensions())) @@ -104,9 +43,44 @@ public List presets() { } } + @Override + public void onNewProject(ProjectDefinition projectDefinition, Path dir) { + final List repositories = getRepositories(); + if (repositories == null) { + return; + } + final Path pom = dir.resolve("pom.xml"); + if (Files.isRegularFile(pom)) { + try { + final List strings = Files.readAllLines(pom); + if (strings.stream().anyMatch(s -> s.contains(""))) { + return; + } + OptionalInt lineNumber = IntStream.range(0, strings.size()) + .filter(i -> strings.get(i).contains("")) + .findFirst(); + if (lineNumber.isEmpty()) { + throw new RuntimeException( + "Platform generated pom.xml is not valid, please, report this error to the administrator."); + } + strings.addAll(lineNumber.getAsInt(), repositories); + Files.writeString(pom, String.join("\n", strings), StandardOpenOption.TRUNCATE_EXISTING); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + } + + private List getRepositories() { + return switch (config.id()) { + case "ibm" -> IBMConstants.IBM_POM_REPOSITORIES; + default -> null; + }; + } + @Override public List extensionTagsMapper(List tags) { - return tags.stream().map(this::mapTag).filter(Objects::nonNull).filter(TAGS::contains).toList(); + return tags.stream().map(this::mapTag).filter(Objects::nonNull).filter(GlobalConstants.TAGS::contains).toList(); } private String mapTag(String s) { diff --git a/src/main/java/RedHatCamelConstants.java b/src/main/java/RedHatCamelConstants.java new file mode 100644 index 0000000..2eeab58 --- /dev/null +++ b/src/main/java/RedHatCamelConstants.java @@ -0,0 +1,41 @@ +import io.quarkus.code.model.Preset; + +import java.util.List; + +public class RedHatCamelConstants { + + private RedHatCamelConstants() { + } + + static final List REDHAT_CAMEL_PRESETS = List.of( + // Some presets are duplicated to support platforms before and after the Big Reactive Renaming + new Preset("web-service", "Web service", + GlobalConstants.ICONS_ASSETS_URL + "/redhat-camel-presets/orange-rest_pos.svg", + List.of("org.apache.camel.quarkus:camel-quarkus-rest", + "org.apache.camel.quarkus:camel-quarkus-rest-openapi", + "org.apache.camel.quarkus:camel-quarkus-cxf-soap", + "io.quarkiverse.cxf:quarkus-cxf")), + new Preset("db-service", "REST service with database", + GlobalConstants.ICONS_ASSETS_URL + "/redhat-camel-presets/orange-db-service_pos.svg", + List.of("org.apache.camel.quarkus:camel-quarkus-rest", + "org.apache.camel.quarkus:camel-quarkus-aws2-ddb", + "org.apache.camel.quarkus:camel-quarkus-cassandraql", + "org.apache.camel.quarkus:camel-quarkus-jdbc", + "org.apache.camel.quarkus:camel-quarkus-jpa", + "org.apache.camel.quarkus:camel-quarkus-kudu", + "org.apache.camel.quarkus:camel-quarkus-ldap", + "org.apache.camel.quarkus:camel-quarkus-mongodb", + "org.apache.camel.quarkus:camel-quarkus-mybatis", + "org.apache.camel.quarkus:camel-quarkus-sql")), + new Preset("event-driven-kafka", "Event driven service with Kafka", + GlobalConstants.ICONS_ASSETS_URL + "/redhat-camel-presets/orange-event-driven-kafka_pos.svg", + List.of("org.apache.camel.quarkus:camel-quarkus-kafka", + "org.apache.camel.quarkus:camel-quarkus-jms")), + new Preset("ai-infused", "AI Infused service", + GlobalConstants.ICONS_ASSETS_URL + "/redhat-camel-presets/orange-ai-infused_pos.svg", + List.of("org.apache.camel.quarkus:camel-quarkus-langchain4j-agent", + "org.apache.camel.quarkus:camel-quarkus-langchain4j-chat", + "org.apache.camel.quarkus:camel-quarkus-langchain4j-tokenizer", + "org.apache.camel.quarkus:camel-quarkus-langchain4j-tools", + "org.apache.camel.quarkus:camel-quarkus-langchain4j-web-search"))); +} diff --git a/src/main/java/RedHatConstants.java b/src/main/java/RedHatConstants.java new file mode 100644 index 0000000..d09cf31 --- /dev/null +++ b/src/main/java/RedHatConstants.java @@ -0,0 +1,38 @@ +import io.quarkus.code.model.Preset; + +import java.util.List; + +public class RedHatConstants { + + private RedHatConstants() { + } + + //language=xml + static final List REDHAT_POM_REPOSITORIES = """ + + + red-hat-enterprise-maven-repository + https://maven.repository.redhat.com/ga/ + + true + + + true + + + + + + red-hat-enterprise-maven-repository + https://maven.repository.redhat.com/ga/ + + true + + + true + + + + + """.lines().toList(); +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index ba767bd..31fe163 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,17 +1,14 @@ io.quarkus.code.git-commit-id=${git.commit.id} -quarkus.web-bundler.bundle.lib=true quarkus.web-bundler.bundle.community-app=false quarkus.web-bundler.bundle.ibm-app=true -quarkus.web-bundler.bundle.ibm-app.key=ibm quarkus.web-bundler.bundle.redhat-camel-app=true -quarkus.web-bundler.bundle.redhat-camel-app.key=camel +quarkus.web-bundler.bundle.redhat-camel-app.key=redhat-camel quarkus.web-bundler.bundle.redhat-camel-app.dir=redhat-camel-app quarkus.web-bundler.bundle.redhat-app=true -quarkus.web-bundler.bundle.redhat-app.key=redhat io.quarkus.code.offering=redhat io.quarkus.code.offering.support-tag=redhat-support @@ -21,7 +18,7 @@ block-static-name=ibm %redhat-camel.io.quarkus.code.offering=redhat-camel %redhat-camel.io.quarkus.code.offering.support-tag=redhat-camel-support -%redhat-camel.io.quarkus.code.ui.name=code.quarkus-camel.redhat.com +%redhat-camel.io.quarkus.code.ui.name=code.camel.redhat.com %redhat-camel.io.quarkus.code.ui.favicon=https://camel.apache.org/favicon-96x96.png %ibm.io.quarkus.code.offering=ibm @@ -30,8 +27,8 @@ block-static-name=ibm %ibm.io.quarkus.code.ui.favicon=https://www.ibm.com/content/dam/adobe-cms/default-images/icon-32x32.png %ibm.block-static-name=redhat -io.quarkus.code.ui.id=${io.quarkus.code.offering} -%redhat-camel.io.quarkus.code.ui.id=camel +io.quarkus.code.ui.id=${io.quarkus.code.offering}-app +%redhat-camel.io.quarkus.code.ui.id=redhat-camel io.quarkus.code.quarkus-platforms.registry-id=registry.quarkus.redhat.com %test.io.quarkus.code.quarkus-platforms.registry-id= diff --git a/src/main/resources/web/redhat-app/theme.scss b/src/main/resources/web/redhat-app/theme.scss index 1185353..39676cc 100644 --- a/src/main/resources/web/redhat-app/theme.scss +++ b/src/main/resources/web/redhat-app/theme.scss @@ -1,7 +1,8 @@ +@use "./red-hat-font.scss" as redhatFont; +@include redhatFont.printRedHatFont(400, "Regular", $familyName: "RedHatText", $relative: false); +@include redhatFont.printRedHatFont(700, "Medium", $familyName: "RedHatText", $relative: false); @import url(https://fonts.googleapis.com/css?family=PT+Mono); -@import "./red-hat-font.scss"; -@include printRedHatFont(400, "Regular", $familyName: "RedHatText", $relative: false); -@include printRedHatFont(700, "Medium", $familyName: "RedHatText", $relative: false); + :root { diff --git a/src/main/resources/web/redhat-camel-app/theme.scss b/src/main/resources/web/redhat-camel-app/theme.scss index 0b0c585..0985d5c 100644 --- a/src/main/resources/web/redhat-camel-app/theme.scss +++ b/src/main/resources/web/redhat-camel-app/theme.scss @@ -1,7 +1,8 @@ +@use "./red-hat-font.scss" as redhatFont; +@include redhatFont.printRedHatFont(400, "Regular", $familyName: "RedHatText", $relative: false); +@include redhatFont.printRedHatFont(700, "Medium", $familyName: "RedHatText", $relative: false); @import url(https://fonts.googleapis.com/css?family=PT+Mono); -@import "./red-hat-font.scss"; -@include printRedHatFont(400, "Regular", $familyName: "RedHatText", $relative: false); -@include printRedHatFont(700, "Medium", $familyName: "RedHatText", $relative: false); + :root { diff --git a/src/test/java/IBMOfferingTest.java b/src/test/java/IBMOfferingTest.java new file mode 100644 index 0000000..c5dac20 --- /dev/null +++ b/src/test/java/IBMOfferingTest.java @@ -0,0 +1,24 @@ +import io.quarkiverse.playwright.WithPlaywright; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.QuarkusTestProfile; +import io.quarkus.test.junit.TestProfile; + +@QuarkusTest +@WithPlaywright(verbose = true) +@TestProfile(IBMOfferingTest.TestProfile.class) +public class IBMOfferingTest extends PlaywrightTestBase { + + @Override + String getTitle() { + return "Quarkus - Start coding with code.quarkus.ibm.com"; + } + + public static class TestProfile implements QuarkusTestProfile { + + @Override + public String getConfigProfile() { + return "test,ibm"; + } + } + +} diff --git a/src/test/java/CodeQuarkusRedHatPlaywrightTest.java b/src/test/java/PlaywrightTestBase.java similarity index 87% rename from src/test/java/CodeQuarkusRedHatPlaywrightTest.java rename to src/test/java/PlaywrightTestBase.java index f5ec0dd..b23891c 100644 --- a/src/test/java/CodeQuarkusRedHatPlaywrightTest.java +++ b/src/test/java/PlaywrightTestBase.java @@ -2,10 +2,8 @@ import com.microsoft.playwright.Page; import com.microsoft.playwright.Response; import io.quarkiverse.playwright.InjectPlaywright; -import io.quarkiverse.playwright.WithPlaywright; import io.quarkus.code.service.PlatformService; import io.quarkus.test.common.http.TestHTTPResource; -import io.quarkus.test.junit.QuarkusTest; import jakarta.inject.Inject; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -15,9 +13,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -@QuarkusTest -@WithPlaywright(verbose = true) -public class CodeQuarkusRedHatPlaywrightTest { +public abstract class PlaywrightTestBase { public static final String LABEL_GENERATE_YOUR_APPLICATION = "[aria-label='Generate your application']"; public static final String LABEL_DOWNLOAD_THE_ZIP = "[aria-label='Download the zip']"; @@ -30,6 +26,8 @@ public class CodeQuarkusRedHatPlaywrightTest { @TestHTTPResource("/") URL index; + abstract String getTitle(); + @Test public void testIndex() { try (Page page = context.newPage()) { @@ -39,7 +37,7 @@ public void testIndex() { page.waitForLoadState(); String title = page.title(); - Assertions.assertEquals("Quarkus - Start coding with code.quarkus.redhat.com", title); + Assertions.assertEquals(getTitle(), title); } } @@ -71,7 +69,7 @@ private Page openIndex() { return page; } - private static void closeIntroductionModal(Page page) { + void closeIntroductionModal(Page page) { // Find the introduction modal close button page.waitForSelector("[aria-label='Close the introduction modal']").click(); } diff --git a/src/test/java/RedHatCamelOfferingTest.java b/src/test/java/RedHatCamelOfferingTest.java new file mode 100644 index 0000000..14a3946 --- /dev/null +++ b/src/test/java/RedHatCamelOfferingTest.java @@ -0,0 +1,30 @@ +import com.microsoft.playwright.Page; +import io.quarkiverse.playwright.WithPlaywright; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.QuarkusTestProfile; +import io.quarkus.test.junit.TestProfile; + +@QuarkusTest +@WithPlaywright(verbose = true) +@TestProfile(RedHatCamelOfferingTest.TestProfile.class) +public class RedHatCamelOfferingTest extends PlaywrightTestBase { + + @Override + String getTitle() { + return "Quarkus - Start coding with code.camel.redhat.com"; + } + + @Override + void closeIntroductionModal(Page page) { + + } + + public static class TestProfile implements QuarkusTestProfile { + + @Override + public String getConfigProfile() { + return "test,redhat-camel"; + } + } + +} diff --git a/src/test/java/RedHatOfferingTest.java b/src/test/java/RedHatOfferingTest.java new file mode 100644 index 0000000..39a0b34 --- /dev/null +++ b/src/test/java/RedHatOfferingTest.java @@ -0,0 +1,24 @@ +import io.quarkiverse.playwright.WithPlaywright; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.QuarkusTestProfile; +import io.quarkus.test.junit.TestProfile; + +@QuarkusTest +@WithPlaywright(verbose = true) +@TestProfile(RedHatOfferingTest.TestProfile.class) +public class RedHatOfferingTest extends PlaywrightTestBase { + + @Override + String getTitle() { + return "Quarkus - Start coding with code.quarkus.redhat.com"; + } + + public static class TestProfile implements QuarkusTestProfile { + + @Override + public String getConfigProfile() { + return "test,redhat"; + } + } + +} From 86a307d0bc6048d2401e16b31ef959d14a5a3fe1 Mon Sep 17 00:00:00 2001 From: Andy Damevin Date: Thu, 27 Nov 2025 18:45:45 +0100 Subject: [PATCH 2/5] Update deploy/build_deploy.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- deploy/build_deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/build_deploy.sh b/deploy/build_deploy.sh index 09b369c..b183dc5 100755 --- a/deploy/build_deploy.sh +++ b/deploy/build_deploy.sh @@ -10,7 +10,7 @@ IMAGE_TAG=${IMAGE_TAG-$GIT_REV_SHORT} STAGE=false if [[ $(git --no-pager log --oneline -1) == *[STAGE]* ]]; then - echo "This is commit is flagged with [STAGE] and won't go to production" + echo "This commit is flagged with [STAGE] and won't go to production" STAGE=true fi From 36502ff1c68dad1f614cd55ec8f77f309d0b4a75 Mon Sep 17 00:00:00 2001 From: Andy Damevin Date: Thu, 27 Nov 2025 18:46:30 +0100 Subject: [PATCH 3/5] Update deploy/build_deploy.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- deploy/build_deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/build_deploy.sh b/deploy/build_deploy.sh index b183dc5..1fadc27 100755 --- a/deploy/build_deploy.sh +++ b/deploy/build_deploy.sh @@ -14,7 +14,7 @@ if [[ $(git --no-pager log --oneline -1) == *[STAGE]* ]]; then STAGE=true fi -docker build --compress -f docker/Dockerfile.redhat-app.multistage --build-arg MAVEN_BUILD_EXTRA_ARGS="-Dgit.commit.id=$GIT_REV -Dio.quarkus.code.build.stage=$STAGE"" -t "${IMAGE}:${IMAGE_TAG}" . +docker build --compress -f docker/Dockerfile.redhat-app.multistage --build-arg MAVEN_BUILD_EXTRA_ARGS="-Dgit.commit.id=$GIT_REV -Dio.quarkus.code.build.stage=$STAGE" -t "${IMAGE}:${IMAGE_TAG}" . if [[ -n "$QUAY_USER" && -n "$QUAY_TOKEN" ]]; then DOCKER_CONF="$PWD/.docker" From 2268de77c5946b37c0ebe83d9fa3457cde68fddb Mon Sep 17 00:00:00 2001 From: Andy Damevin Date: Thu, 27 Nov 2025 18:58:12 +0100 Subject: [PATCH 4/5] Update src/main/java/OfferingPlatformOverride.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/main/java/OfferingPlatformOverride.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/OfferingPlatformOverride.java b/src/main/java/OfferingPlatformOverride.java index 39f0135..4d20afa 100644 --- a/src/main/java/OfferingPlatformOverride.java +++ b/src/main/java/OfferingPlatformOverride.java @@ -52,19 +52,19 @@ public void onNewProject(ProjectDefinition projectDefinition, Path dir) { final Path pom = dir.resolve("pom.xml"); if (Files.isRegularFile(pom)) { try { - final List strings = Files.readAllLines(pom); - if (strings.stream().anyMatch(s -> s.contains(""))) { + final List pomLines = Files.readAllLines(pom); + if (pomLines.stream().anyMatch(s -> s.contains(""))) { return; } - OptionalInt lineNumber = IntStream.range(0, strings.size()) - .filter(i -> strings.get(i).contains("")) + OptionalInt lineNumber = IntStream.range(0, pomLines.size()) + .filter(i -> pomLines.get(i).contains("")) .findFirst(); if (lineNumber.isEmpty()) { throw new RuntimeException( "Platform generated pom.xml is not valid, please, report this error to the administrator."); } - strings.addAll(lineNumber.getAsInt(), repositories); - Files.writeString(pom, String.join("\n", strings), StandardOpenOption.TRUNCATE_EXISTING); + pomLines.addAll(lineNumber.getAsInt(), repositories); + Files.writeString(pom, String.join("\n", pomLines), StandardOpenOption.TRUNCATE_EXISTING); } catch (IOException e) { throw new RuntimeException(e); } From bba6748e59d7c52e87eb69105b70c30f00357ed6 Mon Sep 17 00:00:00 2001 From: Andy Damevin Date: Thu, 27 Nov 2025 18:58:53 +0100 Subject: [PATCH 5/5] Minor --- src/main/java/OfferingPlatformOverride.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/OfferingPlatformOverride.java b/src/main/java/OfferingPlatformOverride.java index 4d20afa..2f15043 100644 --- a/src/main/java/OfferingPlatformOverride.java +++ b/src/main/java/OfferingPlatformOverride.java @@ -13,9 +13,7 @@ import java.util.List; import java.util.Objects; import java.util.OptionalInt; -import java.util.Set; import java.util.function.Function; -import java.util.stream.Collectors; import java.util.stream.IntStream; @Singleton