Azure DevOps Project pipeline not able to access NuGet package from Artifact Feed in different Collection - .net-core

Our organization has two separate collections
Application Development
Foobar Inc (Project)
Repo / Build pipeline (Pipeline)
External Applications (Collection)
External Applications (Project)
Artifacts
XYZ_SharedPackages (Nuget feed)
When I run the restore command for a project in Appliction Development for the Foobar Inc project I get
"C:\agent\_work\76\s\Foobar_Inc\Foobar_IncUI\Foobar_IncUI.csproj" (Restore target) (1) ->
(Restore target) ->
C:\Program Files\dotnet\sdk\6.0.200\NuGet.targets(130,5): error : Unable to load the service index for source
http://svp042iis/tfs/Application%20Development/_packaging/XYZ_SharedPackages/nuget/v3/index.json.
[C:\agent\_work\76\s\Foobar_Inc\Foobar_IncUI\Foobar_IncUI.csproj]
C:\Program Files\dotnet\sdk\6.0.200\NuGet.targets(130,5): error : Response status code does not indicate
success: 404 (Not Found - The feed with ID 'XYZ_SharedPackages' doesn't exist. (DevOps Activity ID: 5C76EC84-96B7-4125-BA30-296CF33B1754)).
[C:\agent\_work\76\s\Foobar_Inc\Foobar_IncUI\Foobar_IncUI.csproj]
The 404 error is coming from the source not existing, however I selected that feed by going into the restore command and selecting that option under feeds to use. My question is, does anyone know if it's possible to share across collections in dev ops.

If your two organziations are NOT in same AAD, you can follow below methods:
Method1:
You can use a NuGet authenticate task and a powershell task to run the nuget install command in the pipeline with the Feed URL of the target feed.
Create a Nuget Service connection to the target organization.
Target feed URL:https://pkgs.dev.azure.com/{orgname}/_packaging/{feedname}/nuget/v3/index.json, The password is PAT.
2.Add NuGet authenticate task before your restore.
Use the powershell task in line script.The in line script :
nuget install {package name} -version {package version} -Source https://pkgs.dev.azure.com/{orgname}/_packaging/{feedname}/nuget/v3/index.json.
It will restore the package successfully.
Method 2:
Directly use a powershell task with inline script:
nuget install {package name} -version {package version} -Source https://pkgs.dev.azure.com/{orgname}/_packaging/{feedname}/nuget/v3/index.json.
The two Environment Variables needs to be set:
• NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED=true
• VSS_NUGET_EXTERNAL_FEED_ENDPOINTS= {"endpointCredentials": [{"endpoint":"https://pkgs.dev.azure.com/{orgname}/_packaging/{feedname}/nuget/v3/index.json", "username":"optional", "password":"$(PAT)"}]}
If your two organizations are in same AAD, you can follow below steps:
Please check the permissions in Feed Settings -> Views. Then change the access permissions for Local view in more options-> edit, choose “All feeds and people in organizations associated with my Azure Active.
Setup upstream resource :
On the upstream feed, add project collection build service account as contributor or collab or owner role.

Related

AWS Amplify build failing - Failed to get profile: Profile configuration is missing for: amplify

I have an AWS-Amplify project that had been building without a problem but is now failing.
# Starting phase: build
2021-11-20T00:40:02.506Z [INFO]: [31mFailed to get profile: Profile configuration is missing for: amplify[39m
2021-11-20T00:40:02.564Z [ERROR]: !!! Build failed
2021-11-20T00:40:02.564Z [ERROR]: !!! Non-Zero Exit Code detected
2021-11-20T00:40:02.564Z [INFO]: # Starting environment caching...
2021-11-20T00:40:02.565Z [INFO]: # Environment caching completed
Terminating logging...
The problem seemed to start after I made an error doing a pull request (in the wrong direction!), however, the problem has persisted despite reverting back to an earlier commit.
I have also ensured all the Amplify code is up to date amplify pull, as well as trying amplify configure and amplify init on my development machine.
Other posts that describe problems with 'Profile Configuration' seem to be related to the development machine and setting up the CLI. This failure is happening when I try to build on AWS using continuous deploys, building locally works fine.
so i got it to work.
Just delete the aws-exports.json and the amplify folder.
Then run the command from amplify which is something like:
amplify pull --appId XXXXXXXXXXX --envName dev
After a few mins, it will prompt you to select:
AWS PROFILE
AWS KEYS
select AWS KEYS
enter credentials for a programmatic user and it should be fine

Trying to push a nuget package to our private feed. Getting ' load failed: error:02001003:system library:fopen:No such process'

We have an on premise instance of DevOps Server 2020. I have a dotnet standard 2.0 library that I am trying to push to our internal nuget feed.
I am getting the error unable to get local issuer certificate. I followed the instructions here:Azure DevOps Server pipeline build fails when using self-signed SSL certificate with "unable to get local issuer certificate" during NuGet restore
But now I am getting the error (node:6056) Warning: Ignoring extra certs from C:\Certs\root.crt, load failed: error:02001003:system library:fopen:No such process
Here is the YAML where I am setting the path to the root cert:
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
NODE.EXTRA.CA.CERTS: 'C:\Certs\root.crt'
And here is the YAML where I am packing and pushing the Nuget package:
- task: DotNetCoreCLI#2
inputs:
command: 'pack'
packagesToPack: '**/*.csproj'
versioningScheme: 'off'
- task: DotNetCoreCLI#2
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: 'b4b089f9-ff2f-4b74-9690-ec6082a4872b'
unable to get local issuer certificate
To resolve this issue, you could try to manually acquire the version of NuGet.exe you wish to use (like nuget.exe v5.9.1) and put it on the private agent in a folder that's on the PATH.
Download NuGet.exe tool to that agent machine manually(e.g.
d:\tool\nuget.exe).
Open System Properties window > Advance > Environment variables.
In System variables section, click New button > Variable name: nuget;
Variable value: d:\tool > Click Ok.
Select Path variable > Edit > add/append %nuget% item (the result
will be xxxx;%nuget%) Restart your machine.
After that you can remove NuGet Tool Installer task from build definition.
If it not work for you, try to running ".\externals\nuget\nuget.exe update -self" for the private agent install folder on the agent machine and getting an update version, it works again with the local certificate store:
You could check this thread for some more details.

Symfony console output creates extra unwanted characters

i got this weird error, where every output in the console with symfony creates some extra characters. The following is the output after a basic symfony in the console.
$ symfony
←[32mSymfony CLI←[39m version ←[33mv4.22.0←[39m (c) 2017-2021 Symfony SAS
Symfony CLI helps developers manage projects, from local code to remote infrastructure
These are common commands used in various situations:
←[33mWork on a project locally←[39m
←[32mnew←[39m Create a new Symfony project
←[32mserve←[39m Run a local web server
←[32mserver:stop←[39m Stop the local web server
←[32msecurity:check←[39m Check security issues in project dependencies
←[32mcomposer←[39m Runs Composer without memory limit
←[32mconsole←[39m Runs the Symfony Console (bin/console) for current project
←[32mphp, pecl, pear, php-fpm, php-cgi, php-config, phpdbg, phpize←[39m Runs the named binary using the configured PHP version
←[33mManage a project on Cloud←[39m
←[32mlogin←[39m Log in with your SymfonyConnect account
←[32minit←[39m Initialize a new project using templates
←[32mlink←[39m Link current git repository to a SymfonyCloud project
←[32mprojects←[39m List active projects
←[32menvs←[39m List environments
←[32menv:create←[39m Create an environment
←[32mtunnel:open←[39m Open SSH tunnels to the app's services
←[32mssh←[39m Open an SSH connection to the app container
←[32mdeploy←[39m Deploy an environment
←[32mdomains←[39m List domains
←[32mvars←[39m List variables
←[32muser:add←[39m Add a user to the project
Show all commands with ←[32msymfony.exe help←[39m,
Get help for a specific command with ←[32msymfony.exe help COMMAND←[39m.
As you can see, I get this ←[33m here and there. Any help is gratefully accepted. Please let me know if you need any additional information from me.
$ bin/console --version
Symfony 5.2.1 (env: dev, debug: true)

SBT Basic Auth Problems

I'm setting up SBT on our buildserver (bamboo) for multiple buildagents. For this I created for each agent a separate directory which contains the agent specific config and the .ivy home to make sure agent isolation is fullfilled.
The build itself is call like this:
/sbt-launcher-packaging-0.13.13/bin/sbt -java-home /usr/lib/jvm/jdk1.7.0_79 -Dsbt.override.build.repos=true -Dsbt.repository.config=/data/bamboo/localbuildagents/${bamboo.agentId}/sbt/sbt.conf -Dsbt.ivy.home=/data/bamboo/localbuildagents/${bamboo.agentId}/.ivy2 clean compile dist
The credentials (basic realm) are store under the user home which is starting the bamboo server (~/.sbt/.credentials and ~/.sbt/0.13/plugins/credentials.sbt)
Each sbt.conf contains the agent-specific repos e.g the agent specific local maven repo and urls for the remote artifactory.
[repositories]
local-buildagent-mvn: file:///data/bamboo/home/.m2/AGENT-xxxxxxxx/repository/
ivy-release: http://xxx/artifactory/ivy-release/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
mvn-release: http://xxx/artifactory/libs-release/
mvn-snapshot: http://xxx/artifactory/libs-snapshot/
[ivy]
ivy-home: file:///data/bamboo/localbuildagents/xxxxxxxx/.ivy2/
I'm encountering login problems while sbt is checking the remote artifactory repos (first http error 401 and then surprisingly 403). A curl with the same credentials and repo url is working as expected (first 401 and then 200).
I guess, that if -D switches are used for sbt startup, the credentials are not considered. I'm really stuck any advise warmly welcome...
From your question I don't see if you specified where your credentials are defined. In case you didn't do it, you must add something like this to your build definition (documentation):
// inline
credentials += Credentials("Some Nexus Repository Manager", "my.artifact.repo.net", "admin", "admin123")
// file
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")

Web setup project fails to install dynamic-data site: "the installer was interrupted"

The last phase of the installer fails with this message:
Installation Incomplete
The installer was interrupted before [project] could be installed. You need to restart the installer to try again.
Running msiexec /i installer.msi /l*vx setup.log shows the following entries in the setup log:
INFO : [...] [ApplyWebFolderProperties]: Getting web folder property token...
INFO : [...] [ApplyWebFolderProperties]: Token is '/LM/W3SVC/1/ROOT/ProjectDir/DynamicData/Filters'.
INFO : [...] [ApplyWebFolderProperties]: Getting METADATA_HANDLE for the directory '/LM/W3SVC/1/ROOT/ProjectDir/DynamicData/Filters'.
ERROR : [...] [ApplyWebFolderProperties]: FAILED: -2147024893
ERROR : [...] [ApplyWebFolderProperties]: FAILED: -2147024893
ERROR : [...] [ApplyWebFolderProperties]: Custom Action failed with code: '3'
ERROR : [...] [ApplyWebFolderProperties]: Custom Action failed with code: '3'
INFO : [...] [ApplyWebFolderProperties]: Custom Action completed with return code: '3'
The same web application had no problems being installed with a web setup project before. The issue started after upgrading the web application from .NET 3.5 SP1 to .NET 4.0.
This blog entry points out the issue:
Which got me started thinking, I have
a subfolder named filters. Changing
nothing else but renaming the filters
subfolder made it finish properly. I'm
assuming you might have the same
problems with folders named apppools,
info, or 1 as well.
(Emphasis mine)
Unfortunately, Filters is a hard-coded folder name in Dynamic Data. If you look at FilterFactory, there doesn't appear to be any way to override that value, seeing as how the FilterFactory property of MetaModel is not marked virtual. If we can't change the folder name, then we have to look at fixing the installer...
The installer error is being raised by the ApplyWebFolderProperties custom action. That action isn't built-in to Windows Installer—it's added by the Web Setup Project. That's helpful, because it means we can remove it with WiRunSQL.vbs:
cscript WiRunSQL.vbs installer.msi "DELETE FROM CustomAction WHERE Action='WEBCA_ApplyWebFolderProperties'"
Note that the actual name of ApplyWebFolderProperties is WEBCA_ApplyWebFolderProperties. Seeing as how the action doesn't appear to be documented anywhere, caveat emptor. It doesn't appear to be too terribly important though.
To automate the workaround, you could add the command to the setup project's PostBuildEvent like so:
cscript.exe "$(ProjectDir)..\WiRunSQL.vbs" "$(BuiltOuputPath)" "DELETE FROM CustomAction WHERE Action='WEBCA_ApplyWebFolderProperties'"
If anyone knows a better way to install a folder named Filters, I'd love to hear it.

Resources