diff --git a/.github/workflows/callable-url-updater-4-tool.yml b/.github/workflows/callable-url-updater-4-tool.yml new file mode 100644 index 0000000000..e880307131 --- /dev/null +++ b/.github/workflows/callable-url-updater-4-tool.yml @@ -0,0 +1,70 @@ +name: Callable url updater for tool +run-name: Nightly update of URLs + +# Controls when the workflow will run +on: + workflow_dispatch: + + #schedule: + # - cron: '56 09 * * *' +jobs: + + testUpdater: + runs-on: ubuntu-latest + steps: + - name: Checkout ide + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Set up Java + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'temurin' + cache: 'maven' + - name: Build and run url updater + run: | + cd cli + mvn -B -ntp -DskipTests -Dstyle.color=always install + + # Update URLS from matrix (list) + IDEasy-update-urls: + runs-on: ubuntu-latest + needs: [ testUpdater ] + strategy: + matrix: + tool-name: [ jmc, pip, jasypt ] + fail-fast: false + steps: + - name: Checkout ide + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Set up Java + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'temurin' + cache: 'maven' + - name: Build and run url updater + run: | + toolName="${{ matrix.tool-name }}" + echo "ToolName: [$toolName]" + if [ "$toolName" != null ] && [ ! -z "$toolName" ] + then + cd cli + mkdir ../ide-urls + mvn -B -ntp -Dstyle.color=always -DskipTests install + mvn -B -ntp -Dstyle.color=always -DskipTests exec:java -Dexec.mainClass="com.devonfw.tools.ide.url.UpdateInitiator" -Dexec.args="../ide-urls PT5H30M $toolName" + else + echo "ERROR: Updater not startet due tool-name is null or empty" + fi + +# +# +# +# uses: hj-lorenz/IDEasy/.github/workflows/update-urls.yml@main +# with: +# tool-name: ${{ matrix.tool-name }} +# secrets: inherit + diff --git a/.github/workflows/dynamic-parallel-url-updater-with-strategy.yml b/.github/workflows/dynamic-parallel-url-updater-with-strategy.yml new file mode 100644 index 0000000000..0e098ce932 --- /dev/null +++ b/.github/workflows/dynamic-parallel-url-updater-with-strategy.yml @@ -0,0 +1,117 @@ +name: Dynamic parallel URL update (strategy matrix) +run-name: Nightly update of URLs + +# Controls when the workflow will run +on: + workflow_dispatch: + + #schedule: + # - cron: '56 09 * * *' + +jobs: + #Execute unit tests for updater only once + testUpdater: + runs-on: ubuntu-latest + steps: + - name: Checkout ide + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Set up Java + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'temurin' + cache: 'maven' + - name: Build and run url updater + run: | + cd cli + mvn -B -ntp -DskipTests -Dstyle.color=always install + + # Create list of tools dynamically + create-tool-list: + name: create-tool-list + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + + steps: + - name: Checkout ide + uses: actions/checkout@v3 + with: + submodules: recursive + - name: PWD + run: | + pwd + - name: Create-Urls-4-test + run: | + cd cli/.. + pwd + mkdir ide-urls + mkdir ide-urls/pip + mkdir ide-urls/jasypt + mkdir ide-urls/eclipse + mkdir ide-urls/eclipse/cpp + pwd + cd ide-urls/eclipse/ + ls -l + - name: Set Matrix + id: set-matrix + # Nachfolgende Statements waren div. Versuche die Liste der Tools zu erstellen, anfangs noch ohne json-Format + # echo "name=matrix::$(ls -lRd * | grep '^d' | gawk '{printf("%s, ",$9)}' | sed -e 's/,\ *$//')" >> $GITHUB_OUTPUT + # echo "matrix=${{for i in `find -maxdepth 2 -type d`; do echo `basename $i`; done | grep -v "^\." | sort -u | awk 'BEGIN{printf("\047[")} {printf("%s, ",$1)}' | sed -e "s/,\ *$/]'/"}}" >> $GITHUB_OUTPUT + # matrix=${{'[cpp,eclipse]'}} >> $GITHUB_OUTPUT + # pwd + # cd cli/../ide-urls + # for i in `find -maxdepth 2 -type d`; do echo `basename $i`; done | grep -v "^\." | sort -u | awk 'BEGIN{printf("\047[")} {printf("%s, ",$1)}' | sed -e "s/,\ *$/]'/" + # echo "matrix=${{env.TOOLS}}" + # echo "matrix=${{env.TOOLS}}" >> $GITHUB_OUTPUT + + # Nachfolgende runs waren Versuche die json zu erzeugen. + # run: echo "matrix=$(jq -cr '@json' <<< "${{ env.TOOLS }}")" >> $GITHUB_OUTPUT + # run: echo "::set-output name=matrix::{[{\"cpp\"}, {\"jasypt\"}]}" + # run echo "::set-output name=matrix::{\"tools\":[{\"tool\":\"eclipse\"},{\"tool\":\"jmc\"}]}" + run: | + toolsAsJson=$(for i in `find ide-urls/. -maxdepth 2 -type d`; do echo `basename $i`; done | grep -v "^\." | sort -u | awk 'BEGIN{printf("{\"tools\":[")} {printf("{\"tool\":\"%s\"},",$1)}' | sed -e "s/,\ *$/]}/") + echo $toolsAsJson + echo "::set-output name=matrix::`echo $toolsAsJson`" + + # HINWEIS: Funktioniert nur, wenn die tools initial mindestens 1x bereits heruntergeladen wurden. + # Optional: Parameter beim manuellen Aufruf, der mit der eine Liste übergeben werden kann. + # * 3 Scripte + # 1. zentrales callable script mit input-Parameter. (nutzt matrix) + # 2. Aufrufer-Script für Erstellen der Matrix aus Input-Parametern + # 3. Aufrufer-Script zum dynamischen Ermitteln der bereits existierenden Tools + + # Update URLS from matrix (list) + IDEasy-update-urls: + runs-on: ubuntu-latest + needs: [ testUpdater, create-tool-list ] + strategy: + matrix: + ${{ fromJson(needs.create-tool-list.outputs.matrix.tools) }} + fail-fast: false + steps: + - name: Checkout ide + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Set up Java + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'temurin' + cache: 'maven' + - name: Build and run url updater + run: | + toolName=${{ matrix.tools }} + echo "ToolName: [$toolName]" + if [ "$toolName" != null ] && [ ! -z "$toolName" ] + then + cd cli + mkdir ../ide-urls + mvn -B -ntp -Dstyle.color=always -DskipTests install + mvn -B -ntp -Dstyle.color=always -DskipTests exec:java -Dexec.mainClass="com.devonfw.tools.ide.url.UpdateInitiator" -Dexec.args="../ide-urls PT1M $toolName" + else + echo "ERROR: Updater not startet due tool-name is null or empty" + fi diff --git a/.github/workflows/update-urls(for-test).yml b/.github/workflows/update-urls(for-test).yml new file mode 100644 index 0000000000..ae7fbc1ee0 --- /dev/null +++ b/.github/workflows/update-urls(for-test).yml @@ -0,0 +1,33 @@ +name: Update Urls (callable) +run-name: ${{ github.actor }} executes url update on ${{ github.ref_name }} 🚀 + +on: + workflow_dispatch: + + workflow_call: + inputs: + tool-name: + required: false + type: string + +jobs: + updateURLS: + runs-on: ubuntu-latest + steps: + - name: Checkout ide + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Set up Java + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'temurin' + cache: 'maven' + - name: Build and run url updater + run: | + toolName="${{ inputs.tool-name }}" + cd cli + mkdir ../ide-urls + mvn -B -ntp -Dstyle.color=always -DskipTests install + mvn -B -ntp -Dstyle.color=always -DskipTests exec:java -Dexec.mainClass="com.devonfw.tools.ide.url.UpdateInitiator" -Dexec.args="../ide-urls PT5H30M $toolName" diff --git a/.github/workflows/update-urls.yml b/.github/workflows/update-urls.yml index 491077e5aa..51d2321c02 100644 --- a/.github/workflows/update-urls.yml +++ b/.github/workflows/update-urls.yml @@ -1,8 +1,8 @@ name: Update URLS on: workflow_dispatch: - schedule: - - cron: '0 3 * * *' + # schedule: + # - cron: '0 3 * * *' jobs: updateURLS: runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 4cfa743f86..078160f130 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ .* !.gitignore !.gitkeep +!.github !.editorconfig !.ide.software.version !.devon.software.version @@ -14,6 +15,7 @@ !.anyedit.properties !.ide.properties !.templateengine +!.yml target/ eclipse-target/ generated/ diff --git a/cli/src/main/java/com/devonfw/tools/ide/url/updater/AbstractUrlUpdater.java b/cli/src/main/java/com/devonfw/tools/ide/url/updater/AbstractUrlUpdater.java index eba14898f4..feb7178250 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/url/updater/AbstractUrlUpdater.java +++ b/cli/src/main/java/com/devonfw/tools/ide/url/updater/AbstractUrlUpdater.java @@ -739,6 +739,9 @@ protected void updateExistingVersions(UrlEdition edition) { String[] existingVersions = edition.getChildNames().toArray(i -> new String[i]); for (String version : existingVersions) { UrlVersion urlVersion = edition.getChild(version); + if (isTimeoutExpired()) { + break; + } if (urlVersion != null) { UrlStatusFile urlStatusFile = urlVersion.getOrCreateStatus(); StatusJson statusJson = urlStatusFile.getStatusJson();