#I can show you my scenario

1 messages · Page 1 of 1 (latest)

balmy shuttle
#

sure, starting a thread to avoid spamming the channel

#

in a meeting rn. I'll be back in ~20m

tawny heron
#

Where are making a PoC with Dagger for our Salesforce Team.
And their pipeline looks like this (this is only a short cut):

# Salesforce pipeline
# Include the Common CI pipeline parameters.
include:
  - project: 'p7s1/sales/salesforce/p7s1cicdtemplate'
    file: '/Common.gitlab-ci.yml'
  #- /force-app/ui-tests/pipeline.yml

stages:
  - build
  - pre-tests
  - validate
  - deploy
  - post-tests
  - integration

####################################################
# Builds the Metadata Package, builds the Package
# files and Destructive changes
####################################################
build-package-xml:
  stage: build
  except:
    variables:
      - $SCRATCH_DISABLED
      - $TEST_DISABLED
  only:
    variables:
      - $FORCE_DEVELOP_RUN
      - $FORCE_MASTER_RUN
      - $FORCE_VALIDATE_MASTER
      - $FORCE_RUN
      - $FORCE_DEPLOY
      - $CI_COMMIT_REF_NAME == 'test-integration'
      - $CI_COMMIT_REF_NAME == 'develop'
      - $CI_COMMIT_REF_NAME == 'master'
      - $CI_COMMIT_REF_NAME == 'release/uat'
  allow_failure: false
  script:
    - build_diff_files
  artifacts:
    paths:
      - deploySource
      - deploy
  environment:
    name: salesforce/$CI_COMMIT_REF_SLUG
#

And now the build_diff_files is that:

# Build the Package to be able to deploy
  function build_diff_files() {
      echo "----- START DIFF FILES  -----"
      bash build/build_package.sh $REFERENCE_TAG
      if [[ -d deploySource ]]
      then
        echo "----- CONVERT SFDX-SOURCE TO METADATA -----"
        sfdx force:source:convert -r deploySource -d deploy/src
      fi
      echo "----- START DESTRUCTIVE CHANGES  -----"
      python3 build/build_destructive_changes.py $REFERENCE_TAG destructiveChanges/destructiveChangePre.csv destructiveChangesPre
      python3 build/build_destructive_changes.py $REFERENCE_TAG destructiveChanges/destructiveChangePost.csv destructiveChangesPost
      if [[ ! -f deploy/src/package.xml ]]
      then
        echo "----- NOTHING TO DEPLOY -----"
        exit 1;
      fi
  }

And in this function there is a bash build/.... call.

#

This function compares the commit with the last green tag (e.g. last-green-build) and the last commit (head). Based on this, it identifies all the files relevant for the deployment that have been changed and puts them into appropriate folder structures. Then it finally builds itself an xml that tells salesforce what all should be deployed

balmy shuttle
#

got it.. so IIUC you want to run the equivalent of build_diff_files in cloak?

#

here's a cloak query that defines a bash function and calls it. Does this help @tawny heron ?

query BashFunction {
  alpine {
    build(pkgs: "bash") {
      exec(input: {args: ["bash", "-c", "foo() { echo $1; }; foo hello"]}) {
        stdout
      }
    }
  }
}```