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

[ONE-95]: Additional Mvn Options for NPM and Node #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions resources/default-properties.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ MAVEN_PUBLIC_SNAPSHOT_REPO_URL:
MAVEN_PRIVATE_RELEASE_REPO_URL:
MAVEN_PRIVATE_SNAPSHOT_REPO_URL:

# Additional Maven options
NODEJS_BUNDLE_REPO_URL:
NPM_RELEASE_REPO_URL:

# Gradle default directives
GRADLE_DEFAULT_COMMAND_OPTIONS:
GRADLE_DEFAULT_DIRECTIVES: clean build
Expand Down
6 changes: 5 additions & 1 deletion src/org/hitachivantara/ci/build/impl/MavenBuilder.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import static org.hitachivantara.ci.config.LibraryProperties.PR_STATUS_REPORTS
import static org.hitachivantara.ci.config.LibraryProperties.DOCKER_RESOLVE_REPO
import static org.hitachivantara.ci.config.LibraryProperties.DOCKER_PUBLIC_PUSH_REPO
import static org.hitachivantara.ci.config.LibraryProperties.DOCKER_PRIVATE_PUSH_REPO
import static org.hitachivantara.ci.config.LibraryProperties.NODEJS_BUNDLE_REPO_URL
import static org.hitachivantara.ci.config.LibraryProperties.NPM_RELEASE_REPO_URL

class MavenBuilder extends AbstractBuilder implements IBuilder, Serializable {

Expand Down Expand Up @@ -288,6 +290,8 @@ class MavenBuilder extends AbstractBuilder implements IBuilder, Serializable {
String jdk = buildData.getString(JENKINS_JDK_FOR_BUILDS)
String mavenOpts = "${BASE_OPTS} ${opts}"
String localRepoPath = "${buildData.getString(LIB_CACHE_ROOT_PATH)}/maven"
String nodeDownloadRoot = buildData.getString(NODEJS_BUNDLE_REPO_URL)
String npmDownloadRoot = buildData.getString(NPM_RELEASE_REPO_URL)
String deployCredentials = buildData.getString(ARTIFACT_DEPLOYER_CREDENTIALS_ID)
String scmApiTokenCredential = buildData.getString(SCM_API_TOKEN_CREDENTIALS_ID)

Expand All @@ -311,7 +315,7 @@ class MavenBuilder extends AbstractBuilder implements IBuilder, Serializable {
String localSettingsFile = item.settingsFile ?: settingsFile

if (item.containerized) {
process("${cmd} -V -s ${localSettingsFile} -Dmaven.repo.local='${localRepoPath}'", steps)
process("${cmd} -V -s ${localSettingsFile} -Dmaven.repo.local='${localRepoPath}' -DnodeDownloadRoot='${nodeDownloadRoot}' -DnpmDownloadRoot='${npmDownloadRoot}'", steps)
Copy link
Contributor

@cardosov cardosov Dec 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if nodeDownloadRoot and npmDownloadRoot are populated and if they are then add them to the cmd variable. That way we also cover the use case for non containerised builds.

And please add unit tests to cover this new work. Unit tests in the shared lib, to be clear.

} else {
steps.withMaven(
mavenSettingsFilePath: localSettingsFile,
Expand Down
5 changes: 5 additions & 0 deletions src/org/hitachivantara/ci/config/LibraryProperties.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ class LibraryProperties implements Serializable {
public static final String DOCKER_PUBLIC_PUSH_REPO = 'DOCKER_PUBLIC_PUSH_REPO'
public static final String DOCKER_PRIVATE_PUSH_REPO = 'DOCKER_PRIVATE_PUSH_REPO'

//**********************************
//** Properties for additional Maven options **
//**********************************
public static final String NODEJS_BUNDLE_REPO_URL = 'NODEJS_BUNDLE_REPO_URL'
public static final String NPM_RELEASE_REPO_URL = 'NPM_RELEASE_REPO_URL'

//******************
//** Credentials **
Expand Down