This repository has been archived on 2020-08-11. You can view files and clone it, but cannot push or open issues or pull requests.
stack/.drone.star

60 lines
1.2 KiB
Plaintext

def fromSecret(name):
return {
"from_secret": name
}
dev environment(env):
return dict(
[(x.replace("-", "_").upper(), fromSecret(x)) for x in env]
)
def printSecrets(env):
return {
"name": "printenv",
"image": "appleboy/drone-ssh",
"environment": environment(env),
"settings": {
"envs": [x.replace("-", "_") for x in env],
"host": fromSecret("ssh-host"),
"port": fromSecret("ssh-port"),
"username": fromSecret("ssh-user"),
"password": fromSecret("ssh-password"),
"script": [
"echo SSH_HOST=$SSH_HOST > env-stack",
"echo SSH_PORT=$SSH_PORT >> env-stack",
"echo LOCAL_DOCKER_REGISTRY=$LOCAL_DOCKER_REGISTRY >> env-stack",
]
}
}
def steps(name):
return {
"kind": "pipeline",
"name": name,
"clone": {
"disable": True,
},
"steps": [
printSecrets([
"local-docker-registry",
"ssh-host",
"ssh-user",
"ssh-port",
]),
{
"name": "build",
"image": "alpine",
"commands": [
"echo hello 'star lark'",
],
},
],
}
def main(ctx):
return [
steps('first'),
steps('second'),
]