Skip to content

Instantly share code, notes, and snippets.

@Anthonyhawkins
Created June 8, 2021 18:05
Show Gist options
  • Save Anthonyhawkins/97ad94422aed28846af648b740ceff8a to your computer and use it in GitHub Desktop.
Save Anthonyhawkins/97ad94422aed28846af648b740ceff8a to your computer and use it in GitHub Desktop.
"jobs": [
{
"name": cf_mgmt_command,
"plan": prune_empty([
{
"get": "config-repo",
"trigger": True,
}
#
# Specify which jobs depend on other jobs
#
| Include.when(cf_mgmt_command == "assign-default-security-groups", {
"passed": ["create-security-groups"]
}) | Include.when(cf_mgmt_command in [
"delete-orgs",
"update-orgs-metadata",
"create-org-private-domains",
"service-access",
"update-org-users",
"update-org-quotas"
], {
"passed": ["create-orgs"]
}) | Include.when(cf_mgmt_command == "share-org-private-domains", {
"passed": ["create-org-private-domains"]
}) | Include.when(cf_mgmt_command == "create-spaces", {
"passed": ["create-orgs", "update-org-users"]
}) | Include.when(cf_mgmt_command in ["delete-spaces", "isolations-segments"], {
"passed": ["create-orgs", "create-spaces"]
}) | Include.when(cf_mgmt_command in [
"update-spaces",
"update-spaces-metadata",
"update-space-users",
"update-space-quotas"
], {
"passed": ["create-spaces"]
}) | Include.when(cf_mgmt_command == "update-space-security-groups", {
"passed": ["create-spaces", "create-security-groups"]
}) | Include.when(cf_mgmt_command == "cleanup-org-users", {
"passed": ["update-org-users", "update-space-users"]
}),
{
"get": "cf-mgmt",
},
#
# These Jobs Need Time Trigger
#
Include.when(cf_mgmt_command in [
"delete-spaces",
"update-spaces",
"update-space-users",
"update-org-users",
"isolation-segments",
"cleanup-org-users"
], {
"get": "time-trigger",
"trigger": True
}),
{
"task": cf_mgmt_command,
"image": "cf-mgmt",
"config": {
"platform": "linux",
"inputs": [
{"name": "config-repo"}
],
"params": {
"SYSTEM_DOMAIN": sources.grab("vars", "meta.system_domain"),
"USER_ID": sources.grab("vars", "meta.user_id"),
"PASSWORD": env("PASSWORD"),
"CONFIG_DIR": "config-repo/orgs/" + env("CF_ENVIRONMENT"),
"CLIENT_SECRET": env("CLIENT_SECRET"),
"LOG_LEVEL": "info",
"CF_MGMT_COMMAND": cf_mgmt_command
},
"run": {
"path": "config-repo/ci/tasks/cf-mgmt.sh"
}
}
}
])
} for cf_mgmt_command in [
"create-orgs",
"shared-domains",
"create-security-groups",
"assign-default-security-groups",
"delete-orgs",
"update-orgs-metadata",
"create-org-private-domains",
"service-access",
"share-org-private-domains",
"create-spaces",
"delete-spaces",
"update-spaces",
"update-spaces-metadata",
"update-space-users",
"update-space-quotas",
"update-space-security-groups",
"update-org-users",
"update-org-quotas",
"isolation-segments",
"cleanup-org-users"
]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment