Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .github/workflows/update-urls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ jobs:
repository: devonfw/ide-urls
path: ide-urls
token: ${{ secrets.ACTION_PUSH_TOKEN }}
- name: Checkout ide-urls-status
uses: actions/checkout@v3
with:
repository: devonfw/ide-urls-status
path: ide-urls-status
token: ${{ secrets.ACTION_PUSH_TOKEN }}
Comment thread
hohwille marked this conversation as resolved.
- name: Set up Java
uses: actions/setup-java@v5
with:
Expand All @@ -30,7 +36,7 @@ jobs:
GHA_TOKEN: ${{ secrets.GHA_TOKEN }}
- name: Run url updater
run: |
mvn -B -ntp -Dstyle.color=always -pl url-updater exec:java -Dexec.mainClass="com.devonfw.tools.ide.url.UpdateInitiator" -Dexec.args="ide-urls PT5H30M"
mvn -B -ntp -Dstyle.color=always -pl url-updater exec:java -Dexec.mainClass="com.devonfw.tools.ide.url.UpdateInitiator" -Dexec.args="ide-urls ide-urls-status PT5H30M"
env:
GHA_TOKEN: ${{ secrets.GHA_TOKEN }}
- name: Commit and push to ide-urls
Expand All @@ -46,6 +52,19 @@ jobs:
else
echo "No changes, nothing to commit."
fi
- name: Commit and push status.json files to ide-urls-status
run: |
cd ide-urls-status
git config --global user.name ${{ secrets.BUILD_USER }}
git config --global user.email ${{ secrets.BUILD_USER_EMAIL }}
if git status -z | grep -q .
then
git add .
git commit -m "Update status.json"
git push
else
echo "No status.json changes"
fi
trigger_update_cve:
runs-on: ubuntu-latest
needs: updateURLS
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This file documents all notable changes to https://github.com/devonfw/IDEasy[IDE

Release with new features and bugfixes:

* https://github.com/devonfw/IDEasy/issues/1651[#1651]: Move status.json files out of ide-urls to ide-urls-status
* https://github.com/devonfw/IDEasy/issues/1943[#1943]: Create ruby commandlet
* https://github.com/devonfw/IDEasy/issues/2250[#2250]: Implemented uninstall commands from package manager
* https://github.com/devonfw/IDEasy/issues/821[#821]: Made the `ide` prefix in `ide shell` part of the editable input so it can be removed for non-IDEasy commands
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import com.devonfw.tools.ide.url.model.file.UrlChecksum;
import com.devonfw.tools.ide.url.model.file.UrlDownloadFile;
import com.devonfw.tools.ide.url.model.file.UrlFile;
import com.devonfw.tools.ide.url.model.file.UrlStatusFile;
import com.devonfw.tools.ide.version.VersionIdentifier;

/**
Expand All @@ -21,6 +20,9 @@
*/
public class UrlVersion extends AbstractUrlFolderWithParent<UrlEdition, UrlFile<?>> {

/** The {@link #getName() filename} of the status file. Must stay in sync with {@code UrlStatusFile.STATUS_JSON} in the url-updater module. */
private static final String STATUS_JSON = "status.json";

private VersionIdentifier versionIdentifier;

/**
Expand Down Expand Up @@ -131,22 +133,6 @@ public static String getUrlsFileName(OperatingSystem os, SystemArchitecture arch
return os + "_" + SystemArchitecture.orDefault(arch) + UrlDownloadFile.EXTENSION_URLS;
}

/**
* @return the {@link UrlStatusFile}.
*/
public UrlStatusFile getStatus() {

return (UrlStatusFile) getChild(UrlStatusFile.STATUS_JSON);
}

/**
* @return the {@link UrlStatusFile}.
*/
public UrlStatusFile getOrCreateStatus() {

return (UrlStatusFile) getOrCreateChild(UrlStatusFile.STATUS_JSON);
}

/**
* @return the {@link VersionIdentifier}
*/
Expand Down Expand Up @@ -193,9 +179,7 @@ public UrlChecksum getChecksum(String urlsFilename) {
@Override
protected UrlFile<?> newChild(String name) {

if (Objects.equals(name, UrlStatusFile.STATUS_JSON)) {
return new UrlStatusFile(this);
} else if (name.endsWith(UrlChecksum.EXTENSION)) {
if (name.endsWith(UrlChecksum.EXTENSION)) {
return new UrlChecksum(this, name);
}
return new UrlDownloadFile(this, name);
Expand All @@ -204,7 +188,7 @@ protected UrlFile<?> newChild(String name) {
@Override
protected boolean isAllowedChild(String name, boolean folder) {

return true;
return !STATUS_JSON.equals(name);
}

@Override
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,49 +19,56 @@ public class UpdateInitiator {
private static final Logger logger = LoggerFactory.getLogger(UpdateInitiator.class.getName());

/**
* @param args the command-line arguments. arg[0] points to the {@code ide-urls} repository. arg[1] defines a timeout for GitHub actions in Duration
* string format and arg[2] (optional) can be used to specify a single tool to update instead of all tools, either by toolname (e.g. java) or using the Classname of
* the Updater (e.g. JavaAzulUrlUpdater). The timeout is used to prevent the GitHub action from running into a timeout error due to too long execution
* time.
* @param args the command-line arguments. arg[0] points to the {@code ide-urls} repository. arg[1] points to the {@code ide-urls-status} repository.
* arg[2] defines a timeout for GitHub actions in Duration string format and arg[3] (optional) can be used to specify a single tool to update instead of
* all tools, either by toolname (e.g. java) or using the Classname of the Updater (e.g. JavaAzulUrlUpdater). The timeout is used to prevent the GitHub
* action from running into a timeout error due to too long execution time.
*/
public static void main(String[] args) {

if (args.length == 0) {
logger.error("Error: Missing path to repository as well as missing timeout as command line arguments.");
logger.error("Usage: java UpdateInitiator <path_to_repository> <duration_string_format> <tool_to_test|updater_class_name>");
if (args.length < 2) {
logger.error("Error: Missing path to URL repository and/or status repository.");
logger.error(
"Usage: java UpdateInitiator <path_to_url_repository> <path_to_status_repository> <duration_string_format> <tool_to_test|updater_class_name>");
System.exit(1);
}

String pathToRepo = args[0];
String pathToUrlRepo = args[0];
String pathToStatusRepo = args[1];
Instant expirationTime = null;
String selectedTool = null;

if (args.length < 2) {
if (args.length < 3) {
logger.warn("Timeout was not set, setting timeout to infinite instead.");
} else {
try {
Duration duration = Duration.parse(args[1]);
Duration duration = Duration.parse(args[2]);
expirationTime = Instant.now().plus(duration);
logger.info("Timeout was set to: {}.", expirationTime);
} catch (DateTimeParseException e) {
logger.error("Error: Provided timeout format is not valid.", e);
System.exit(1);
}
if (args.length > 2) {
selectedTool = args[2];
if (args.length > 3) {
selectedTool = args[3];
}
}

Path repoPath = Path.of(pathToRepo);
Path urlRepoPath = Path.of(pathToUrlRepo);
Path statusRepoPath = Path.of(pathToStatusRepo);

if (!repoPath.toFile().isDirectory()) {
logger.error("Error: Provided path is not a valid directory.");
if (!urlRepoPath.toFile().isDirectory()) {
logger.error("Error: Provided URL repository path is not a valid directory.");
System.exit(1);
}
if (!statusRepoPath.toFile().isDirectory()) {
logger.error("Error: Provided status repository path is not a valid directory.");
System.exit(1);
}

UrlFinalReport urlFinalReport = new UrlFinalReport();

UpdateManager updateManager = new UpdateManager(repoPath, urlFinalReport, expirationTime);
UpdateManager updateManager = new UpdateManager(urlRepoPath, statusRepoPath, urlFinalReport, expirationTime);
if (selectedTool == null) {
updateManager.updateAll();
} else {
Expand Down
Loading