Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: prozelit on December 06, 2022, 07:21:24 pm
-
Hello. I wrote a powershell script that updates the local working copy of the Package file.
It works locally. But when this is run in CI I get the error Сould not find connection to version control provider
Gitlab runner run from system
Here is a simplified (without recursion) part of the script
svn checkout **** $newPath --non-interactive --trust-server-cert --username $USERNAME --password $PASSWORD
$app = New-Object -ComObject "EA.App" -Strict
$app.Repository.OpenFile($file_path)
$first_root_model = $app.Repository.Models.GetAt(0)
$root_guid = $first_root_model.PackageGUID
$package = $app.Repository.GetPackageByGuid($root_guid)
svn-auth
$package.VersionControlGetLatest($true)
$package.GetLastError()
After this command
$package.VersionControlGetLatest($true)
I get
Object reference not set to an instance of an object.
At C:\Windows\TEMP\build_script3916629379\script.ps1:312 char:5
+ $package.VersionControlGetLatest($true)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], NullReferenceException
+ FullyQualifiedErrorId : System.NullReferenceException
After this command
$package.GetLastError()
I get
Could not find connection to version control provider
Authorization data is stored in a file. svn auth outputs
Credentials cache in 'C:\Windows\system32\config\systemprofile\AppData\Roaming\Subversion' contains 1 credential
How to fix this problem?
-
You are doing some weird stuff.
$first_root_model = $app.Repository.Models.GetAt(0)
$root_guid = $first_root_model.PackageGUID
$package = $app.Repository.GetPackageByGuid($root_guid)
Here you already have the package object you need in $first_root_model, but you still get it again using it's guid. Why?
Apart from that I'm guessing you have a problem because the user running the script does not have the correct configurations or authorizations to connect to the version control provider.
Geert