Skip to content

Commit

Permalink
Fixes for image tags. Parameters fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rnc committed Sep 30, 2024
1 parent f36217d commit ac0a46e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 35 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ dev-image:
echo "ERROR: QUAY_USERNAME is not set"; \
exit 1; \
fi
docker build . -t quay.io/$(QUAY_USERNAME)/hacbs-jvm-controller:dev
docker push quay.io/$(QUAY_USERNAME)/hacbs-jvm-controller:dev
docker build . -t quay.io/$(QUAY_USERNAME)/hacbs-jvm-controller:"$${JBS_QUAY_IMAGE_TAG:-dev}"
docker push quay.io/$(QUAY_USERNAME)/hacbs-jvm-controller:"$${JBS_QUAY_IMAGE_TAG:-dev}"

dev: dev-image
cd java-components && mvn clean install -Dlocal -DskipTests -Ddev
Expand Down
2 changes: 0 additions & 2 deletions deploy/tasks/pre-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ spec:
default: ""
- name: BUILD_SCRIPT
description: The build script to embed with the Containerfile
# - name: PREPROCESSOR_ARGS
# description: The arguments for the build preprocessor
- name: ORAS_OPTIONS
type: string
description: Optional environment variable string for build-trusted-artifacts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.nio.file.Paths;
import java.util.List;

import io.quarkus.logging.Log;
import picocli.CommandLine;

/**
Expand Down Expand Up @@ -37,12 +38,9 @@ protected enum ToolType {

@Override
public void run() {
System.err.println("### debug creating with tool " + type + " and recipe " + recipeImage);

Path artifactDirectory = Path.of(buildRoot.getParent().toString(), "artifacts");
Path jbsDirectory = Path.of(buildRoot.toString(), ".jbs");
//noinspection ResultOfMethodCallIgnored
jbsDirectory.toFile().mkdir();
jbsDirectory.toFile().mkdirs();

String containerFile = """
FROM %s
Expand All @@ -61,23 +59,24 @@ public void run() {
if (type == ToolType.ANT) {
// Don't think we need to mess with keystore as copy-artifacts is simply calling copy commands.
containerFile +=
"\nFROM " + buildRequestProcessorImage + " AS build-request-processor" +
"\nUSER 0" +
"\nWORKDIR /var/workdir" +
"\nCOPY --from=0 /var/workdir/ /var/workdir/" +
"\nRUN /opt/jboss/container/java/run/run-java.sh copy-artifacts --source-path=" + buildRoot + " --deploy-path=" + artifactDirectory +
"\nFROM scratch" +
"\nCOPY --from=1 /var/workdir/workspace/artifacts /";
"""
FROM %s AS build-request-processor
USER 0
WORKDIR /var/workdir
COPY --from=0 /var/workdir/ /var/workdir/
RUN /opt/jboss/container/java/run/run-java.sh copy-artifacts --source-path=/var/workdir/workspace/source --deploy-path=/var/workdir/workspace/artifacts
FROM scratch
COPY --from=1 /var/workdir/workspace/artifacts /""".formatted(buildRequestProcessorImage);
} else {
containerFile +=
"""
FROM scratch\
FROM scratch
COPY --from=0 /var/workdir/workspace/artifacts /""";
}
try {
Files.writeString(Paths.get(jbsDirectory.toString(), "Containerfile"), containerFile);
} catch (IOException e) {

Log.errorf("Unable to write Containerfile", e);
throw new RuntimeException(e);
}
}
Expand Down
17 changes: 15 additions & 2 deletions java-components/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
<quarkus-quinoa.version>2.4.7</quarkus-quinoa.version>

<format.skip>false</format.skip>

<imageTag>dev</imageTag>
</properties>

<modules>
Expand Down Expand Up @@ -452,7 +454,7 @@
<configuration>
<systemProperties>
<quarkus.container-image.group>${env.QUAY_USERNAME}</quarkus.container-image.group>
<quarkus.container-image.tag>dev</quarkus.container-image.tag>
<quarkus.container-image.tag>${imageTag}</quarkus.container-image.tag>
<quarkus.container-image.build>true</quarkus.container-image.build>
<quarkus.container-image.push>true</quarkus.container-image.push>
<quarkus.package.type>mutable-jar</quarkus.package.type>
Expand Down Expand Up @@ -611,5 +613,16 @@
<module>management-console</module>
</modules>
</profile>
</profiles>
<profile>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>env.JBS_QUAY_IMAGE_TAG</name>
</property>
</activation>
<properties>
<imageTag>${env.JBS_QUAY_IMAGE_TAG}</imageTag>
</properties>
</profile>
</profiles>
</project>
17 changes: 1 addition & 16 deletions pkg/reconciler/dependencybuild/buildrecipeyaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,6 @@ func createPipelineSpec(log logr.Logger, tool string, commitTime int64, jbsConfi
tlsVerify = "false"
}

//preprocessorArgs := []string{
// "maven-prepare",
// "$(workspaces." + WorkspaceSource + ".path)/source",
// "--tool=" + tool,
// "--recipe-image=" + recipe.Image,
// "--request-processor-image=" + buildRequestProcessorImage,
//}
//if len(recipe.DisabledPlugins) > 0 {
// for _, i := range recipe.DisabledPlugins {
// preprocessorArgs = append(preprocessorArgs, "-dp "+i)
// }
//}
var javaHome string
if recipe.JavaVersion == "7" || recipe.JavaVersion == "8" {
javaHome = "/lib/jvm/java-1." + recipe.JavaVersion + ".0"
Expand Down Expand Up @@ -213,14 +201,11 @@ func createPipelineSpec(log logr.Logger, tool string, commitTime int64, jbsConfi
} else if tool == "gradle" {
// We always add Maven information (in InvocationBuilder) so add the relevant settings.xml
buildToolSection = mavenSettings + "\n" + gradleBuild
//preprocessorArgs[0] = "gradle-prepare"
} else if tool == "sbt" {
buildToolSection = sbtBuild
//preprocessorArgs[0] = "sbt-prepare"
} else if tool == "ant" {
// We always add Maven information (in InvocationBuilder) so add the relevant settings.xml
buildToolSection = mavenSettings + "\n" + antBuild
//preprocessorArgs[0] = "ant-prepare"
} else {
buildToolSection = "echo unknown build tool " + tool + " && exit 1"
}
Expand Down Expand Up @@ -668,7 +653,7 @@ func createKonfluxScripts(konfluxScript string) string {

func pullPolicy(buildRequestProcessorImage string) v1.PullPolicy {
pullPolicy := v1.PullIfNotPresent
if strings.HasSuffix(buildRequestProcessorImage, ":dev") {
if strings.HasSuffix(buildRequestProcessorImage, ":dev") || strings.HasSuffix(buildRequestProcessorImage, ":latest") {
pullPolicy = v1.PullAlways
}
return pullPolicy
Expand Down

0 comments on commit ac0a46e

Please sign in to comment.