Generate the sfdx content in source format and destructive change from two git commits
Hello I wonder if anyone have encountered a problem like this, I wasn't able to find a registered issue.
I'm using Bitbucket Pipelines to do some simple SFDX CI and in my bash script i run a commandsfdx sgd:source:delta --to "$BITBUCKET_PR_DESTINATION_BRANCH" --from "$BITBUCKET_BRANCH" --output "."
and when I do this i receive{
"error": "The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received null",
"output": ".",
"success": false,
"warnings": []
}
versions:
NODE: 17.2.0
SFDX-CLI: 7.131.0
SFDX-GIT-DELTA: 4.11.0
I would appreciate any help/
git log "$BITBUCKET_PR_DESTINATION_BRANCH"
I think I'm not using any such flag mentioning fetch depth. I'm no expert. :) Here is the part of the job which is running during validation.
trigger:
batch: "true"
branches:
include:
- develop
paths:
exclude:
- azure-pipelines.yml
- azure-pipelines POC.yml
pr:
autoCancel: "true"
branches:
include:
- develop
paths:
exclude:
- README.md
- azure-pipelines.yml
- azure-pipelines POC.yml
pool:
vmImage: ubuntu-latest
jobs:
- job: Validating_JOB
steps:
- task: NodeTool@0
inputs:
versionSpec: '14.x'
checkLatest: true
- bash:
npm install sfdx-cli --global
displayName: Install Salesforce CLI
- bash:
echo y | sfdx plugins:install sfdx-git-delta
displayName: Installing sfdx-git-delta plugin
- bash:
sfdx sgd:source:delta --from $(System.PullRequest.SourceBranch) --to $(System.PullRequest.TargetBranch) --output .
displayName: Generating package.xml
- bash:
cat package/package.xml
displayName: package.xml generated with added and modified metadata
- bash:
sfdx force:auth:jwt:grant --clientid $(salesforceClientId) --jwtkeyfile ./buildfiles/server.key --username $(salesforceUserName) --instanceurl $(sandboxURL) -a devOrg
displayName: Authorize QA salesforce org
- bash:
sfdx force:source:deploy -x package/package.xml -w 1000 -u devOrg -c
displayName: Validating added and modified metadata in devOrg
I think I need to update in the inputs section and add fetchDepth parameter?
batch: "true"
branches:
include:
- develop
paths:
exclude:
- azure-pipelines.yml
- azure-pipelines POC.yml
pr:
autoCancel: "true"
branches:
include:
- develop
paths:
exclude:
- README.md
- azure-pipelines.yml
- azure-pipelines POC.yml
pool:
vmImage: ubuntu-latest
jobs:
- job: Validating_JOB
steps:
- checkout: self
fetchDepth: 5
- task: NodeTool@0
inputs:
versionSpec: '14.x'
checkLatest: true
- bash:
npm install sfdx-cli --global
displayName: Install Salesforce CLI
- bash:
echo y | sfdx plugins:install sfdx-git-delta
displayName: Installing sfdx-git-delta plugin
- bash:
sfdx sgd:source:delta --from $(System.PullRequest.SourceBranch) --to $(System.PullRequest.TargetBranch) --output .
displayName: Generating package.xml
- bash:
cat package/package.xml
displayName: package.xml generated with added and modified metadata
- bash:
sfdx force:auth:jwt:grant --clientid $(salesforceClientId) --jwtkeyfile ./buildfiles/server.key --username $(salesforceUserName) --instanceurl $(sandboxURL) -a devOrg
displayName: Authorize QA salesforce org
- bash:
sfdx force:source:deploy -x package/package.xml -w 1000 -u devOrg -c
displayName: Validating added and modified metadata in devOrg
name: Deploy to DEV ORG
on:
push:
branches:
- US-*
paths:
- force-app/**
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: develop
# Fetch all history commit
fetch-depth: 0
- uses: sfdx-actions/setup-sfdx@v1
with:
sfdx-auth-url: ${{ secrets.SF_DEV_AUTH_SECRET }}
- name: Install sfdxGit delta
run:
echo y | sfdx plugins:install sfdx-git-delta
sfdx sgd:source:delta --to ${{ github.ref}} --from origin/develop --output . -i .gitignore
cat package/package.xml
# Print Delta Package
- name: Print Delta package.xml
run:
cat package/package.xml
# Convert to Deploy Source
- name: Convert to Deploy Source
run:
sfdx force:source:convert -x package/package.xml -d ./toDeploy
# Run Validation of Deploy Source
- name: Deploy source to DEV SB
run:
sfdx force:mdapi:deploy -d ./toDeploy -u ${{ secrets.SF_DEV_USERNAME }}
'''