Skip to content

Commit e895a4e

Browse files
committed
Merge branch 'develop'
2 parents 81d14a9 + 6f97745 commit e895a4e

11 files changed

Lines changed: 211 additions & 32 deletions

File tree

changes.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@
2323
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 https://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd">
2424
<body>
2525

26+
<release version="2.18.6" date="2022-10-17">
27+
<action type="update" dev="sseifert">
28+
conga-aem-maven-plugin: Make use of ${project.build.outputTimestamp} for reproducible builds for dispatcher configuration and processed packages in "all" package.
29+
</action>
30+
<action type="fix" dev="sseifert">
31+
conga-aem-maven-plugin: Use Commons Compress to produce "all" package to avoid platform-dependencies in last modified dates.
32+
</action>
33+
<action type="fix" dev="sseifert">
34+
conga-aem-maven-plugin: Ensure consistent line ending for properties.xml in "all" package to avoid platform-dependencies.
35+
</action>
36+
</release>
37+
2638
<release version="2.18.4" date="2022-08-15">
2739
<action type="update" dev="sseifert">
2840
conga-aem-maven-plugin: Check bundle status before package manager install status as the latter may report errors if certain bundles are restarted.

conga-aem-plugin/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
<parent>
2626
<groupId>io.wcm.devops.conga.plugins</groupId>
2727
<artifactId>io.wcm.devops.conga.plugins.aem.parent</artifactId>
28-
<version>2.18.4</version>
28+
<version>2.18.6</version>
2929
<relativePath>../parent/pom.xml</relativePath>
3030
</parent>
3131

3232
<groupId>io.wcm.devops.conga.plugins</groupId>
3333
<artifactId>io.wcm.devops.conga.plugins.aem</artifactId>
34-
<version>2.18.4</version>
34+
<version>2.18.6</version>
3535
<packaging>jar</packaging>
3636

3737
<name>CONGA AEM Plugin</name>

parent/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
<groupId>io.wcm.devops.conga.plugins</groupId>
3333
<artifactId>io.wcm.devops.conga.plugins.aem.parent</artifactId>
34-
<version>2.18.4</version>
34+
<version>2.18.6</version>
3535
<packaging>pom</packaging>
3636

3737
<name>CONGA AEM Plugin</name>
@@ -75,7 +75,7 @@
7575
<dependency>
7676
<groupId>io.wcm.tooling.commons</groupId>
7777
<artifactId>io.wcm.tooling.commons.crx-packmgr-helper</artifactId>
78-
<version>2.1.4</version>
78+
<version>2.1.6</version>
7979
</dependency>
8080

8181
<dependency>

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
<parent>
2424
<groupId>io.wcm.devops.conga.plugins</groupId>
2525
<artifactId>io.wcm.devops.conga.plugins.aem.parent</artifactId>
26-
<version>2.18.4</version>
26+
<version>2.18.6</version>
2727
<relativePath>parent/pom.xml</relativePath>
2828
</parent>
2929

3030
<groupId>io.wcm.devops.conga.plugins</groupId>
3131
<artifactId>io.wcm.devops.conga.plugins.aem.root</artifactId>
32-
<version>2.18.4</version>
32+
<version>2.18.6</version>
3333
<packaging>pom</packaging>
3434

3535
<name>CONGA AEM Plugin</name>

tooling/conga-aem-crypto-cli/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
<parent>
2626
<groupId>io.wcm.devops.conga.plugins</groupId>
2727
<artifactId>io.wcm.devops.conga.plugins.aem.parent</artifactId>
28-
<version>2.18.4</version>
28+
<version>2.18.6</version>
2929
<relativePath>../../parent/pom.xml</relativePath>
3030
</parent>
3131

3232
<groupId>io.wcm.devops.conga.plugins</groupId>
3333
<artifactId>conga-aem-crypto-cli</artifactId>
3434
<packaging>jar</packaging>
35-
<version>2.18.4</version>
35+
<version>2.18.6</version>
3636

3737
<name>CONGA AEM Crypto Command Line Interface</name>
3838
<description>Command line tool to generate Crypto keys for AEM.</description>
@@ -42,7 +42,7 @@
4242
<dependency>
4343
<groupId>io.wcm.devops.conga.plugins</groupId>
4444
<artifactId>io.wcm.devops.conga.plugins.aem</artifactId>
45-
<version>2.18.4</version>
45+
<version>2.18.6</version>
4646
<scope>compile</scope>
4747
<exclusions>
4848
<!-- Exclude all deps - only crypto util classes are used -->

tooling/conga-aem-maven-plugin/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
<parent>
2626
<groupId>io.wcm.devops.conga.plugins</groupId>
2727
<artifactId>io.wcm.devops.conga.plugins.aem.parent</artifactId>
28-
<version>2.18.4</version>
28+
<version>2.18.6</version>
2929
<relativePath>../../parent/pom.xml</relativePath>
3030
</parent>
3131

3232
<groupId>io.wcm.devops.conga.plugins</groupId>
3333
<artifactId>conga-aem-maven-plugin</artifactId>
3434
<packaging>maven-plugin</packaging>
35-
<version>2.18.4</version>
35+
<version>2.18.6</version>
3636

3737
<name>CONGA AEM Maven Plugin</name>
3838
<description>wcm.io DevOps CONGA - CONfiguration GenerAtor Maven Plugin for AEM</description>
@@ -63,7 +63,7 @@
6363
<dependency>
6464
<groupId>io.wcm.devops.conga.plugins</groupId>
6565
<artifactId>io.wcm.devops.conga.plugins.aem</artifactId>
66-
<version>2.18.4</version>
66+
<version>2.18.6</version>
6767
<scope>compile</scope>
6868
</dependency>
6969
<dependency>
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* #%L
3+
* wcm.io
4+
* %%
5+
* Copyright (C) 2022 wcm.io
6+
* %%
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* #L%
19+
*/
20+
package io.wcm.devops.conga.plugins.aem.maven;
21+
22+
import java.nio.file.attribute.FileTime;
23+
import java.util.Date;
24+
25+
import org.apache.maven.archiver.MavenArchiver;
26+
import org.jetbrains.annotations.Nullable;
27+
28+
/**
29+
* Parse/convert ${project.build.outputTimestamp}.
30+
*/
31+
public class BuildOutputTimestamp {
32+
33+
private final Date date;
34+
35+
/**
36+
* @param outputTimestamp Configured output timestamp
37+
*/
38+
public BuildOutputTimestamp(@Nullable String outputTimestamp) {
39+
MavenArchiver mavenArchiver = new MavenArchiver();
40+
this.date = mavenArchiver.parseOutputTimestamp(outputTimestamp);
41+
}
42+
43+
/**
44+
* @return true if a valid timestamp is configured
45+
*/
46+
public boolean isValid() {
47+
return date != null;
48+
}
49+
50+
/**
51+
* @return Date or null if not a valid date
52+
*/
53+
@Nullable
54+
public Date toDate() {
55+
return date;
56+
}
57+
58+
/**
59+
* @return FileTime or null if not a valid date
60+
*/
61+
@Nullable
62+
public FileTime toFileTime() {
63+
if (date != null) {
64+
return FileTime.fromMillis(date.toInstant().getEpochSecond());
65+
}
66+
return null;
67+
}
68+
69+
}

tooling/conga-aem-maven-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/maven/CloudManagerAllPackageMojo.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ public final class CloudManagerAllPackageMojo extends AbstractCloudManagerMojo {
158158
@Parameter(property = "conga.cloudManager.allPackage.skip", defaultValue = "false")
159159
private boolean skip;
160160

161+
@Parameter(defaultValue = "${project.build.outputTimestamp}")
162+
private String outputTimestamp;
163+
161164
@Parameter(readonly = true, defaultValue = "${project}")
162165
private MavenProject project;
163166
@Component
@@ -264,7 +267,8 @@ private AllPackageBuilder createBuilder(String packageName) {
264267
.autoDependenciesMode(this.autoDependenciesMode)
265268
.runModeOptimization(this.runModeOptimization)
266269
.packageTypeValidation(this.packageTypeValidation)
267-
.logger(getLog());
270+
.logger(getLog())
271+
.buildOutputTimestamp(new BuildOutputTimestamp(outputTimestamp));
268272
}
269273

270274
private void buildAllPackage(AllPackageBuilder builder) throws MojoExecutionException {

tooling/conga-aem-maven-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/maven/CloudManagerDispatcherConfigMojo.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ public final class CloudManagerDispatcherConfigMojo extends AbstractCloudManager
5959
@Component(role = Archiver.class, hint = "zip")
6060
private ZipArchiver zipArchiver;
6161

62+
@Parameter(defaultValue = "${project.build.outputTimestamp}")
63+
private String outputTimestamp;
64+
6265
@Override
6366
public void execute() throws MojoExecutionException, MojoFailureException {
6467
if (skip) {
@@ -92,6 +95,11 @@ private void buildDispatcherConfig(File environmentDir, File nodeDir) throws Moj
9295
addZipDirectory(basePath, nodeDir, Collections.singleton(ModelParser.MODEL_FILE));
9396
zipArchiver.setDestFile(targetFile);
9497

98+
BuildOutputTimestamp buildOutputTimestamp = new BuildOutputTimestamp(outputTimestamp);
99+
if (buildOutputTimestamp.isValid()) {
100+
zipArchiver.configureReproducible(buildOutputTimestamp.toDate());
101+
}
102+
95103
zipArchiver.createArchive();
96104
}
97105
catch (ArchiverException | IOException ex) {

tooling/conga-aem-maven-plugin/src/main/java/io/wcm/devops/conga/plugins/aem/maven/allpackage/AllPackageBuilder.java

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@
4545
import java.util.Properties;
4646
import java.util.Set;
4747
import java.util.stream.Collectors;
48-
import java.util.zip.ZipEntry;
49-
import java.util.zip.ZipFile;
50-
import java.util.zip.ZipOutputStream;
5148

49+
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
50+
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
51+
import org.apache.commons.compress.archivers.zip.ZipFile;
5252
import org.apache.commons.io.FileUtils;
5353
import org.apache.commons.io.FilenameUtils;
5454
import org.apache.commons.io.IOUtils;
@@ -65,6 +65,7 @@
6565
import com.google.common.collect.ImmutableSet;
6666

6767
import io.wcm.devops.conga.plugins.aem.maven.AutoDependenciesMode;
68+
import io.wcm.devops.conga.plugins.aem.maven.BuildOutputTimestamp;
6869
import io.wcm.devops.conga.plugins.aem.maven.PackageTypeValidation;
6970
import io.wcm.devops.conga.plugins.aem.maven.RunModeOptimization;
7071
import io.wcm.devops.conga.plugins.aem.maven.model.BundleFile;
@@ -105,6 +106,7 @@ public final class AllPackageBuilder {
105106
private RunModeOptimization runModeOptimization = RunModeOptimization.OFF;
106107
private PackageTypeValidation packageTypeValidation = PackageTypeValidation.STRICT;
107108
private Log log;
109+
private BuildOutputTimestamp buildOutputTimestamp;
108110

109111
private static final String RUNMODE_DEFAULT = "$default$";
110112
private static final Set<String> ALLOWED_PACKAGE_TYPES = ImmutableSet.of(
@@ -172,6 +174,15 @@ public AllPackageBuilder version(String value) {
172174
return this;
173175
}
174176

177+
/**
178+
* @param value Build output timestamp
179+
* @return this
180+
*/
181+
public AllPackageBuilder buildOutputTimestamp(BuildOutputTimestamp value) {
182+
this.buildOutputTimestamp = value;
183+
return this;
184+
}
185+
175186
private Log getLog() {
176187
if (this.log == null) {
177188
this.log = new SystemStreamLog();
@@ -530,18 +541,18 @@ private List<TemporaryContentPackageFile> processContentPackage(ContentPackageFi
530541

531542
// iterate through entries and write them to the temp. zip file
532543
try (FileOutputStream fos = new FileOutputStream(tempFile);
533-
ZipOutputStream zipOut = new ZipOutputStream(fos)) {
534-
Enumeration<? extends ZipEntry> zipInEntries = zipFileIn.entries();
544+
ZipArchiveOutputStream zipOut = new ZipArchiveOutputStream(fos)) {
545+
Enumeration<? extends ZipArchiveEntry> zipInEntries = zipFileIn.getEntries();
535546
while (zipInEntries.hasMoreElements()) {
536-
ZipEntry zipInEntry = zipInEntries.nextElement();
547+
ZipArchiveEntry zipInEntry = zipInEntries.nextElement();
537548
if (!zipInEntry.isDirectory()) {
538549
try (InputStream is = zipFileIn.getInputStream(zipInEntry)) {
539550
boolean processedEntry = false;
540551

541552
// if entry is properties.xml, update dependency information
542553
if (StringUtils.equals(zipInEntry.getName(), "META-INF/vault/properties.xml")) {
543-
Properties props = new Properties();
544-
props.loadFromXML(is);
554+
FileVaultProperties fileVaultProps = new FileVaultProperties(is);
555+
Properties props = fileVaultProps.getProperties();
545556
addSuffixToPackageName(props, pkg, environmentRunMode);
546557

547558
// update package dependencies
@@ -557,9 +568,10 @@ private List<TemporaryContentPackageFile> processContentPackage(ContentPackageFi
557568
props.put(NAME_PACKAGE_TYPE, packageType);
558569
}
559570

560-
ZipEntry zipOutEntry = newZipEntry(zipInEntry);
561-
zipOut.putNextEntry(zipOutEntry);
562-
props.storeToXML(zipOut, null);
571+
ZipArchiveEntry zipOutEntry = newZipEntry(zipInEntry);
572+
zipOut.putArchiveEntry(zipOutEntry);
573+
fileVaultProps.storeToXml(zipOut);
574+
zipOut.closeArchiveEntry();
563575
processedEntry = true;
564576
}
565577

@@ -589,13 +601,13 @@ else if (StringUtils.equals(FilenameUtils.getExtension(zipInEntry.getName()), "z
589601

590602
// otherwise transfer the binary data 1:1
591603
if (!processedEntry) {
592-
ZipEntry zipOutEntry = newZipEntry(zipInEntry);
593-
zipOut.putNextEntry(zipOutEntry);
604+
ZipArchiveEntry zipOutEntry = newZipEntry(zipInEntry);
605+
zipOut.putArchiveEntry(zipOutEntry);
594606
IOUtils.copy(is, zipOut);
607+
zipOut.closeArchiveEntry();
595608
}
596609
}
597610

598-
zipOut.closeEntry();
599611
}
600612
}
601613
}
@@ -615,12 +627,12 @@ else if (StringUtils.equals(FilenameUtils.getExtension(zipInEntry.getName()), "z
615627
return result;
616628
}
617629

618-
private static ZipEntry newZipEntry(ZipEntry in) {
619-
ZipEntry out = new ZipEntry(in.getName());
620-
if (in.getCreationTime() != null) {
621-
out.setCreationTime(in.getCreationTime());
630+
private ZipArchiveEntry newZipEntry(ZipArchiveEntry in) {
631+
ZipArchiveEntry out = new ZipArchiveEntry(in.getName());
632+
if (buildOutputTimestamp != null && buildOutputTimestamp.isValid()) {
633+
out.setLastModifiedTime(buildOutputTimestamp.toFileTime());
622634
}
623-
if (in.getLastModifiedTime() != null) {
635+
else if (in.getLastModifiedTime() != null) {
624636
out.setLastModifiedTime(in.getLastModifiedTime());
625637
}
626638
return out;

0 commit comments

Comments
 (0)