Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

sfdx sfpowerscripts:dependency:install fails when used with Prepare command #1276

Open
petter-eikeland opened this issue Mar 21, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@petter-eikeland
Copy link

Describe the bug
Trying to create a pool of scratch orgs with all external dependencies, and some packages. Currently I'm using the releaseConfigFile parameter to specify the packages I want installed. However, I had some issues specifying external dependencies in the releaseConfigFile. Thus, I tried adding the sfdx sfpowerscripts:dependency:install command using either the preDependencyInstallationScriptPath & postDeploymentScriptPath commands. This command successfully installs all external dependencies, but it fails as it messes up the prepare logs (see screenshots below).

I might be looking in the wrong direction, and could be that the releaseConfigFile parameter should also help resolve external dependencies? I have tried using the includeOnlyPackageDependencies & packageDependencies parameters in the releaseConfig YAML file. But this did not make the Prepare command install the external dependencies.

To Reproduce

  1. Create a new Prepare pipeline. Use releaseConfigFile parameter to install the packages that you want:
# List of packages that should be installed
release: "test-pool"
includeOnlyArtifacts:
  #-------------- Framework Packages------------#
  - nebula-logger-core
  - trigger-actions-framework

  #-------------- Core Packages------------#
  - core-components

  #-------------- Managed Dependencies ------------#

packageDependencies:
  - [email protected]
  - Marketing [email protected]

includeOnlyPackageDependencies:
  - bicx-core  # Has EDA & MC as dependency in sfdx-project.json
  1. Add sfdx sfpowerscripts:dependency:install command as a preDependencyInstallationScriptPath or postDeploymentScriptPath.
  2. Run the Prepare Pipeline

Expected behavior
Pool is successfully created without any errors. External dependencies are installed either by using includeOnlyPackageDependencies or packageDependencies parameters OR by using sfdx sfpowerscripts:dependency:install in a preDependencyInstallationScriptPath or postDeploymentScriptPath

Screenshots
image

Platform Details (please complete the following information):
OS: Linux
Version [e.g. CLI Version eg: 1.6.6] LATEST (20.26.3)
Salesforce CLI(sfdx cli) Version: 7.186.2
CI Platform: Azure DevOps

@github-actions github-actions bot added the analysis To be decided on how to solution/fix label Mar 21, 2023
@azlam-abdulsalam
Copy link
Contributor

azlam-abdulsalam commented Mar 21, 2023

@petter-eikeland when you use includeOnlyArtifacts. didn't it automatically install the dependency of the filtered artifacts?

@petter-eikeland
Copy link
Author

petter-eikeland commented Mar 21, 2023

@azlam-abdulsalam includeOnlyArtifacts: installs both the packages and dependencies of those packages automatically yes. But I want a pool with all external dependencies of the repo installed, but not all packages. E.g. I want all the external dependencies of the bicx-core package to be installed, but not deploy bicx-core if that makes sense? I thought perhaps the includeOnlyPackageDependencies is used for this?

@azlam-abdulsalam
Copy link
Contributor

it doesn't at the moment ☺️, missed the scenario!

This is more towards creation of the release definition where you have an option to install dependencies.

Will address this as a bug

@azlam-abdulsalam
Copy link
Contributor

now for the install dependency command when used directly, can you help me how did you set up the script?

@azlam-abdulsalam azlam-abdulsalam self-assigned this Mar 21, 2023
@azlam-abdulsalam azlam-abdulsalam added bug Something isn't working and removed analysis To be decided on how to solution/fix labels Mar 21, 2023
@petter-eikeland
Copy link
Author

Awesome! Thx for such swift help.

For the install dependency command, I did the following:

  1. Create a installPreDependencies.sh bash script for executing the dependency install script for all prepared scratch orgs:
#!/bin/bash
# Install all external dependencies
sfdx sfpowerscripts dependency install -u $1 -v $2
  1. Create release config for pool:
# List of packages that should be installed
release: "test-pool"
includeOnlyArtifacts:
  #-------------- Framework Packages------------#
  - nebula-logger-core
  - trigger-actions-framework

  #-------------- Core Packages------------#
  - core-components
  1. Create Config File for pool

{
	"$schema": "https://raw.githubusercontent.com/Accenture/sfpowerscripts/develop/packages/sfpowerscripts-cli/resources/schemas/pooldefinition.schema.json",
	"tag": "bicx-validate",
	"maxAllocation": 20,
	"expiry": 1,
	"batchSize": 10,
	"configFilePath": "config/project-scratch-def.json",
	"enableSourceTracking": false,
	"succeedOnDeploymentErrors": false,
	"installAll": true,
	"releaseConfigFile": ".azure-pipelines/release-definitions/pool/bicx-pool-preinstalled-packages.yml",
	"preDependencyInstallationScriptPath":"./.azure-pipelines/scripts/installPreDependencies.sh",
	"fetchArtifacts": {
		"npm": {
			"scope": "@org"
		}
	}
}
  1. Run sfdx sfpowerscripts:orchestrator:prepare -f config/bicx-pool-def.json -v devhub --npmrcpath $(npmrc.secureFilePath)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
2 participants