Working on 2GP support
This commit is contained in:
Родитель
b5c22d0641
Коммит
51a43bd2d5
|
@ -35,6 +35,14 @@ That's it. Along with the `setup.sh` script you find in this repo, the buildpack
|
|||
|
||||
7. Update the values in `setup.sh` accordingly (e.g. `HEROKU_TEAM_NAME`, `DEV_HUB_USERNAME`, `DEV_USERNAME`, `STAGING_USERNAME`, and `PROD_USERNAME`).
|
||||
|
||||
8. Create a developer-controlled package:
|
||||
|
||||
```
|
||||
sfdx force:package2:create -n PipelineSamplePackage - "My package yo" -o Unlocked -e
|
||||
```
|
||||
|
||||
9. Update the `sfdx-project.json` and inclu
|
||||
|
||||
8. Run `./setup.sh`.
|
||||
|
||||
Unfortunately there's a bug in `heroku pipelines:setup` that prevents us from fully setting up the pipeline. To manually finish the setup, perform the following steps:
|
||||
|
|
|
@ -10,6 +10,6 @@ echo "hello from post-setup.sh"
|
|||
|
||||
if [ "$STAGE" == "" ]; then
|
||||
|
||||
echo "only run from review app or ci"
|
||||
echo "only run from review app or ci: $TARGET_ORG_ALIAS"
|
||||
|
||||
fi
|
102
setup-mdapi.sh
102
setup-mdapi.sh
|
@ -1,102 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit # always exit on error
|
||||
set -o pipefail # don't ignore exit codes when piping output
|
||||
set -o nounset # fail on unset variables
|
||||
|
||||
#################################################################
|
||||
# Script to setup a fully configured pipeline for Salesforce DX #
|
||||
#################################################################
|
||||
|
||||
### Declare values
|
||||
|
||||
# Create a unique var to append
|
||||
TICKS=$(echo $(date +%s | cut -b1-13))
|
||||
|
||||
# Name of your team (optional)
|
||||
HEROKU_TEAM_NAME="appcloud-dev"
|
||||
|
||||
# Name of the Heroku apps you'll use
|
||||
HEROKU_DEV_APP_NAME="dev$TICKS"
|
||||
HEROKU_STAGING_APP_NAME="staging$TICKS"
|
||||
HEROKU_PROD_APP_NAME="prod$TICKS"
|
||||
|
||||
# Pipeline
|
||||
HEROKU_PIPELINE_NAME="pipeline$TICKS"
|
||||
|
||||
# Usernames or aliases of the orgs you're using
|
||||
DEV_HUB_USERNAME="HubOrg"
|
||||
DEV_USERNAME="DevOrg"
|
||||
STAGING_USERNAME="TestOrg"
|
||||
PROD_USERNAME="ProdOrg"
|
||||
|
||||
# Repository with your code
|
||||
GITHUB_REPO="wadewegner/salesforce-dx-pipeline-sample"
|
||||
|
||||
### Setup script
|
||||
|
||||
# Support a Heroku team
|
||||
HEROKU_TEAM_FLAG=""
|
||||
if [ ! "$HEROKU_TEAM_NAME" == "" ]; then
|
||||
HEROKU_TEAM_FLAG="-t $HEROKU_TEAM_NAME"
|
||||
fi
|
||||
|
||||
# Clean up script
|
||||
echo "heroku pipelines:destroy $HEROKU_PIPELINE_NAME
|
||||
heroku apps:destroy -a $HEROKU_DEV_APP_NAME -c $HEROKU_DEV_APP_NAME
|
||||
heroku apps:destroy -a $HEROKU_STAGING_APP_NAME -c $HEROKU_STAGING_APP_NAME
|
||||
heroku apps:destroy -a $HEROKU_PROD_APP_NAME -c $HEROKU_PROD_APP_NAME" > destroy.sh
|
||||
|
||||
echo ""
|
||||
echo "Run ./destroy.sh to remove resources"
|
||||
echo ""
|
||||
|
||||
# Create three Heroku apps to map to orgs
|
||||
heroku apps:create $HEROKU_DEV_APP_NAME $HEROKU_TEAM_FLAG
|
||||
heroku apps:create $HEROKU_STAGING_APP_NAME $HEROKU_TEAM_FLAG
|
||||
heroku apps:create $HEROKU_PROD_APP_NAME $HEROKU_TEAM_FLAG
|
||||
|
||||
# Set the stage (since STAGE isn't required, review apps don't get one)
|
||||
heroku config:set STAGE=DEV -a $HEROKU_DEV_APP_NAME
|
||||
heroku config:set STAGE=STAGING -a $HEROKU_STAGING_APP_NAME
|
||||
heroku config:set STAGE=PROD -a $HEROKU_PROD_APP_NAME
|
||||
|
||||
# Turn on debug logging
|
||||
heroku config:set SFDX_BUILDPACK_DEBUG=false -a $HEROKU_DEV_APP_NAME
|
||||
heroku config:set SFDX_BUILDPACK_DEBUG=false -a $HEROKU_STAGING_APP_NAME
|
||||
heroku config:set SFDX_BUILDPACK_DEBUG=false -a $HEROKU_PROD_APP_NAME
|
||||
|
||||
# Setup sfdxUrl's for auth
|
||||
devHubSfdxAuthUrl=$(sfdx force:org:display --verbose -u $DEV_HUB_USERNAME --json | jq -r .result.sfdxAuthUrl)
|
||||
heroku config:set DEV_HUB_SFDX_AUTH_URL=$devHubSfdxAuthUrl -a $HEROKU_DEV_APP_NAME
|
||||
|
||||
devSfdxAuthUrl=$(sfdx force:org:display --verbose -u $DEV_USERNAME --json | jq -r .result.sfdxAuthUrl)
|
||||
heroku config:set SFDX_AUTH_URL=$devSfdxAuthUrl -a $HEROKU_DEV_APP_NAME
|
||||
|
||||
stagingSfdxAuthUrl=$(sfdx force:org:display --verbose -u $STAGING_USERNAME --json | jq -r .result.sfdxAuthUrl)
|
||||
heroku config:set SFDX_AUTH_URL=$stagingSfdxAuthUrl -a $HEROKU_STAGING_APP_NAME
|
||||
|
||||
stagingSfdxAuthUrl=$(sfdx force:org:display --verbose -u $PROD_USERNAME --json | jq -r .result.sfdxAuthUrl)
|
||||
heroku config:set SFDX_AUTH_URL=$stagingSfdxAuthUrl -a $HEROKU_PROD_APP_NAME
|
||||
|
||||
# Add buildpacks to apps
|
||||
heroku buildpacks:add -i 1 https://github.com/wadewegner/salesforce-cli-buildpack -a $HEROKU_DEV_APP_NAME
|
||||
heroku buildpacks:add -i 1 https://github.com/wadewegner/salesforce-cli-buildpack -a $HEROKU_STAGING_APP_NAME
|
||||
heroku buildpacks:add -i 1 https://github.com/wadewegner/salesforce-cli-buildpack -a $HEROKU_PROD_APP_NAME
|
||||
|
||||
heroku buildpacks:add -i 2 https://github.com/wadewegner/salesforce-dx-buildpack -a $HEROKU_DEV_APP_NAME
|
||||
heroku buildpacks:add -i 2 https://github.com/wadewegner/salesforce-dx-buildpack -a $HEROKU_STAGING_APP_NAME
|
||||
heroku buildpacks:add -i 2 https://github.com/wadewegner/salesforce-dx-buildpack -a $HEROKU_PROD_APP_NAME
|
||||
|
||||
# Create Pipeline
|
||||
# Valid stages: "test", "review", "development", "staging", "production"
|
||||
heroku pipelines:create $HEROKU_PIPELINE_NAME -a $HEROKU_DEV_APP_NAME -s development $HEROKU_TEAM_FLAG
|
||||
heroku pipelines:add $HEROKU_PIPELINE_NAME -a $HEROKU_STAGING_APP_NAME -s staging
|
||||
heroku pipelines:add $HEROKU_PIPELINE_NAME -a $HEROKU_PROD_APP_NAME -s production
|
||||
# bug: https://github.com/heroku/heroku-pipelines/issues/80
|
||||
# heroku pipelines:setup $HEROKU_PIPELINE_NAME $GITHUB_REPO -y $HEROKU_TEAM_FLAG
|
||||
|
||||
heroku ci:config:set -p $HEROKU_PIPELINE_NAME DEV_HUB_SFDX_AUTH_URL=$devHubSfdxAuthUrl
|
||||
heroku ci:config:set -p $HEROKU_PIPELINE_NAME SFDX_AUTH_URL=$devSfdxAuthUrl
|
||||
heroku ci:config:set -p $HEROKU_PIPELINE_NAME SFDX_BUILDPACK_DEBUG=false
|
||||
|
31
setup.sh
31
setup.sh
|
@ -33,6 +33,9 @@ PROD_USERNAME="ProdOrg"
|
|||
# Repository with your code
|
||||
GITHUB_REPO="wadewegner/salesforce-dx-pipeline-sample"
|
||||
|
||||
# Your package name
|
||||
PACKAGE_NAME="PackageName"
|
||||
|
||||
### Setup script
|
||||
|
||||
# Support a Heroku team
|
||||
|
@ -62,24 +65,24 @@ heroku config:set STAGE=STAGING -a $HEROKU_STAGING_APP_NAME
|
|||
heroku config:set STAGE=PROD -a $HEROKU_PROD_APP_NAME
|
||||
|
||||
# Set whether or not to use DCP packaging
|
||||
heroku config:set SFDX_INSTALL_PACKATE_VERSION=false -a $HEROKU_DEV_APP_NAME
|
||||
heroku config:set SFDX_INSTALL_PACKATE_VERSION=true -a $HEROKU_STAGING_APP_NAME
|
||||
heroku config:set SFDX_INSTALL_PACKATE_VERSION=true -a $HEROKU_PROD_APP_NAME
|
||||
heroku config:set SFDX_INSTALL_PACKAGE_VERSION=true -a $HEROKU_DEV_APP_NAME
|
||||
heroku config:set SFDX_INSTALL_PACKAGE_VERSION=true -a $HEROKU_STAGING_APP_NAME
|
||||
heroku config:set SFDX_INSTALL_PACKAGE_VERSION=true -a $HEROKU_PROD_APP_NAME
|
||||
|
||||
# Set stage to create package version
|
||||
heroku config:set SFDX_CREATE_PACKAGE_VERSION=false -a $HEROKU_DEV_APP_NAME
|
||||
heroku config:set SFDX_CREATE_PACKAGE_VERSION=true -a $HEROKU_STAGING_APP_NAME
|
||||
heroku config:set SFDX_CREATE_PACKAGE_VERSION=true -a $HEROKU_DEV_APP_NAME
|
||||
heroku config:set SFDX_CREATE_PACKAGE_VERSION=false -a $HEROKU_STAGING_APP_NAME
|
||||
heroku config:set SFDX_CREATE_PACKAGE_VERSION=false -a $HEROKU_PROD_APP_NAME
|
||||
|
||||
# Package name
|
||||
heroku config:set SFDX_PACKAGE_NAME="PipelineSamplePackage" -a $HEROKU_DEV_APP_NAME
|
||||
heroku config:set SFDX_PACKAGE_NAME="PipelineSamplePackage" -a $HEROKU_STAGING_APP_NAME
|
||||
heroku config:set SFDX_PACKAGE_NAME="PipelineSamplePackage" -a $HEROKU_PROD_APP_NAME
|
||||
heroku config:set SFDX_PACKAGE_NAME="$PACKAGE_NAME" -a $HEROKU_DEV_APP_NAME
|
||||
heroku config:set SFDX_PACKAGE_NAME="$PACKAGE_NAME" -a $HEROKU_STAGING_APP_NAME
|
||||
heroku config:set SFDX_PACKAGE_NAME="$PACKAGE_NAME" -a $HEROKU_PROD_APP_NAME
|
||||
|
||||
# Turn on debug logging
|
||||
heroku config:set SFDX_BUILDPACK_DEBUG=false -a $HEROKU_DEV_APP_NAME
|
||||
heroku config:set SFDX_BUILDPACK_DEBUG=false -a $HEROKU_STAGING_APP_NAME
|
||||
heroku config:set SFDX_BUILDPACK_DEBUG=false -a $HEROKU_PROD_APP_NAME
|
||||
heroku config:set SFDX_BUILDPACK_DEBUG=true -a $HEROKU_DEV_APP_NAME
|
||||
heroku config:set SFDX_BUILDPACK_DEBUG=true -a $HEROKU_STAGING_APP_NAME
|
||||
heroku config:set SFDX_BUILDPACK_DEBUG=true -a $HEROKU_PROD_APP_NAME
|
||||
|
||||
# Setup sfdxUrl's for auth
|
||||
devHubSfdxAuthUrl=$(sfdx force:org:display --verbose -u $DEV_HUB_USERNAME --json | jq -r .result.sfdxAuthUrl)
|
||||
|
@ -113,5 +116,7 @@ heroku pipelines:add $HEROKU_PIPELINE_NAME -a $HEROKU_PROD_APP_NAME -s productio
|
|||
|
||||
heroku ci:config:set -p $HEROKU_PIPELINE_NAME DEV_HUB_SFDX_AUTH_URL=$devHubSfdxAuthUrl
|
||||
heroku ci:config:set -p $HEROKU_PIPELINE_NAME SFDX_AUTH_URL=$devSfdxAuthUrl
|
||||
heroku ci:config:set -p $HEROKU_PIPELINE_NAME SFDX_BUILDPACK_DEBUG=false
|
||||
|
||||
heroku ci:config:set -p $HEROKU_PIPELINE_NAME SFDX_BUILDPACK_DEBUG=true
|
||||
heroku ci:config:set -p $HEROKU_PIPELINE_NAME SFDX_INSTALL_PACKAGE_VERSION=true
|
||||
heroku ci:config:set -p $HEROKU_PIPELINE_NAME SFDX_CREATE_PACKAGE_VERSION=false
|
||||
heroku ci:config:set -p $HEROKU_PIPELINE_NAME SFDX_PACKAGE_NAME="$PACKAGE_NAME"
|
|
@ -2,10 +2,12 @@
|
|||
"packageDirectories": [
|
||||
{
|
||||
"path": "force-app",
|
||||
"default": true
|
||||
"default": true,
|
||||
"id": "0Ho6A0000004C9NSAU",
|
||||
"versionNumber": "1.0.0.NEXT"
|
||||
}
|
||||
],
|
||||
"namespace": "",
|
||||
"sfdcLoginUrl": "https://login.salesforce.com",
|
||||
"sourceApiVersion": "41.0"
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче