Created
October 25, 2019 13:59
-
-
Save ethanfrogers/9330a56e13c86bedcbedb8e74a58723c to your computer and use it in GitHub Desktop.
spinlark
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load("//config/spinnaker/v1/spinnaker.sky", "spinnaker") | |
application_name = 'kustomize' | |
def slack_notification(when = []): | |
return spinnaker.notifications.slack( | |
channel = "#devops", | |
when = when, | |
) | |
environments = ['Prod', 'Staging', 'Dev'] | |
slack_notification_on_fail = slack_notification(when = [spinnaker.notifications.when('failed')]) | |
def environments_list(): | |
return [ spinnaker.parameter_option(x) for x in environments ] | |
manifest_artifact = spinnaker.artifacts.artifact( | |
name = 'my-manifest', | |
id = 'my-manifest', | |
match_artifact = spinnaker.artifacts.expected_artifact( | |
type = 'github/file', | |
reference = 'https://api.github.com/repos/armory-io/terraformer/contents/deployments/manifests.yml', | |
version = '${trigger.hash}', | |
id = 'match-artifact' | |
), | |
) | |
def main(): | |
return spinnaker.pipeline( | |
application = application_name, | |
name = "Starlark Demo", | |
expected_artifacts = [ manifest_artifact ], | |
parameters = [ | |
spinnaker.parameter( | |
name = 'namespace', | |
label = 'Namespace', | |
required = True, | |
pinned = True, | |
default = 'default' | |
), | |
spinnaker.parameter( | |
name = 'environment', | |
label = 'Environment', | |
required = True, | |
default = 'Dev', | |
options = environments_list() | |
) | |
], | |
stages = [ | |
spinnaker.stages.stage( | |
spinnaker.stages.deploy_manifest( | |
account = 'added-from-api', | |
moniker = { 'app': application_name }, | |
manifest_artifact_account = 'github', | |
manifest_artifact_id = manifest_artifact['id'], | |
), | |
name = 'deploy manifest to prod' | |
) | |
] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment