Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Sebastien
    @scolladon
    Hello ! Once the package.xml is generated by the plug-in you could use sfdx force:source:deploy -x to deploy using the package.xml
    Daniel Horky
    @Dhanielk
    Hi Sebastien, I am trying to work sgd in Gitlab pipelines and I am having issue generating packages. It might be some Gitlab specific issue, but when I run the command, it seems like there is no change. If I ran the same command (with same params) it works on my local machine. Since there is no telling what is the plugin doing at any given time, it's very hard to squash the issue. Would you please give me any advice?
    Sebastien
    @scolladon
    Yes, make sure gitlab fetches the whole git repo and not just the last commit. There is a parameter git depth which drive this
    Daniel Horky
    @Dhanielk
    Yeah it's set to full depth clone, still nothing
    Sebastien
    @scolladon
    Weird… is there an issue ? What is the node version in the execution context ?
    Daniel Horky
    @Dhanielk
    using image node:latest. I am going to try do diff manually to check if there is nothing weird with repo in pipeline, but I do manual git fetch in pipeline just for good measures
    do you have the git command on hand to simulate the plugin? If not I will just do git status or diff
    Sebastien
    @scolladon
    git diff —name-status —no-renames <from> <to>
    Daniel Horky
    @Dhanielk
    Thanks Sebastien... it's solved, problem was with git :)
    Sebastien
    @scolladon
    Seriously ? What is it in detail please ?
    Daniel Horky
    @Dhanielk
    I have no idea, only thing which helped was specifically checkout both diff branches... I've tried unshallow, but it was complete repository, tried fetch branch specifically and everything I could think of, but only the checkout helped. Something between Gitlab CI/CD and heaven I would say :D
    Sebastien
    @scolladon
    😅
    Anand Dasari
    @akdasari
    Hi , i have problem with sgd delta plugin, while comparing two branches,, it just produce empty package.xml
    when i checked with git diff two branches i can see the differences
    i have also added a step to fetch /refs/heads before sgd command , still no use
    anybody help please
    Sebastien
    @scolladon
    Hello, is it in local ? Or in a CI env ?
    Anand Dasari
    @akdasari
    this is CI env
    local works fine
    Sebastien
    @scolladon
    Ok, this is probably because of the fetch depth then
    Anand Dasari
    @akdasari
    how do i do this? I'm using github and jenkins pipeline
    in pipeline i have another step to get dev branch '''checkout([
    $class: 'GitSCM', branches: [[name: '*/dev']],
    userRemoteConfigs: [[url: 'git@github-xxx.xxxx.xxxx:XXXXXXX/sfdx_poc.git',credentialsId:'deploy_key']] '''
    and in another stage I'm trying to use delta plugin '''sh "sfdx sgd:source:delta --to ${env.BRANCH_NAME} --from dev --output changes/" '''
    Sebastien
    @scolladon
    I do not know for jenkins
    Andrzej Pajda
    @andrewpajda

    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 command
    sfdx 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/

    Sebastien
    @scolladon
    I’ve never had this error before. It does not seems to be an issue with the attributes (except if the variables does not contains anything). Are you able to reproduce locally ?
    Andrzej Pajda
    @andrewpajda
    Ok I think I got it. As far as I understand the problem is with how Bitbucket pipelines are working, whenever u use pipelines invoked by a pull request, branches are merged before the pipeline runs and it creates some kind of a problem with accessing $BITBUCKET_PR_DESTINATION_BRANCH commit info.
    i saw It when i tried to do git log "$BITBUCKET_PR_DESTINATION_BRANCH"
    So just a heads up for everyone that will use Bitbucket pipelines, you'll probably have to use cache to store latest commit information per ORG
    Sebastien
    @scolladon
    Thanks 👍
    RaviKodumuri
    @KodumuriRavi_twitter
    Hi, I'm trying to run a mock deployment every time a PR is raised in Azure Pipelines by enabling "Build Validation" but sgd delta plugin is generating empty package.xml while comparing the target branch and the source branch. Is there any other step which we need to follow if we are running the plugin during build validation phase?
    Sebastien
    @scolladon
    Hi, usually this kind of issue comes from git clone depth in CI. Do you fetch the whole repo or just the latest commit ?
    RaviKodumuri
    @KodumuriRavi_twitter

    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?

    Sebastien
    @scolladon
    It’s worth a try 😄
    RaviKodumuri
    @KodumuriRavi_twitter
    No luck, I have tried various options by including fetchDepth or checkout:self etc.
        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
    Inital checkout job name is showing as "Checkout <RepositoryName>@refs/pull/36485/merge to s". Ideally when we are using checkout: self then the pipeline should checkout the entire repository right?
    Sebastien
    @scolladon
    I’m not very acquainted with azure pipeline 😅
    Sebastien
    @scolladon
    Does it works locally ? Are you able to use the command in your machine, with the right result ?
    RaviKodumuri
    @KodumuriRavi_twitter
    Yeah it does work fine!
    Sebastien
    @scolladon
    So it should be from the clone depth from azure
    Mr. Rahul A Jichkar
    @rjichkar
    Hi @scolladon I'm using sgd git delta on github actions, it works fine on local VS code. However, not generating package.xml on workflow. I used the depth parameter as well. Can anyone help?

    image.png
    '''

    Unique name for this workflow

    name: Deploy to DEV ORG

    Definition when the workflow should run

    on:
    push:
    branches:

            - US-*
        paths:
            - force-app/**

    Jobs to be executed

    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 }}

    '''

    Sebastien
    @scolladon
    Hi maybe it is because of the —to {{ gitHub.ref }} parameter. Could you try with —to “HEAD” or without —to (head will be taken by default)
    Mr. Rahul A Jichkar
    @rjichkar
    image.png
    Thanks @scolladon . Tried to remove git ref, but no luck
    Sebastien
    @scolladon
    It seems the plug-in installation and it’s execution are on the same line. Could split those ?
    Mr. Rahul A Jichkar
    @rjichkar
    ok let me try
    Mr. Rahul A Jichkar
    @rjichkar
    @scolladon Thanks a lot! On d first go, it didn't work (getting blank package), then I modified this line "--f origin/develop" to "--f HEAD^" and it worked!! Thanks again for your help!
    Sebastien
    @scolladon
    You’re welcome ! Happy sfdx incremental deployment 😁