Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport changes from main branch #803

Merged
merged 10 commits into from
Nov 26, 2024
Merged
Binary file added .github/release/maven-settings.xml.gpg
Binary file not shown.
43 changes: 0 additions & 43 deletions .github/workflows/future.yml

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build
on:
push:
branches:
- main
- 1.3.x
paths-ignore:
- '.gitignore'
- 'examples'
Expand All @@ -24,7 +24,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest ]
jdk: [ 11, 17, 21 ]
jdk: [ 17, 21 ]
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -40,7 +40,7 @@ jobs:
- uses: actions/upload-artifact@v4
if: failure()
with:
name: surefire-reports
name: surefire-reports-${{ matrix.os }}-${{ matrix.jdk }}
path: '**/surefire-reports/*.txt'
pmd:
name: ubuntu-latest-pmd
Expand All @@ -52,7 +52,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: 11
java-version: 17
distribution: 'adopt'
cache: maven
- name: Build and test
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,23 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: maven release ${{steps.metadata.outputs.current-version}}
run: |
java -version
gpg --quiet --batch --yes --decrypt --passphrase="${{ secrets.SECRET_PASSPHRASE }}" --output maven-settings.xml .github/release/maven-settings.xml.gpg
git config --global user.name "WildFly Prospero CI"
git config --global user.email "[email protected]"
git checkout -b release
mvn -B release:prepare -Pdist,jboss-release -DreleaseVersion=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}}
mvn -B release:prepare -Pdist,jboss-release -DreleaseVersion=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}} -s maven-settings.xml
git checkout ${{github.base_ref}}
git rebase release
mvn -B release:perform -Pdist,jboss-release -s maven-settings.xml
git push
git push --tags
- name: Create GH release
uses: softprops/action-gh-release@v2
with:
files: dist/build/target/prospero-${{steps.metadata.outputs.current-version}}.zip
tag_name: ${{steps.metadata.outputs.current-version}}
prerelease: contains(${{steps.metadata.outputs.current-version}}, "Beta")
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ public void setUp() throws Exception {
));

// create and deploy second manifest
secondManifest = new ChannelManifest(null, null, null, null,
List.of(new Stream("org.wildfly.core", "wildfly-controller", UPGRADE_VERSION)));
secondManifest = new ChannelManifest.Builder()
.setSchemaVersion("1.0.0")
.addStreams(new Stream("org.wildfly.core", "wildfly-controller", UPGRADE_VERSION))
.build();
repositoryUtils.deployArtifact(new DefaultArtifact(
"org.test.channels",
"wf-core-second",
Expand Down Expand Up @@ -321,7 +323,7 @@ public void updateWithManifestNotInCacheAndNotAvailableFails() throws Exception
assertThatThrownBy(()->performUpdate())
.isInstanceOf(UnresolvedChannelMetadataException.class)
.hasFieldOrPropertyWithValue("missingArtifacts",
Set.of(new ChannelMetadataCoordinate("org.test.channels", "wf-core-base", "",
Set.of(new ChannelMetadataCoordinate("org.test.channels", "wf-core-base", "1.0.0",
ChannelManifest.CLASSIFIER, ChannelManifest.EXTENSION)));
}

Expand Down Expand Up @@ -383,6 +385,7 @@ private ChannelManifest updateWildflyController() throws MalformedURLException {
return new ChannelManifest(
sourceManifest.getSchemaVersion(),
sourceManifest.getId(),
sourceManifest.getLogicalVersion(),
sourceManifest.getDescription(),
sourceManifest.getManifestRequirements(),
streams);
Expand Down
36 changes: 19 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,24 @@
<prospero.channel.manifest.artifactId>prospero-standalone-galleon-pack</prospero.channel.manifest.artifactId>
<prospero.channel.manifest.groupId>${project.groupId}</prospero.channel.manifest.groupId>

<version.io.undertow>2.3.17.Final</version.io.undertow>
<version.io.undertow>2.3.18.Final</version.io.undertow>
<version.commons-codec>1.17.1</version.commons-codec>
<version.commons-io>2.17.0</version.commons-io>
<version.org.asciidoctor.asciidoctor-maven-plugin>3.0.0</version.org.asciidoctor.asciidoctor-maven-plugin>
<version.org.asciidoctor.asciidoctor-maven-plugin>3.1.1</version.org.asciidoctor.asciidoctor-maven-plugin>
<version.org.apache.commons.commons-text>1.12.0</version.org.apache.commons.commons-text>
<version.org.apache.httpcomponents.httpclient>4.5.14</version.org.apache.httpcomponents.httpclient>
<version.org.apache.httpcomponents.httpcore>4.4.16</version.org.apache.httpcomponents.httpcore>
<version.org.apache.maven.plugins.antrun>3.1.0</version.org.apache.maven.plugins.antrun>
<version.org.apache.maven.plugins.jar>3.0.2</version.org.apache.maven.plugins.jar>
<version.org.apache.maven.plugins.pmd>3.25.0</version.org.apache.maven.plugins.pmd>
<version.org.apache.maven.plugins.dependency>3.8.0</version.org.apache.maven.plugins.dependency>
<version.org.apache.maven.resolver>1.9.21</version.org.apache.maven.resolver>
<version.org.apache.maven.plugins.pmd>3.26.0</version.org.apache.maven.plugins.pmd>
<version.org.apache.maven.plugins.dependency>3.8.1</version.org.apache.maven.plugins.dependency>
<version.org.apache.maven.resolver>1.9.22</version.org.apache.maven.resolver>
<version.org.apache.maven>3.6.3</version.org.apache.maven>
<version.org.codehaus.gmaven.groovy-maven-plugin>2.1.1</version.org.codehaus.gmaven.groovy-maven-plugin>
<version.org.codehaus.plexus-interpolation>1.27</version.org.codehaus.plexus-interpolation>
<version.org.codehaus.plexus-utils>3.5.0</version.org.codehaus.plexus-utils>
<version.org.jboss.staxmapper>1.5.0.Final</version.org.jboss.staxmapper>
<version.org.jboss.galleon>6.0.3.Final</version.org.jboss.galleon>
<version.org.jboss.galleon>6.0.4.Final</version.org.jboss.galleon>
<version.org.eclipse.jgit>6.9.0.202403050737-r</version.org.eclipse.jgit>
<version.com.fasterxml.jackson>2.17.0</version.com.fasterxml.jackson>
<version.org.jboss.logmanager>2.1.19.Final</version.org.jboss.logmanager>
Expand All @@ -65,18 +65,18 @@
<version.org.jboss.modules>2.1.5.Final</version.org.jboss.modules>
<version.org.jboss.xnio>3.8.16.Final</version.org.jboss.xnio>
<version.org.wildfly.common>1.7.0.Final</version.org.wildfly.common>
<version.org.wildfly.galleon-plugins>7.2.0.Final</version.org.wildfly.galleon-plugins>
<version.org.wildfly.installation-manager>1.0.3.Final</version.org.wildfly.installation-manager>
<version.org.wildfly.maven.plugins.licenses-plugin>2.4.1.Final</version.org.wildfly.maven.plugins.licenses-plugin>
<version.org.wildfly.prospero.prospero-metadata>1.2.1.Final</version.org.wildfly.prospero.prospero-metadata>
<version.org.mockito>5.14.1</version.org.mockito>
<version.org.wildfly.galleon-plugins>7.3.0.Final</version.org.wildfly.galleon-plugins>
<version.org.wildfly.installation-manager>2.0.0.Beta1</version.org.wildfly.installation-manager>
<version.org.wildfly.maven.plugins.licenses-plugin>2.4.2.Final</version.org.wildfly.maven.plugins.licenses-plugin>
<version.org.wildfly.prospero.prospero-metadata>1.3.0.Beta2</version.org.wildfly.prospero.prospero-metadata>
<version.org.mockito>5.14.2</version.org.mockito>
<version.org.slf4j>2.0.7</version.org.slf4j>
<version.org.yaml.snakeyaml>2.2</version.org.yaml.snakeyaml>
<version.junit>4.13.2</version.junit>
<version.maven-shade-plugin>3.6.0</version.maven-shade-plugin>
<version.org.wildfly.channel>1.1.0.Final</version.org.wildfly.channel>
<version.org.wildfly.channel>1.2.1.Final</version.org.wildfly.channel>
<version.maven-compiler-plugin>3.10.1</version.maven-compiler-plugin>
<version.org.wildfly.galleon-pack>33.0.2.Final</version.org.wildfly.galleon-pack>
<version.org.wildfly.galleon-pack>34.0.0.Final</version.org.wildfly.galleon-pack>
<version.info.picocli>4.7.6</version.info.picocli>
<version.system-rules>1.19.0</version.system-rules>
<version.assertj>3.26.3</version.assertj>
Expand Down Expand Up @@ -518,10 +518,10 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
<testSource>11</testSource>
<testTarget>11</testTarget>
<source>17</source>
<target>17</target>
<testSource>17</testSource>
<testTarget>17</testTarget>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -565,6 +565,8 @@
<tagNameFormat>@{project.version}</tagNameFormat>
<!-- install is needed to make Galleon happy -->
<preparationGoals>clean install</preparationGoals>
<localCheckout>true</localCheckout>
<remoteTagging>false</remoteTagging>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -716,4 +716,10 @@ default String candidateApplyRollbackSuccess() {
default String candidateApplyRollbackFailure(Path backup) {
return format(bundle.getString("prospero.candidate.apply.error.rollback_error.desc"), backup);
}

default OperationException cancelledByConfilcts() {
return new OperationException(format(
bundle.getString("prospero.updates.apply.candidate.cancel_conflicts"),
CliConstants.NO_CONFLICTS_ONLY));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,7 @@ private Commands() {
public static final String VV = "-vv";
public static final String Y = "-y";
public static final String YES = "--yes";
public static final String NO_CONFLICTS_ONLY = "--no-conflicts-only";
public static final String DRY_RUN = "--dry-run";

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,22 @@
)
public class RevertCommand extends AbstractParentCommand {

private static int applyCandidate(CliConsole console, ApplyCandidateAction applyCandidateAction, boolean yes) throws OperationException, ProvisioningException {
private static int applyCandidate(CliConsole console, ApplyCandidateAction applyCandidateAction,
boolean yes, boolean noConflictsOnly, boolean dryRun)
throws OperationException, ProvisioningException {
List<ArtifactChange> artifactUpdates = applyCandidateAction.findUpdates().getArtifactUpdates();
console.printArtifactChanges(artifactUpdates);
final List<FileConflict> conflicts = applyCandidateAction.getConflicts();
FileConflictPrinter.print(conflicts, console);

if (dryRun) {
return SUCCESS;
}

if (noConflictsOnly && !conflicts.isEmpty()) {
throw CliMessages.MESSAGES.cancelledByConfilcts();
}

if (!yes && !artifactUpdates.isEmpty() && !console.confirm(CliMessages.MESSAGES.continueWithRevert(),
CliMessages.MESSAGES.applyingChanges(), CliMessages.MESSAGES.revertCancelled())) {
return SUCCESS;
Expand Down Expand Up @@ -92,6 +102,9 @@ public static class PerformCommand extends AbstractMavenCommand {
@CommandLine.Option(names = {CliConstants.Y, CliConstants.YES})
boolean yes;

@CommandLine.Option(names = {CliConstants.NO_CONFLICTS_ONLY})
boolean noConflictsOnly;

public PerformCommand(CliConsole console, ActionFactory actionFactory) {
super(console, actionFactory);
}
Expand Down Expand Up @@ -121,7 +134,7 @@ public Integer call() throws Exception {

validateRevertCandidate(installationDirectory, tempDirectory, applyCandidateAction);

applyCandidate(console, applyCandidateAction, yes);
applyCandidate(console, applyCandidateAction, yes, noConflictsOnly, false);
} catch (IOException e) {
throw ProsperoLogger.ROOT_LOGGER.unableToCreateTemporaryDirectory(e);
}
Expand All @@ -147,6 +160,12 @@ public static class ApplyCommand extends AbstractCommand {
@CommandLine.Option(names = {CliConstants.Y, CliConstants.YES})
boolean yes;

@CommandLine.Option(names = {CliConstants.NO_CONFLICTS_ONLY})
boolean noConflictsOnly;

@CommandLine.Option(names = {CliConstants.DRY_RUN})
boolean dryRun;

public ApplyCommand(CliConsole console, ActionFactory actionFactory) {
super(console, actionFactory);
}
Expand All @@ -162,7 +181,7 @@ public Integer call() throws Exception {
console.println(CliMessages.MESSAGES.revertStart(installationDirectory, applyCandidateAction.getCandidateRevision().getName()));
console.println("");

applyCandidate(console, applyCandidateAction, yes);
applyCandidate(console, applyCandidateAction, yes, noConflictsOnly, dryRun);
if(remove) {
applyCandidateAction.removeCandidate(candidateDirectory.toFile());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ public static class PerformCommand extends AbstractMavenCommand {
@CommandLine.Option(names = {CliConstants.Y, CliConstants.YES})
boolean yes;

@CommandLine.Option(names = {CliConstants.NO_CONFLICTS_ONLY})
boolean noConflictsOnly;

public PerformCommand(CliConsole console, ActionFactory actionFactory) {
super(console, actionFactory);
}
Expand Down Expand Up @@ -119,7 +122,7 @@ public Integer call() throws Exception {
console.println(CliMessages.MESSAGES.updateHeader(installationDir));

try (UpdateAction updateAction = actionFactory.update(installationDir, mavenOptions, console, repositories)) {
performUpdate(updateAction, yes, console, installationDir);
performUpdate(updateAction, yes, console, installationDir, noConflictsOnly);
}
}

Expand All @@ -129,7 +132,7 @@ public Integer call() throws Exception {
return ReturnCodes.SUCCESS;
}

private boolean performUpdate(UpdateAction updateAction, boolean yes, CliConsole console, Path installDir) throws OperationException, ProvisioningException {
private boolean performUpdate(UpdateAction updateAction, boolean yes, CliConsole console, Path installDir, boolean noConflictsOnly) throws OperationException, ProvisioningException {
Path targetDir = null;
try {
targetDir = Files.createTempDirectory("update-candidate");
Expand All @@ -141,6 +144,11 @@ private boolean performUpdate(UpdateAction updateAction, boolean yes, CliConsole
final List<FileConflict> conflicts = applyCandidateAction.getConflicts();
if (!conflicts.isEmpty()) {
FileConflictPrinter.print(conflicts, console);

if (noConflictsOnly) {
throw CliMessages.MESSAGES.cancelledByConfilcts();
}

if (!yes && !console.confirm(CliMessages.MESSAGES.continueWithUpdate(), "", CliMessages.MESSAGES.updateCancelled())) {
return false;
}
Expand Down Expand Up @@ -226,6 +234,12 @@ public static class ApplyCommand extends AbstractCommand {
@CommandLine.Option(names = {CliConstants.Y, CliConstants.YES})
boolean yes;

@CommandLine.Option(names = {CliConstants.NO_CONFLICTS_ONLY})
boolean noConflictsOnly;

@CommandLine.Option(names = {CliConstants.DRY_RUN})
boolean dryRun;

public ApplyCommand(CliConsole console, ActionFactory actionFactory) {
super(console, actionFactory);
}
Expand Down Expand Up @@ -257,6 +271,14 @@ public Integer call() throws Exception {
final List<FileConflict> conflicts = applyCandidateAction.getConflicts();
FileConflictPrinter.print(conflicts, console);

if (dryRun) {
return ReturnCodes.SUCCESS;
}

if (noConflictsOnly && !conflicts.isEmpty()) {
throw CliMessages.MESSAGES.cancelledByConfilcts();
}

// there always should be updates, so confirm update
if (!yes && !console.confirm(CliMessages.MESSAGES.continueWithUpdate(), CliMessages.MESSAGES.applyingUpdates(), CliMessages.MESSAGES.updateCancelled())) {
return ReturnCodes.SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,22 @@ public String getScriptName(OsShell shell) {
}

@Override
public String getApplyUpdateCommand(Path installationPath, Path candidatePath) {
public String getApplyUpdateCommand(Path installationPath, Path candidatePath, boolean noConflictsOnly) {
return CliConstants.Commands.UPDATE + " " + CliConstants.Commands.APPLY + " "
+ CliConstants.DIR + " " + escape(installationPath.toAbsolutePath()) + " "
+ CliConstants.CANDIDATE_DIR + " " + escape(candidatePath.toAbsolutePath()) + " "
+ CliConstants.YES + " "
+ (noConflictsOnly ? CliConstants.NO_CONFLICTS_ONLY + " " : "")
+ CliConstants.REMOVE;
}

@Override
public String getApplyRevertCommand(Path installationPath, Path candidatePath) {
public String getApplyRevertCommand(Path installationPath, Path candidatePath, boolean noConflictsOnly) {
return CliConstants.Commands.REVERT + " " + CliConstants.Commands.APPLY + " "
+ CliConstants.DIR + " " + escape(installationPath.toAbsolutePath()) + " "
+ CliConstants.CANDIDATE_DIR + " " + escape(candidatePath.toAbsolutePath()) + " "
+ CliConstants.YES + " "
+ (noConflictsOnly ? CliConstants.NO_CONFLICTS_ONLY + " " : "")
+ CliConstants.REMOVE;
}

Expand Down
Loading
Loading