Skip to content
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

[DCA11Y-1145] Node version manager support #4

Open
wants to merge 73 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
d2f488e
DCA11Y-1145: add tests for nvm and fnm
flipatlas Sep 16, 2024
0a771db
DCA11Y-1145: add node version manager support to node and npm installers
flipatlas Sep 16, 2024
a883c9c
DCA11Y-1145: fix setup for npm goal
flipatlas Sep 16, 2024
46b8a10
DCA11Y-1145: small CR tweaks
flipatlas Sep 19, 2024
348cd57
Issue/master/dca11 y 1145 node version manager support 2 (#5)
flipatlas Sep 19, 2024
c772fad
DCA11Y-1145: add test for yarn with fnm
flipatlas Sep 19, 2024
4180868
DCA11Y-1145: enable node version manager support by default
flipatlas Sep 19, 2024
b04f793
DCA11Y-1145: add NVS support
flipatlas Sep 19, 2024
bea814f
DCA11Y-1145: fix bun default setup
flipatlas Sep 19, 2024
5b8e67b
DCA11Y-1145: try with bash
flipatlas Sep 19, 2024
8ba94c9
DCA11Y-1145: run prebuild installation with bash
flipatlas Sep 19, 2024
7d36ade
DCA11Y-1145: mise support
flipatlas Sep 20, 2024
111d2f6
DCA11Y-1145: asdf support
flipatlas Sep 20, 2024
d946a7a
restructure invoker tests to be hierarchical and share invoker.proper…
flipatlas Sep 20, 2024
8a6d23c
DCA11Y-1145: use node version manager configured node version instead…
flipatlas Sep 20, 2024
cbf1733
DCA11Y-1145: fix java docs
flipatlas Sep 20, 2024
0e2c515
DCA11Y-1145: fail quickly when nvm can't fails, e.g. no versioning fi…
flipatlas Sep 20, 2024
f4a7b64
DCA11Y-1145: verify node version before installation
flipatlas Sep 20, 2024
729d407
DCA11Y-1145: cover test case with project with submodules
flipatlas Sep 20, 2024
b87ffe6
Merge branch 'master' into issue/master/DCA11Y-1145-node-version-mana…
flipatlas Sep 27, 2024
0c47434
DCA11Y-1145: add changelog and README.md
flipatlas Sep 27, 2024
1c5012a
DCA11Y-1145: fix test declarations
flipatlas Sep 27, 2024
8afed90
DCA11Y-1145: fall back to standard installation if no nvm found
flipatlas Sep 27, 2024
09c3b61
DCA11Y-1145: fix webpack mojo
flipatlas Sep 30, 2024
d65fdf0
Merge branch 'master' into issue/master/DCA11Y-1145-node-version-mana…
flipatlas Sep 30, 2024
5c58f3b
DCA11Y-1145: handle empty node version
flipatlas Sep 30, 2024
02f0008
DCA11Y-1145: move version setting to node installer
flipatlas Sep 30, 2024
e1f5598
DCA11Y-1145: extract node install mojo
flipatlas Sep 30, 2024
25a2d87
DCA11Y-1145: disable node version manager on file version tests
flipatlas Sep 30, 2024
1774147
DCA11Y-1145 node version manager support aui shell (#13)
flipatlas Oct 11, 2024
aa43844
DCA11Y-1145: chore: prepare for release of 1.15.0-atlassian-1-1774147f
flipatlas Oct 11, 2024
699476a
DCA11Y-1145: chore: clean up versions after release
flipatlas Oct 11, 2024
2b6a4f9
DCA11Y-1145: try shell without login for BB
flipatlas Oct 14, 2024
4e13098
DCA11Y-1145: chore: prepare for release 1.15.0-atlassian-1-2b6a4f95
flipatlas Oct 14, 2024
6a5a0eb
DCA11Y-1145: chore: clean up after release
flipatlas Oct 14, 2024
32f24e1
DCA11Y-1145: test: fnm with preinstalled node version
flipatlas Oct 14, 2024
f2b2fe1
DCA11Y-1145: source profile files manually + add dockerfiles for fnm …
flipatlas Oct 14, 2024
1144f26
DCA11Y-1145: dockerfiles for mise and nvs
flipatlas Oct 14, 2024
ca346b8
DCA11Y-1145: add node version check for debugging
flipatlas Oct 14, 2024
25d28da
DCA11Y-1145: chore: prepare for release 1.15.0-atlassian-1-ca346b89
flipatlas Oct 14, 2024
2a8065f
DCA11Y-1145: chore: clean up version after release
flipatlas Oct 14, 2024
26753ea
DCA11Y-1145: doc: add current limitation with nvms
flipatlas Oct 15, 2024
1182003
DCA11Y-1145: chore: try running fnm directly
flipatlas Oct 28, 2024
8ece418
DCA11Y-1145: chore: Prepare for release of 1.15.0-atlassian-1-11820033
flipatlas Oct 28, 2024
b418b20
DCA11Y-1145: chore: clean up after release
flipatlas Oct 28, 2024
d8b40b6
DCA11Y-1145: refactor: use shell only if node version manager require…
flipatlas Oct 28, 2024
6ddef59
fix fnm install (#15)
flipatlas Oct 29, 2024
22f9ba8
Merge branch 'master' into issue/master/DCA11Y-1145-node-version-mana…
flipatlas Nov 22, 2024
60125f1
fix after merge
flipatlas Nov 22, 2024
9103d2e
use version manager installation directory
flipatlas Nov 22, 2024
fff25fe
use version manager installation directory (asdf)
flipatlas Nov 22, 2024
e7125aa
use version manager installation directory (mise)
flipatlas Nov 22, 2024
05d12fb
use version manager installation directory (nvm)
flipatlas Nov 22, 2024
b1c76cc
use version manager installation directory (nvs)
flipatlas Nov 22, 2024
99beb02
clean up
flipatlas Nov 22, 2024
30afd62
fix fnm install
flipatlas Nov 22, 2024
d6fb44b
fix fnm install
flipatlas Nov 22, 2024
667c661
clean up abstractions
flipatlas Nov 22, 2024
48f6b7a
install correct node version for webpack
flipatlas Nov 22, 2024
0c3e834
chore: prepare for release of 1.15.1-atlassian-1-48f6b7a
flipatlas Nov 22, 2024
eabb449
chore: clean up after release
flipatlas Nov 25, 2024
6f623e1
clean up documentation
flipatlas Nov 25, 2024
1f0a3e7
install custom npm in nvm
flipatlas Dec 6, 2024
9e87cb2
Merge branch 'master' into issue/master/DCA11Y-1145-node-version-mana…
flipatlas Dec 6, 2024
0abce14
fix custom node assertion
flipatlas Dec 6, 2024
5a27505
try fix mise
flipatlas Dec 6, 2024
7b03cc8
revert AbstractNodeMojo.java
flipatlas Dec 6, 2024
70d139c
update mise client
flipatlas Dec 6, 2024
b9364f6
chore: prepare for release 1.15.1-atlassian-4-70d139cc
flipatlas Dec 6, 2024
0b29e57
chore: clean up after release
flipatlas Dec 6, 2024
c965cd2
minor tweaks based on CR
flipatlas Dec 9, 2024
c181728
configure installed node directory
flipatlas Dec 9, 2024
2169154
fix npe
flipatlas Dec 9, 2024
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
1 change: 1 addition & 0 deletions .java-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.8
21 changes: 21 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Developing

## Running tests locally

### Run all invoker tests

`mvn verify -PintegrationTests`

### Run single invoker test

`mvn verify -PintegrationTests -Dinvoker.test=<test-pattern>`

## Docker images with node version managers

### Build docker image

`docker build -f docker/<node-version-manager>/Dockerfile -t fmp-local/base-with-<node-version-manager> ./docker`

### Run project with docker image

e.g. `docker run --rm -it -v $(pwd):/source -v ~/.m2:/root/.m2 fmp-local/base-with-<node-version-manager>` will mount project into /source directory
8 changes: 8 additions & 0 deletions FORK_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## [1.15.1-atlassian-4] - 2024-12-06

### Added
- [DCA11Y-1145]: Added support for using already installed node from default install directory of node version manager (fnm, mise, asdf, nvm, nvs). Use of version manager is enabled by default and can be controlled with `useNodeVersionManager` configuration property.

### Changed
- [DCA11Y-1145]: `nodeVersion` property is not required any more, if `useNodeVersionManager` is not set to false

## [1.15.1-atlassian-3] - 2024-11-29

### Fixed
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ Only Atlassians may release a new version, [follow this guide](https://hello.atl

## Usage guidance

### Using Node Version Manager

By default, node based goals will try to use a node available from one of supported node version managers (`fnm`, `mise`, `asdf`, `nvm`, `nvs`). If a given node version is not available `frontend-maven-plugin` will fallback to standard installation. You can disable this behaviour with `useNodeVersionManager` configuration property.

### Format of the Node version

It shouldn't matter if the `v` prefix is present, e.g. `14.8.0` and `v14.8.0`.
Expand Down
46 changes: 46 additions & 0 deletions docker/fnm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM docker.atl-paas.net/sox/buildeng/agent-baseagent:latest

ARG MAVEN_VERSION=3.9.6
ARG NODE_VERSION=20.11.0
ARG YARN_VERSION=1.22.19
ARG NODE_GYP_VERSION=10.0.1

USER root
ENV HOME /root

#install all needed dependencies for common build and testing tools for AUI, WRM, etc.
RUN apt-get update -y \
&& apt-get install --no-install-recommends -y \
apt-utils \
bzip2 \
curl \
fontconfig \
libgtk2.0-0 \
libgtk-3-0 \
libgbm-dev \
libnotify-dev \
libgconf-2-4 \
libnss3 \
libxss1 \
libasound2 \
libxtst6 \
libxss1 \
vim \
xauth \
xmlstarlet \
xvfb \
zip \
&& rm -rf /var/lib/apt/lists/*

# Remobve "global" node
RUN rm /usr/bin/node \
&& rm -rf /usr/lib/node_modules

# Prebake latest maven
RUN cd $HOME \
&& echo "mvn_version=$MAVEN_VERSION" > mvnvm.properties \
&& mvn --version \
&& rm mvnvm.properties

# Install node version manager
RUN curl -fsSL https://fnm.vercel.app/install | bash
46 changes: 46 additions & 0 deletions docker/mise/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM docker.atl-paas.net/sox/buildeng/agent-baseagent:latest

ARG MAVEN_VERSION=3.9.6
ARG NODE_VERSION=20.11.0
ARG YARN_VERSION=1.22.19
ARG NODE_GYP_VERSION=10.0.1

USER root
ENV HOME /root

#install all needed dependencies for common build and testing tools for AUI, WRM, etc.
RUN apt-get update -y \
&& apt-get install --no-install-recommends -y \
apt-utils \
bzip2 \
curl \
fontconfig \
libgtk2.0-0 \
libgtk-3-0 \
libgbm-dev \
libnotify-dev \
libgconf-2-4 \
libnss3 \
libxss1 \
libasound2 \
libxtst6 \
libxss1 \
vim \
xauth \
xmlstarlet \
xvfb \
zip \
&& rm -rf /var/lib/apt/lists/*

# Remobve "global" node
RUN rm /usr/bin/node \
&& rm -rf /usr/lib/node_modules

# Prebake latest maven
RUN cd $HOME \
&& echo "mvn_version=$MAVEN_VERSION" > mvnvm.properties \
&& mvn --version \
&& rm mvnvm.properties

RUN curl https://mise.run | bash \
&& echo 'eval "$(~/.local/bin/mise activate bash)"' >> ~/.bashrc
45 changes: 45 additions & 0 deletions docker/nvm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FROM docker.atl-paas.net/sox/buildeng/agent-baseagent:latest

ARG MAVEN_VERSION=3.9.6
ARG NODE_VERSION=20.11.0
ARG YARN_VERSION=1.22.19
ARG NODE_GYP_VERSION=10.0.1

USER root
ENV HOME /root

#install all needed dependencies for common build and testing tools for AUI, WRM, etc.
RUN apt-get update -y \
&& apt-get install --no-install-recommends -y \
apt-utils \
bzip2 \
curl \
fontconfig \
libgtk2.0-0 \
libgtk-3-0 \
libgbm-dev \
libnotify-dev \
libgconf-2-4 \
libnss3 \
libxss1 \
libasound2 \
libxtst6 \
libxss1 \
vim \
xauth \
xmlstarlet \
xvfb \
zip \
&& rm -rf /var/lib/apt/lists/*

# Remobve "global" node
RUN rm /usr/bin/node \
&& rm -rf /usr/lib/node_modules

# Prebake latest maven
RUN cd $HOME \
&& echo "mvn_version=$MAVEN_VERSION" > mvnvm.properties \
&& mvn --version \
&& rm mvnvm.properties

RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
47 changes: 47 additions & 0 deletions docker/nvs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM docker.atl-paas.net/sox/buildeng/agent-baseagent:latest

ARG MAVEN_VERSION=3.9.6
ARG NODE_VERSION=20.11.0
ARG YARN_VERSION=1.22.19
ARG NODE_GYP_VERSION=10.0.1

USER root
ENV HOME /root

#install all needed dependencies for common build and testing tools for AUI, WRM, etc.
RUN apt-get update -y \
&& apt-get install --no-install-recommends -y \
apt-utils \
bzip2 \
curl \
fontconfig \
libgtk2.0-0 \
libgtk-3-0 \
libgbm-dev \
libnotify-dev \
libgconf-2-4 \
libnss3 \
libxss1 \
libasound2 \
libxtst6 \
libxss1 \
vim \
xauth \
xmlstarlet \
xvfb \
zip \
&& rm -rf /var/lib/apt/lists/*

# Remobve "global" node
RUN rm /usr/bin/node \
&& rm -rf /usr/lib/node_modules

# Prebake latest maven
RUN cd $HOME \
&& echo "mvn_version=$MAVEN_VERSION" > mvnvm.properties \
&& mvn --version \
&& rm mvnvm.properties

RUN export NVS_HOME="$HOME/.nvs" \
&& git clone https://github.com/jasongin/nvs "$NVS_HOME" \
&& . "$NVS_HOME/nvs.sh" install
8 changes: 7 additions & 1 deletion frontend-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>3.6.0</version>
<version>3.8.0</version>

<configuration>
<debug>true</debug>
Expand All @@ -132,6 +132,12 @@
<filterProperties>
<repository.proxy.url>${repository.proxy.url}</repository.proxy.url>
</filterProperties>
<pomIncludes>
<pomInclude>**/pom.xml</pomInclude>
</pomIncludes>
<pomExcludes>
<pomExclude>**/sub*/pom.xml</pomExclude>
</pomExcludes>
</configuration>

<executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

<configuration>
<installDirectory>target</installDirectory>
<useNodeVersionManager>false</useNodeVersionManager>
</configuration>

<executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

<configuration>
<workingDirectory>src/main/frontend</workingDirectory>
<useNodeVersionManager>false</useNodeVersionManager>
</configuration>

<executions>
Expand Down
4 changes: 4 additions & 0 deletions frontend-maven-plugin/src/it/example project/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
<!-- NB! Set <version> to the latest released version of frontend-maven-plugin, like in README.md -->
<version>@project.version@</version>

<configuration>
<useNodeVersionManager>false</useNodeVersionManager>
</configuration>

<executions>

<execution>
Expand Down
1 change: 1 addition & 0 deletions frontend-maven-plugin/src/it/node-provided-npm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

<configuration>
<installDirectory>target</installDirectory>
<useNodeVersionManager>false</useNodeVersionManager>
</configuration>

<executions>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 20.15.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# invoker env variables are not loaded yet
export HOME="$(dirname "$0")"

export ASDF_DIR="$HOME/.asdf";
mkdir "$ASDF_DIR"
echo "ASDF_DIR set: $ASDF_DIR";

git clone https://github.com/asdf-vm/asdf.git "$ASDF_DIR" --branch v0.14.1
echo "ASDF checked out";

. "$HOME/.asdf/asdf.sh" \
&& asdf plugin add nodejs \
&& asdf install nodejs v20.15.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
invoker.environmentVariables.HOME=${basedir}/target/it/node-version-manager/asdf
invoker.environmentVariables.ASDF_DIR=${basedir}/target/it/node-version-manager/asdf/.asdf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "example",
"version": "0.0.1",
"dependencies": {
"classnames": "^2.3.2"
},
"scripts": {
"prebuild": "npm install"
}
}
Loading
Loading