-
Notifications
You must be signed in to change notification settings - Fork 81
#1651: push and commit status.json files to ide-urls-status after running the URL update worklfow #2003
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
base: main
Are you sure you want to change the base?
#1651: push and commit status.json files to ide-urls-status after running the URL update worklfow #2003
Changes from all commits
db35194
b8f29f3
6cba8a3
ab83e9a
25ac584
f5b5c1e
a7d0795
3c8b9aa
aaa6582
cba0d9a
dc85846
355bf24
42342de
aafc6ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,49 +19,63 @@ 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>"); | ||
| 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]; | ||
| 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); | ||
| } | ||
|
Comment on lines
29
to
+41
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We do not need two |
||
|
|
||
| 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 { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -70,6 +70,8 @@ public class UpdateManager extends AbstractProcessorWithTimeout { | |||||||||||||
|
|
||||||||||||||
| private final UrlRepository urlRepository; | ||||||||||||||
|
|
||||||||||||||
| private final UrlRepository statusRepository; | ||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep this as
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also this PR is IMHO still writing to the old locations. Code like this needs to be adopted: IDEasy/url-updater/src/main/java/com/devonfw/tools/ide/url/updater/AbstractUrlUpdater.java Lines 774 to 779 in c0773bf
When really deleting |
||||||||||||||
|
|
||||||||||||||
| private final UrlFinalReport urlFinalReport; | ||||||||||||||
|
|
||||||||||||||
| private final List<AbstractUrlUpdater> updaters = List.of( | ||||||||||||||
|
|
@@ -90,15 +92,29 @@ public class UpdateManager extends AbstractProcessorWithTimeout { | |||||||||||||
| * The constructor. | ||||||||||||||
| * | ||||||||||||||
| * @param pathToRepository the {@link Path} to the {@code ide-urls} repository to update. | ||||||||||||||
| * @param pathToStatusRepository the {@link Path} to the {@code ide-urls-status} repository to update. | ||||||||||||||
| * @param expirationTime for GitHub actions url-update job | ||||||||||||||
| */ | ||||||||||||||
| public UpdateManager(Path pathToRepository, UrlFinalReport urlFinalReport, Instant expirationTime) { | ||||||||||||||
| public UpdateManager(Path pathToRepository, Path pathToStatusRepository, UrlFinalReport urlFinalReport, Instant expirationTime) { | ||||||||||||||
|
|
||||||||||||||
| this.urlRepository = UrlRepository.load(pathToRepository); | ||||||||||||||
| this.statusRepository = UrlRepository.load(pathToStatusRepository); | ||||||||||||||
| this.urlRepository.setStatusRepository(this.statusRepository); | ||||||||||||||
| this.urlFinalReport = urlFinalReport; | ||||||||||||||
| setExpirationTime(expirationTime); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| /** | ||||||||||||||
| * The constructor. | ||||||||||||||
| * | ||||||||||||||
| * @param pathToRepository the {@link Path} to the {@code ide-urls} repository to update. | ||||||||||||||
| * @param expirationTime for GitHub actions url-update job. | ||||||||||||||
| */ | ||||||||||||||
| public UpdateManager(Path pathToRepository, UrlFinalReport urlFinalReport, Instant expirationTime) { | ||||||||||||||
|
|
||||||||||||||
| this(pathToRepository, pathToRepository, urlFinalReport, expirationTime); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| /** | ||||||||||||||
| * @return the {@link List} with all registered {@link AbstractUrlUpdater updaters}. | ||||||||||||||
| */ | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An
UrlRepositoryshould not contain anotherUrlRepository.BTW: Maybe it was wrong from the start to have the
UrlStatusFileinclimodule since we never read it from IDEasy itself. It is only used by UrlUpdater and nowhere else.I would suggest to revert all these changes.
Simply determine the path to the status file from the path to the version folder (from
UrlVersion.getPath()).