Issue while running sfpowerkit plugin in jenkins run time - groovy

after installing SFpower kit in run time, the plugin is able to compare two commit i'ds and generate delta package. But sometimes the Package.xml from the folder is getting copied to this delta package and sometimes package.xml is not getting copied and the end the Jenkins Job is getting failed.
script i'm using :
sh 'npm install sfdx-cli --global --force'
sh 'sfdx --version'
sh 'sfdx update'
sh 'echo y | sfdx plugins:install sfpowerkit'
sh 'sfdx sfpowerkit:project:diff --revisionfrom sourcecommiti'd --revisionto targetcommiti'd --output Delta_pkg/ --loglevel DEBUG'
In the below image the Package.xml got copied from git to delta package and the validation went successfulenter image description here
in the below logs the jenkins job is not able to copy the Package.xmlenter image description here
and the out put for the above build was as shown belowenter image description here
Sometimes when the package.xml is copied to delta_pkg the error is as shown in above image.
sfdx sfpowerkit:project:diff --revisionfrom bdad36ff4c7095686876518e9eb49184646442ae --revisionto 3c55f518f075fe4e266f71589d11c6b79f3343b4 --output Delta_pkg/ --loglevel DEBUG
Config folder does not exists, Creating Folder
sfpowerkit -- The DX#Scale Developer Toolkit - Version:6.0.1 - Release:November 22
Input Param: From: bdad36ff4c7095686876518e9eb49184646442ae To: 3c55f518f075fe4e266f71589d11c6b79f3343b4
SHA Found From: bdad36ff4c7095686876518e9eb49184646442ae
To: 3c55f518f075fe4e266f71589d11c6b79f3343b4
Fetching file list from target revision 3c55f518f075fe4e266f71589d11c6b79f3343b4
Copying file force-app\main\default\classes\PE_ApprovedEmailControllerTest.cls from git to Delta_pkg/
Copying file force-app\main\default\classes\PE_ResponseWrapper.cls from git to Delta_pkg/
Copying file force-app\main\default\lwc\adm_caseUnlocker\adm_caseUnlocker.html from git to Delta_pkg/
Copying file force-app\main\default\lwc\adm_cloneUser\adm_cloneUser.js from git to Delta_pkg/
Copying file force-app\main\default\lwc\csc_SearchInvoiceLine\csc_SearchInvoiceLine.html from git to Delta_pkg/
Copying file force-app\main\default\package.xml from git to Delta_pkg/
Generating output summary
Copying file .forceignore from git to Delta_pkg/
Copying file sfdx-project.json from git to Delta_pkg/
Output
BUILD FAILED
C:\Program Files (x86)\Jenkins\workspace\pocv1_PR-57\build.xml:66:
*********** DEPLOYMENT FAILED ***********
Request ID: 0Af6s00000knqgECAQ
All Component Failures:
package.xml -- Error: No package.xml found
package.xml -- Error: Bad file:XML document structures must start and end within the same entity.
*********** DEPLOYMENT FAILED ***********
Need some solution here.
Thanks in advance
I'm expecting the sfpower kit which i'm using in my jenkins should be able to pick the changes between 2 commit i'ds and output folder should also have package.xml and this output folder should be triggered for validation without any errors related to CICD.

Related

gitlab-runner failing to setup environment with submodules

in my project i have 2 submodules (both are maintained by us), for some reason when pushing our code into the CI the runners are all failing because:
Running with gitlab-runner 14.4.0 (4b9e985a)
on bv1 runner docker DcUNN4JN
Resolving secrets
00:00
Preparing the "docker" executor
Using Docker executor with image registry.gitlab.com/visionary.ai/brightervision/gitlab-cuda-trt-v2 ...
Authenticating with credentials from job payload (GitLab Registry)
Pulling docker image registry.gitlab.com/<company-name>/<repository>/gitlab-cuda-trt-v2 ...
Using docker image sha256:ASDFASDFSADFSDAF for registry.gitlab.com/<company-name>/<repository>/gitlab-cuda-trt-v2 with digest registry.gitlab.com/<company-name>/<repository>/gitlab-cuda-trt-v2#sha256:fgsdgsdfgsdfgdsfgsdfg ...
Preparing environment
00:07
Running on runner-dcunn4jn-project-30307801-concurrent-0 via bv1...
Getting source from Git repository
00:16
Fetching changes with git depth set to 1...
Reinitialized existing Git repository in /ci_builds/DcUNN4JN/0/<company-name>/<repository>/.git/
Checking out 09e4b628 as ci-add-bokeh...
Updating/initializing submodules recursively with git depth set to 1...
Synchronizing submodule url for 'jetson/isp-arc-implementations'
Synchronizing submodule url for 'models'
Entering 'jetson/isp-arc-implementations'
Entering 'models'
Entering 'jetson/isp-arc-implementations'
HEAD is now at b9480b7 cleanup
Entering 'models'
HEAD is now at 9c17371 Merge branch 'mar-22' into 'main'
fatal: refusing to merge unrelated histories
Unable to merge 'c90d7c8a3564ff09bb5e02513f28e64a688b325b' in submodule path 'jetson/isp-arc-implementations'
Uploading artifacts for failed job
00:09
Uploading artifacts...
WARNING: untracked: no files
ERROR: No files to upload
Cleaning up project directory and file based variables
00:06
ERROR: Job failed: exit code 1
our .gitmodules looks like this:
[submodule "models"]
path = models
url =../models.git
branch = main
[submodule "jetson/isp-arc-implementations"]
path = jetson/isp-arc-implementations
url = ../isp-arc-implementations.git
branch = main
we are all using linux OS (ubuntu18.04 distribution), couldn't find anything in the gitlab documentations nor anywhere else so i wanted to try my luck here,
if anyone has encountered this and knows how to solve it, it would be much appreciated
a few notes:
for some reason the submodule commit sha's don't match the ones we have on our repositories, but as far as i understand it should fetch the most recent one?
when going to the directory where the runner builds everything, i can't manually pull and update the submodules there (getting authentication errors, i read that the runner can't pull\push in gitlab)

How to Automatically upload a file to Azure DevOps repository through a release pipeline CMD task

I have created a release pipeline in Azure devops to generate the .dacpac file using CMD task in release pipeline. The .dacpac file is getting generated successfully when I am giving \tf: path as $(Agent.HomeDirectory). I want to give path of the folder in my repository where I would like to save the .dacpac file.
Below is the command which I tried to store the file on (Agent.HomeDirectory) and it runs fine.
C:\Program Files (x86)\Microsoft SQL Server\150\DAC\bin>sqlpackages.exe /Action:Extract /ssn:tcp:,1433 /sdn: /su: /sp: /tf:$(Agnet.HomeDirectory)/test.dacpac /p:Storage=File
Please guide me how we can store the file to repository folder from command line.
Thanks,
Sachin
Please refer to the following steps:
I created a release pipeline and added this repo: testproject, branch: test
Add CMD task, the script is as follows:
cd D:\a\r1\a_testproject
cd . > 001.txt // I create a test txt here. Please copy the file you need to the path. Or you can to use git to clone a repo in the path you want.
git config --global user.email "xxxx#mail.com"
git config --global user.name "xxxx"
git status
git add -A
git status
git commit -m "Latest updated"
git show-ref
git push -u origin HEAD:test //if the push step show the error: src refspec xxxx does not match any. please check the log and choose a rignt head
Allow scripts to access the OAuth token
set permission of the account {projectname} Build Service (orgname)
For more info ,please refer Copy file from CI Pipeline to Azure Devops Repository and How to add/update files in git repository from Azure DevOps Pipeline Dynamics 365 CE.

keytar.node causing issues in Buildkite pipeline

I'm trying to create a CI/CD pipeline using buildkite where the build steps runs on a Virtual Machine (Ubuntu). However, an npm package called keytar which is a dependency of tedious library is causing issues in the pipeline.
When running one of the steps from using the buildkite-agent, it tries to clean up an existing repository. And during the command git clean -fxdq it fails to remove keytar.node file due to a Permission denied Error.
Here's a full log of the step:
> Running global environment hook
> Setting up plugins
> Preparing working directory
$ cd /var/lib/buildkite-agent/builds/build-server-1/someorg/some-repo
# Host "bitbucket.org" already in list of known hosts at "/var/lib/buildkite-agent/.ssh/known_hosts"
$ git remote set-url origin git#bitbucket.org:someorg/some-repo.git
$ git clean -fxdq
warning: failed to remove node_modules/keytar/build/Release/keytar.node: Permission denied
# Removing /var/lib/buildkite-agent/builds/build-server-1/someorg/some-repo
⚠️ Warning: Checkout failed! Error running `/usr/bin/git clean -fxdq`: exit status 1 (Attempt 1/3 Retrying in 2s)
# Host "bitbucket.org" already in list of known hosts at "/var/lib/buildkite-agent/.ssh/known_hosts"
$ git clone -v -- git#bitbucket.org:someorg/some-repo.git .
fatal: destination path '.' already exists and is not an empty directory.
# Removing /var/lib/buildkite-agent/builds/build-server-1/someorg/some-repo
⚠️ Warning: Checkout failed! Error running `/usr/bin/git clone -v -- git#bitbucket.org:someorg/some-repo.git .`: exit status 128 (Attempt 2/3 Retrying in 2s)
# Host "bitbucket.org" already in list of known hosts at "/var/lib/buildkite-agent/.ssh/known_hosts"
$ git clone -v -- git#bitbucket.org:someorg/some-repo.git .
fatal: destination path '.' already exists and is not an empty directory.
# Removing /var/lib/buildkite-agent/builds/build-server-1/someorg/some-repo
⚠️ Warning: Checkout failed! Error running `/usr/bin/git clone -v -- git#bitbucket.org:someorg/some-repo.git .`: exit status 128 (Attempt 3/3 Retrying in 2s)
# Skipping artifact upload, no checkout
🚨 Error: Error running `/usr/bin/git clone -v -- git#bitbucket.org:someorg/some-repo.git .`: exit status 128
Upon examining the permissions on the folder /some-repo using the ls -l command the permissions seem to be drwxr-xr-x and the owner is buildkite-agent. I'm stumped as how this file does not get deleted while all other files get deleted without any issue.

Error with Command Line Script in Azure DevOps Pipeline

I'm building my first pipeline using Power Platform Build Tools. I'm trying to export a Dynamics model driven app to a repo. I'm getting an error with in my Command Line Script. The following is the error log:
2021-01-21T08:48:04.6191345Z ##[section]Starting: Command Line Script
2021-01-21T08:48:04.6292483Z
==============================================================================
2021-01-21T08:48:04.6292831Z Task : Command line
2021-01-21T08:48:04.6293131Z Description : Run a command line script using Bash on Linux and macOS
and cmd.exe on Windows
2021-01-21T08:48:04.6293422Z Version : 2.178.0
2021-01-21T08:48:04.6293630Z Author : Microsoft Corporation
2021-01-21T08:48:04.6293952Z Help :
https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
2021-01-21T08:48:04.6294293Z
==============================================================================
2021-01-21T08:48:05.7216764Z error: pathspec 'master' did not match any file(s) known to git
2021-01-21T08:48:05.7217182Z Generating script.
2021-01-21T08:48:05.7217463Z ========================== Starting Command Output
===========================
2021-01-21T08:48:05.7217952Z ##[command]"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL
"D:\a\_temp\93c0ac5e-da28-4265-b4d0-4326b5f38209.cmd""
2021-01-21T08:48:05.7218457Z commit all changes
2021-01-21T08:48:05.7218642Z push code to new repo
2021-01-21T08:48:05.7226781Z fatal: pathspec '-' did not match any files
2021-01-21T08:48:05.7227220Z error: pathspec 'export"' did not match any file(s) known to git
2021-01-21T08:48:06.2395991Z git: 'bearer' is not a git command. See 'git --help'.
2021-01-21T08:48:06.2983259Z ##[error]Cmd.exe exited with code '1'.
2021-01-21T08:48:06.3323471Z ##[section]Finishing: Command Line Script
Based on this output, I don't know what is missing.
According to your screenshots, your default branch is "main", not "master".
The master did not match any branches known to git, so the task failed.
In addition, you need to use origin/{branch} instead of {branch}. As the branch is a remote branch.
Error with Command Line Script in Azure DevOps Pipeline
This may be because your git command has wrong syntax.
According to the image you provided, we could to know the git command line you used is:
This is not the correct syntax to add all files, that also the reason why you get the error:
fatal: pathspec '-' did not match any files
If I use the same syntax git add —— all, I will get the same error message.
To resolve this error, please try to use following correct syntax:
git add --all
Besides, we could not use the AUTHORIZATION:BEARER with $(system.AccessToken), you need to use Authorization: Basic with Base64-encode:
Please check this thread for some more details.
That the reason why you get the error git: 'bearer' is not a git command..
To resolve this issue, you could use git command line with PAT directly to push the files:
git push https://<Your PAT>#dev.azure.com/<YourOrganization>/<YourProject>/_git/MyTestProject HEAD:master
In addition, what Jane said is another issue.

gitlab: git-http-push failed, return code 22

First of all my gitlab connection was broken by error 500 and 502. The server was unattended for a while. So i decided to reinstall:
#gitlab-ctl cleanse
#apt-get purge gitlab-ce
Installation:
https://about.gitlab.com/downloads/#ubuntu1404
After the gitlab was reachable and i could create a project and clone it.
After i tried to push a new file to my repo and got following message:
git add .
git commit -m "inital"
git push --set-upstream origin master
error: Cannot access URL http://<username>#gitlab.domain.de:<port>/group/project.git/, return code 22
fatal: git-http-push failed
error: failed to push some refs to 'http://<username>#gitlab.domain.de:<port>/group/project.git/'
The gitlab-check gives this information:
#gitlab-rake gitlab:check
everything was green, besides violett ones:
Uploads directory setup correctly? ... skipped (no tmp uploads folder yet)
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
Why i can clone but not push? I searched in several log-files, but got nothing useful.

Resources