Skip to content

Commit

Permalink
Add quarkus.antora.image configuration parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
ppalaga committed Sep 20, 2024
1 parent 0c75a55 commit a1f2da0
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.jboss.logging.Logger;
import org.yaml.snakeyaml.Yaml;

import io.quarkiverse.antora.FixedConfig;
import io.quarkus.deployment.IsDevelopment;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
Expand Down Expand Up @@ -52,6 +53,7 @@ void watchResources(BuildProducer<HotDeploymentWatchedFileBuildItem> watchedFile

@BuildStep
void buildAntoraSite(
FixedConfig fixedConfig,
BuildSystemTargetBuildItem buildSystemTarget,
BuildProducer<GeneratedWebResourceBuildItem> staticResourceProducer) {

Expand All @@ -78,7 +80,7 @@ void buildAntoraSite(
}
}

buildWithContainer(gitRepoRoot, antoraPlaybookPath);
buildWithContainer(fixedConfig.image(), gitRepoRoot, antoraPlaybookPath);

try (Stream<Path> files = Files.walk(pbInfo.outDir)) {
files.forEach(absP -> {
Expand Down Expand Up @@ -125,9 +127,9 @@ void buildAntoraSite(

}

private void buildWithContainer(final Path gitRepoRoot, final Path antoraPlaybookPath) {
private void buildWithContainer(String antoraImageName, final Path gitRepoRoot, final Path antoraPlaybookPath) {
try {
new NativeImageBuildRunner().build(gitRepoRoot, antoraPlaybookPath);
new NativeImageBuildRunner().build(antoraImageName, gitRepoRoot, antoraPlaybookPath);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public NativeImageBuildRunner() {
containerName = "antora-" + RandomStringUtils.random(5, true, false);
}

public void build(Path outputDir, Path antoraPlaybookPath)
public void build(String antoraImageName, Path outputDir, Path antoraPlaybookPath)
throws InterruptedException, IOException {

final List<String> cmd = new ArrayList<>();
Expand Down Expand Up @@ -88,7 +88,7 @@ public void build(Path outputDir, Path antoraPlaybookPath)
cmd.add("--name");
cmd.add(containerName);

cmd.add("docker.io/antora/antora:3.0.1");
cmd.add(antoraImageName);

cmd.add("--cache-dir=./antora-cache");
cmd.add(antoraPlaybookPath.toString());
Expand Down
32 changes: 32 additions & 0 deletions docs/modules/ROOT/pages/includes/quarkus-antora.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
:summaryTableId: quarkus-antora_quarkus-antora
[.configuration-legend]
icon:lock[title=Fixed at build time] Configuration property fixed at build time - All other configuration properties are overridable at runtime
[.configuration-reference.searchable, cols="80,.^10,.^10"]
|===

h|[.header-title]##Configuration property##
h|Type
h|Default

a|icon:lock[title=Fixed at build time] [[quarkus-antora_quarkus-antora-image]] [.property-path]##`quarkus.antora.image`##

[.description]
--
The fully qualified name of the Antora container image to use for generating the documentation site.
Example: `docker.io/antora/antora:3.0.1`


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_ANTORA_IMAGE+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_ANTORA_IMAGE+++`
endif::add-copy-button-to-env-var[]
--
|string
|`docker.io/antora/antora:3.0.1`

|===


:!summaryTableId:
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
:summaryTableId: quarkus-antora_quarkus-antora
[.configuration-legend]
icon:lock[title=Fixed at build time] Configuration property fixed at build time - All other configuration properties are overridable at runtime
[.configuration-reference.searchable, cols="80,.^10,.^10"]
|===

h|[.header-title]##Configuration property##
h|Type
h|Default

a|icon:lock[title=Fixed at build time] [[quarkus-antora_quarkus-antora-image]] [.property-path]##`quarkus.antora.image`##

[.description]
--
The fully qualified name of the Antora container image to use for generating the documentation site.
Example: `docker.io/antora/antora:3.0.1`


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_ANTORA_IMAGE+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_ANTORA_IMAGE+++`
endif::add-copy-button-to-env-var[]
--
|string
|`docker.io/antora/antora:3.0.1`

|===


:!summaryTableId:
4 changes: 4 additions & 0 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,7 @@ Then the page should get loaded with the new title "I love Antora".
image::live-edit.png[optional attribute,optional attribute]

Once you are done with editing, hit `Q` or `CRTL+C` to exit the dev mode.

== Configuration

include::./includes/quarkus-antora.adoc[]
19 changes: 19 additions & 0 deletions docs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,25 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-config-doc-maven-plugin</artifactId>
<version>${quarkus.version}</version>
<executions>
<execution>
<id>generate-config-doc</id>
<phase>process-resources</phase>
<goals>
<goal>generate-asciidoc</goal>
</goals>
<configuration>
<skip>${skipDocs}</skip>
<enableEnumTooltips>true</enableEnumTooltips>
<targetDirectory>${project.basedir}/modules/ROOT/pages/includes</targetDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
24 changes: 24 additions & 0 deletions runtime/src/main/java/io/quarkiverse/antora/FixedConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package io.quarkiverse.antora;

import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;

/**
* Quarkus Antora build time configuration options that are also available at runtime but only in read-only mode.
*/
@ConfigMapping(prefix = "quarkus.antora")
@ConfigRoot(phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED)
public interface FixedConfig {

/**
* The fully qualified name of the Antora container image to use for generating the documentation site.
* Example: `docker.io/antora/antora:3.0.1`
*
* @asciidoclet
* @since 0.0.5
*/
@WithDefault("docker.io/antora/antora:3.0.1")
String image();
}

0 comments on commit a1f2da0

Please sign in to comment.