GlassOps examples
consumer/ is the smallest repository layout that runs GlassOps on GitHub. Copy it into a
Salesforce DX project, or run glassops init to generate a similar glassops.yaml and workflow.
glassops.yaml: two targets, a policy for production, and the default pipelines..github/workflows/pr.yml: runs the pr pipeline on pull requests by calling the reusable workflow..github/workflows/deploy.yml: runs the deploy pipeline on a push to main by calling the reusable workflow. The job runs in theglassops-deployenvironment.
Set up the environment
- Create the
glassops-deployenvironment in the repository settings. - Add the required reviewers, and a deployment branch rule that allows
mainonly. - Add
GLASSOPS_PERMIT_KEYas a secret of that environment, not of the repository. Generate the value withopenssl rand -base64 32. The deploy workflow passes it by name to the reusable workflow, which resolves it from the environment of the deploy job, because a called workflow gets an environment secret only when the caller passes it. - Add the Salesforce secrets
SF_JWT_KEY,SF_CLIENT_ID,SF_USERNAME,SF_DEVHUB_ORG_ID,SF_PROD_USERNAMEandSF_PROD_ORG_IDas repository secrets.
The pr workflow never receives the permit key. Only a job in the protected environment can read it. The GitHub deploy guide explains each part of the deploy job.
Opt-in policy
rego/: a Rego policy with tests that denies production deploys of protected profiles and permission sets. See Rego rules. Opt-in, since v1.1.0.
Other CI systems
bitbucket/:bitbucket-pipelines.ymlandglassops.yamlfor Bitbucket Pipelines.gitlab/:.gitlab-ci.ymlandglassops.yamlfor GitLab CI.
Neither has run on a real runner yet, so treat the first run as a proof. The Bitbucket and GitLab guide explains what the CI layer reads and writes.
Other commands in a workflow
The glassops-platform/glassops action runs one command in the container, for steps that do not fit a pipeline: