Pipeline Build mislukt als gevolg van Python niet-beschikbare fout

Los de fout van de Bouwstijl van de Pijpleiding toe te schrijven aan een fout van de Python door een Maven project te creëren dat de exec stop gebruikt om Python3 te installeren.

Beschrijving description

Omgeving

AEM as a Cloud Service

Probleem/symptomen

Python versie 3.10 moet worden geïnstalleerd omdat de frontend-code Python nodig heeft om de toepassing te bouwen.

Nochtans, wanneer het opstellen van de pijpleiding in Cloud Manager, ontbreekt de bouwstijl met de volgende fout:

[ Exec Stream Pumper]  [ INFO]  npm ERR! gyp ERR! configure error
[ Exec Stream Pumper]  [ INFO]  npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
[ Exec Stream Pumper]  [ INFO]  npm ERR! gyp ERR! stack   at PythonFinder.fail (/build_root/build/<project>/ui.frontend/node_modules/node-gyp/lib/find-python.js:330:47)
[ Exec Stream Pumper]  [ INFO]  npm ERR! gyp ERR! stack  at PythonFinder.runChecks (/build_root/build/<project>/ui.frontend/node_modules/node-gyp/lib/find-python.js:159:21)
[ Exec Stream Pumper]  [ INFO]  npm ERR! gyp ERR! stack at PythonFinder.<anonymous> (/build_root/build/<project>/ui.frontend/node_modules/node-gyp/lib/find-python.js:266:16)
[ Exec Stream Pumper]  [ INFO]  npm ERR! gyp ERR! stack  at PythonFinder.execFileCallback (/build_root/build/<project>/ui.frontend/node_modules/node-gyp/lib/find-python.js:297:7)
[ Exec Stream Pumper]  [ INFO]  npm ERR! gyp ERR! stack  at ChildProcess.exithandler (node:child_process:317:7)
[ Exec Stream Pumper]  [ INFO]  npm ERR! gyp ERR! stack  at ChildProcess.emit (node:events:365:28)
[ Exec Stream Pumper]  [ INFO]  npm ERR! gyp ERR! stack  at maybeClose (node:internal/child_process:1067:16)
[ Exec Stream Pumper]  [ INFO]  npm ERR! gyp ERR! stack  at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
[ Exec Stream Pumper]  [ INFO]  npm ERR! gyp ERR! System Linux 5.10.102.2-microsoft-standard
[ Exec Stream Pumper]  [ INFO]  npm ERR! gyp ERR! command "/build_root/build/<project>/ui.frontend/node/node" "/build_root/build/<project>/ui.frontend/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
[ Exec Stream Pumper]  [ INFO]  npm ERR! gyp ERR! cwd /build_root/build/<project>/ui.frontend/node_modules/node-sass
[ Exec Stream Pumper]  [ INFO]  npm ERR! gyp ERR! node -v v16.0.0
[ Exec Stream Pumper]  [ INFO]  npm ERR! gyp ERR! node-gyp -v v8.4.1
[ Exec Stream Pumper]  [ INFO]  npm ERR! gyp ERR! not ok
[ Exec Stream Pumper]  [ INFO]  npm ERR! Build failed with error code: 1
[ Exec Stream Pumper]  [ INFO]
[ Exec Stream Pumper]  [ INFO]  npm ERR! A complete log of this run can be found in:
[ Exec Stream Pumper]  [ INFO]  npm ERR!  /root/.npm/_logs/2023-11-06T17_43_49_109Z-debug.log

stellen vragen in onze Gemeenschap van de Campagne van het Experience League

Als u om het even welke vragen hebt u over dit onderwerp zou willen antwoorden, of vorige beantwoord-vragen leest, nodigen wij u uit om ons ​ Communautaire blogpost van de Experience League ​ te bekijken die dit artikel omvat, ons uw vragen en commentaren te verzenden, en zich bij onze Gemeenschap van de Campagne van de Experience League aan te sluiten!

Resolutie resolution

Als Python niet geïnstalleerd is, ​ Gemaakt kan worden geïnstalleerd door deze stappen ​ te volgen.

Om ​ tot een Geweven Project ​ te leiden dat de exec stop gebruikt om Python3 te installeren, moet een configuratie aan een pom.xml worden gedaan.

Voorbeeld:

<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.example</groupId><artifactId>PythonInstaller</artifactId><version>1.0-SNAPSHOT</version><packaging>jar</packaging>
<build><plugins><plugin><groupId>org.codehaus.mojo</groupId><artifactId>exec-maven-plugin</artifactId><version>1.6.0</version><executions><execution><id>apt-get-update</id><phase>validate</phase><goals><goal>exec</goal></goals><configuration><executable>apt-get</executable><arguments><argument>update</argument></arguments></configuration></execution><execution><id>install-python3</id><phase>validate</phase><goals><goal>exec</goal></goals><configuration><executable>apt-get</executable><arguments><argument>install</argument><argument>-y</argument><argument>python3</argument></arguments></configuration></execution></executions></plugin></plugins></build></project>

De Gemaakt configuratie zal apt-get update en apt-get installeren - y python3 bevelen tijdens de validate fase van de Maven bouwstijllevenscyclus in werking stellen. Ook, merk op dat dit slechts zal werken als de bouwstijl in een milieu in werking wordt gesteld waar het apt-get bevel beschikbaar en lopend is. De build moet over voldoende rechten beschikken om pakketten te installeren.

Als u Python 3.11 moet installeren, ziet de pom.xml er als volgt uit:

<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.example</groupId><artifactId>PythonInstaller</artifactId><version>1.0-SNAPSHOT</version><packaging>jar</packaging>
<build><plugins><plugin><groupId>org.codehaus.mojo</groupId><artifactId>exec-maven-plugin</artifactId><version>1.6.0</version><executions><execution><id>apt-get-update</id><phase>validate</phase><goals><goal>exec</goal></goals><configuration><executable>apt-get</executable><arguments><argument>update</argument></arguments></configuration></execution><execution><id>install-python3.11</id><phase>validate</phase><goals><goal>exec</goal></goals><configuration><executable>apt-get</executable><arguments><argument>install</argument><argument>-y</argument><argument>python3.11</argument></arguments></configuration></execution></executions></plugin></plugins></build></project>
recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f