Skip to content

Commit

Permalink
Move from Yarn to Npm
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernard31 committed Nov 8, 2024
1 parent 096e594 commit 8ba229d
Show file tree
Hide file tree
Showing 16 changed files with 6,103 additions and 3,516 deletions.
2 changes: 1 addition & 1 deletion .github/actions/unittests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ runs:
- name: Run Integration Tests
id: main
shell: bash
run: mvn -B surefire:test '-Dtest=!org.eclipse.leshan.integration.tests.**' -Dsurefire.failIfNoSpecifiedTests=false -Dskip.yarn
run: mvn -B surefire:test '-Dtest=!org.eclipse.leshan.integration.tests.**' -Dsurefire.failIfNoSpecifiedTests=false -Dskip.npm

# Store Step status in Build Status Properties file
- name: Store Step Status
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/unittests/comment.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ mvn surefire:test
```
To launch unit tests only :
```
mvn surefire:test '-Dtest=!org.eclipse.leshan.integration.tests.**' -Dsurefire.failIfNoSpecifiedTests=false -Dskip.yarn
mvn surefire:test '-Dtest=!org.eclipse.leshan.integration.tests.**' -Dsurefire.failIfNoSpecifiedTests=false -Dskip.npm
```
2 changes: 1 addition & 1 deletion .jenkins/ci.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pipeline {
steps {
// Build
sh ''' mvn -B com.github.ekryd.sortpom:sortpom-maven-plugin:verify -PallPom '''
// This ssh agent is needed to cache yarn/node to download.eclipse.org when using -PeclipseJenkins
// This ssh agent is needed to cache npm/node to download.eclipse.org when using -PeclipseJenkins
// see : https://github.com/eclipse-leshan/leshan/pull/1484
sshagent ( ['projects-storage.eclipse.org-bot-ssh']) {
sh ''' mvn -B clean install javadoc:javadoc -PeclipseJenkins '''
Expand Down
12 changes: 6 additions & 6 deletions .jenkins/nightly.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,24 @@ pipeline {
steps {
// Build
sh ''' mvn -B com.github.ekryd.sortpom:sortpom-maven-plugin:verify -PallPom '''
// This ssh agent is needed to cache yarn/node to download.eclipse.org when using -PeclipseJenkins
// This ssh agent is needed to cache npm/node to download.eclipse.org when using -PeclipseJenkins
// see : https://github.com/eclipse-leshan/leshan/pull/1484
sshagent ( ['projects-storage.eclipse.org-bot-ssh']) {
sh ''' mvn -B clean install javadoc:javadoc -PeclipseJenkins -DskipTests'''
}

// test with minimal supported version
sh '''mvn -B test -PuseToolchain -Dskip.yarn'''
sh '''mvn -B test -PuseToolchain -Dskip.npm'''
// test with all LTS version
sh '''mvn -B test -PuseToolchain -Dskip.yarn -Dtoolchain.version=11'''
sh '''mvn -B test -PuseToolchain -Dskip.yarn -Dtoolchain.version=17'''
sh '''mvn -B test -PuseToolchain -Dskip.yarn -Dtoolchain.version=21'''
sh '''mvn -B test -PuseToolchain -Dskip.npm -Dtoolchain.version=11'''
sh '''mvn -B test -PuseToolchain -Dskip.npm -Dtoolchain.version=17'''
sh '''mvn -B test -PuseToolchain -Dskip.npm -Dtoolchain.version=21'''
}
}
stage('Deploy') {
steps {
// Deploy
sh '''mvn -B deploy -Prelease-nightly -DskipTests -Dskip.yarn'''
sh '''mvn -B deploy -Prelease-nightly -DskipTests -Dskip.npm'''
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions .jenkins/release.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pipeline {
// Update to release version and build artifacts
sh '''mvn -B versions:set -PallPom -DnewVersion=${RELEASE_VERSION}'''
sh '''mvn -B com.github.ekryd.sortpom:sortpom-maven-plugin:verify -PallPom'''
// This ssh agent is needed to cache yarn/node to download.eclipse.org when using -PeclipseJenkins
// This ssh agent is needed to cache npm/node to download.eclipse.org when using -PeclipseJenkins
// see : https://github.com/eclipse-leshan/leshan/pull/1484
sshagent ( ['projects-storage.eclipse.org-bot-ssh']) {
sh '''mvn -B clean install javadoc:javadoc -PeclipseJenkins'''
Expand All @@ -92,7 +92,7 @@ pipeline {
stage('Deploy') {
steps {
// deploy then update to post release version
sh '''mvn -B deploy -Prelease -DskipTests -Dskip.yarn -DskipStagingRepositoryClose=${DRY_RUN}'''
sh '''mvn -B deploy -Prelease -DskipTests -Dskip.npm -DskipStagingRepositoryClose=${DRY_RUN}'''
sh '''mvn -B versions:set -PallPom -DnewVersion=${NEXT_VERSION}'''

// Commit post release version change and push if not dry-run
Expand Down
8 changes: 4 additions & 4 deletions .jenkins/test.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pipeline {

// Build
sh ''' mvn -B com.github.ekryd.sortpom:sortpom-maven-plugin:verify -PallPom '''
// This ssh agent is needed to cache yarn/node to download.eclipse.org when using -PeclipseJenkins
// This ssh agent is needed to cache npm/node to download.eclipse.org when using -PeclipseJenkins
// see : https://github.com/eclipse-leshan/leshan/pull/1484
sshagent ( ['projects-storage.eclipse.org-bot-ssh']) {
sh ''' mvn -B clean install javadoc:javadoc -PeclipseJenkins -DskipTests'''
Expand All @@ -57,12 +57,12 @@ pipeline {
sh '''
if [[ $TEST_WITH_TOOLCHAIN == true ]]; then
if [[ -n $JDK_TOOLCHAIN_VERSION ]]; then
mvn -B test -PuseToolchain -Dskip.yarn -Dtoolchain.version="${JDK_TOOLCHAIN_VERSION}"
mvn -B test -PuseToolchain -Dskip.npm -Dtoolchain.version="${JDK_TOOLCHAIN_VERSION}"
else
mvn -B test -PuseToolchain -Dskip.yarn
mvn -B test -PuseToolchain -Dskip.npm
fi
else
mvn -B test -Dskip.yarn
mvn -B test -Dskip.npm
fi
'''

Expand Down
8 changes: 3 additions & 5 deletions .jenkins/weekly.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pipeline {

// Build (optional)
sh ''' mvn -B com.github.ekryd.sortpom:sortpom-maven-plugin:verify -PallPom '''
// This ssh agent is needed to cache yarn/node to download.eclipse.org when using -PeclipseJenkins
// This ssh agent is needed to cache npm/node to download.eclipse.org when using -PeclipseJenkins
// see : https://github.com/eclipse-leshan/leshan/pull/1484
sshagent ( ['projects-storage.eclipse.org-bot-ssh']) {
sh ''' mvn -B clean install javadoc:javadoc -PeclipseJenkins -DskipTests'''
Expand All @@ -40,10 +40,8 @@ pipeline {
// Generate SBOM for maven
sh ''' mvn org.cyclonedx:cyclonedx-maven-plugin:makeBom '''

// Generate SBOM for yarn with trivy
// Ideally we would like to use a specific integrated tools like : https://github.com/CycloneDX/cyclonedx-node-yarn
// But project is not really active and is searching for contributor : https://github.com/CycloneDX/cyclonedx-node-yarn/issues/12
// OR maybe we should move from Yarn To NPM : https://github.com/eclipse-leshan/leshan/issues/1550#issuecomment-1878802371
// Generate SBOM for npm with trivy
// We should generate sbom with cyclonedx-npm see : https://github.com/eclipse-leshan/leshan/issues/1550#issuecomment-1878802371
sh ''' trivy fs leshan-demo-server/webapp --format cyclonedx --output leshan-demo-server/target/bom-frontend.json --include-dev-deps '''
sh ''' trivy fs leshan-demo-bsserver/webapp --format cyclonedx --output leshan-demo-bsserver/target/bom-frontend.json --include-dev-deps '''

Expand Down
28 changes: 10 additions & 18 deletions build-config/demo-build-config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ Contributors:

<properties>
<node-version>v18.13.0</node-version>
<yarn-version>v1.22.19</yarn-version>
</properties>

<build>
Expand Down Expand Up @@ -67,28 +66,27 @@ Contributors:
<configuration>
<workingDirectory>webapp</workingDirectory>
<nodeVersion>${node-version}</nodeVersion>
<yarnVersion>${yarn-version}</yarnVersion>
</configuration>
<executions>
<execution>
<?m2e ignore?>
<id>install node and yarn</id>
<id>install node and npm</id>
<goals>
<goal>install-node-and-yarn</goal>
<goal>install-node-and-npm</goal>
</goals>
</execution>
<execution>
<?m2e ignore?>
<id>yarn install</id>
<id>npm install</id>
<goals>
<goal>yarn</goal>
<goal>npm</goal>
</goals>
</execution>
<execution>
<?m2e ignore?>
<id>yarn build</id>
<id>npm build</id>
<goals>
<goal>yarn</goal>
<goal>npm</goal>
</goals>
<configuration>
<environmentVariables>
Expand All @@ -98,7 +96,7 @@ Contributors:
<VITE_APP_COMMIT_ID>${buildNumber}</VITE_APP_COMMIT_ID>
<VITE_APP_VERSION>${project.version}</VITE_APP_VERSION>
</environmentVariables>
<arguments>build</arguments>
<arguments>run build</arguments>
</configuration>
</execution>
</executions>
Expand All @@ -113,13 +111,10 @@ Contributors:
<properties>
<download-eclipse-path>/home/data/httpd/download.eclipse.org/leshan/</download-eclipse-path>
<download-remote-publish-path>genie.leshan@projects-storage.eclipse.org:${download-eclipse-path}</download-remote-publish-path>
<node-yarn-mirror-folder>build/mirror/</node-yarn-mirror-folder>
<node-folder>${node-yarn-mirror-folder}node/</node-folder>
<yarn-folder>${node-yarn-mirror-folder}yarn/</yarn-folder>
<mirror-folder>build/mirror/</mirror-folder>
<node-folder>${mirror-folder}node/</node-folder>
<node-download-root>https://nodejs.org/dist/</node-download-root>
<yarn-download-root>https://sourceforge.net/projects/yarn.mirror/files/</yarn-download-root>
<node-source-url>${node-download-root}${node-version}/node-${node-version}-linux-x64.tar.gz</node-source-url>
<yarn-source-url>${yarn-download-root}${yarn-version}/yarn-${yarn-version}.tar.gz</yarn-source-url>
<download-eclipse-url>https://download.eclipse.org/leshan/</download-eclipse-url>
</properties>
<build>
Expand All @@ -140,8 +135,6 @@ Contributors:
<commands>
<command>mkdir -p ${download-eclipse-path}${node-folder}${node-version}</command>
<command>wget -nc ${node-source-url} -P ${download-eclipse-path}${node-folder}${node-version}</command>
<command>mkdir -p ${download-eclipse-path}${yarn-folder}${yarn-version}</command>
<command>wget -nc ${yarn-source-url} -P ${download-eclipse-path}${yarn-folder}${yarn-version}</command>
</commands>
<displayCommandOutputs>true</displayCommandOutputs>
</configuration>
Expand All @@ -156,8 +149,7 @@ Contributors:
https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues/1032
https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues/3429#note_1184525
-->
<nodeDownloadRoot>${download-eclipse-url}${node-folder}</nodeDownloadRoot>
<yarnDownloadRoot>${download-eclipse-url}${yarn-folder}</yarnDownloadRoot>
<downloadRoot>${download-eclipse-url}${node-folder}</downloadRoot>
</configuration>
</plugin>
</plugins>
Expand Down
2 changes: 1 addition & 1 deletion leshan-demo-bsserver/src/main/resources/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<body>
<p>
If you are in development phase and run <strong>leshan-demo-bsserver</strong>
from your ide, you probably missed to launch <strong>yarn
from your ide, you probably missed to launch <strong>npm run
serve </strong> and/or <strong> you are not using the right port</strong>
to access to the demo, try <a href="http://localhost:8088/">http://localhost:8088/</a>
<br /> (see <a title="leshan-demo-bsserver README"
Expand Down
Loading

0 comments on commit 8ba229d

Please sign in to comment.