Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changes/next-release/minor-20220630102826758971.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "minor",
"description": "Add option to adjust wait timeout"
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM alpine/helm:3.8.2 as helm
RUN chown root:root /usr/bin/helm

FROM python:3.7-alpine3.11
FROM python:3.7-alpine3.16

RUN mkdir -p /opt/pipe

Expand Down
39 changes: 20 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,26 @@ Add the following snippet to the script section of your `bitbucket-pipelines.yml

## Variables

| Variable | Usage |
| ------------------------- | ---------------------------------------------------------------------- |
| AWS_REGION | AWS Region. Default: `eu-central-1`. |
| AWS_ACCESS_KEY_ID (*) | AWS Access Key ID |
| AWS_SECRET_ACCESS_KEY (*) | AWS Secret Access Key |
| ROLE_ARN | AWS IAM Role to assume when access EKS |
| SESSION_NAME | AWS STS Session name |
| CLUSTER_NAME (*) | Name of the AWS EKS cluster |
| CHART (*) | Path or name of the chart which should be deployed |
| RELEASE_NAME | Name of the helm release |
| NAMESPACE | Target Kubernetes namespace of the deployment. Default: `kube-public`. |
| CREATE_NAMESPACE | Boolean. Will instruct helm to create a namespace if missing. Default: `false`. |
| SET | List of values which should be used as --set argument for Helm |
| VALUES | Local values YAML files which should be passed to Helm (--values) |
| DEBUG | Debug. Default: `false`. |
| WAIT | Wait until application is ready. Default: `false`. |
| DEBUG | Debug. Default: `false`. |
| UNINSTALL | Uninstall the release from the given namespace. Default: `false` |
| INSTALL_SUBCHARTS | Run `helm dependency update` to pull in the latest subcharts based on `Charts.yaml`. Default: `false` |
| Variable | Usage | Example |
| ------------------------- | ---------------------------------------------------------------------- | ------- |
| AWS_REGION | AWS Region. Default: `eu-central-1`. ||
| AWS_ACCESS_KEY_ID (*) | AWS Access Key ID ||
| AWS_SECRET_ACCESS_KEY (*) | AWS Secret Access Key ||
| ROLE_ARN | AWS IAM Role to assume when access EKS ||
| SESSION_NAME | AWS STS Session name ||
| CLUSTER_NAME (*) | Name of the AWS EKS cluster ||
| CHART (*) | Path or name of the chart which should be deployed ||
| RELEASE_NAME | Name of the helm release ||
| NAMESPACE | Target Kubernetes namespace of the deployment. Default: `kube-public`. ||
| CREATE_NAMESPACE | Boolean. Will instruct helm to create a namespace if missing. Default: `false`. ||
| SET | List of values which should be used as --set argument for Helm ||
| VALUES | Local values YAML files which should be passed to Helm (--values) ||
| DEBUG | Debug. Default: `false`. ||
| WAIT | Wait until application is ready. Default: `false`. ||
| WAIT_TIMEOUT | Time to wait for resources. Default: `300s`. | `1h` or `30m`|
| DEBUG | Debug. Default: `false`. ||
| UNINSTALL | Uninstall the release from the given namespace. Default: `false` ||
| INSTALL_SUBCHARTS | Run `helm dependency update` to pull in the latest subcharts based on `Charts.yaml`. Default: `false` ||

_(*) = required variable._

Expand Down
9 changes: 8 additions & 1 deletion pipe/helm/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class HelmClient:
set = []
_values = []
wait = False
wait_timeout = None
install_subcharts = False

def validate_chart(self, chart):
Expand Down Expand Up @@ -120,7 +121,13 @@ def install(self, chart):
)

if self.wait:
command.append('--wait')
command.append('--wait')

if self.wait_timeout:
command += (
'--timeout',
self.wait_timeout
)

return self._run(command)

Expand Down
2 changes: 2 additions & 0 deletions pipe/pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def run(self):
set = self.get_variable('SET')
values = self.get_variable('VALUES')
wait = self.get_variable('WAIT')
wait_timeout = self.get_variable('WAIT_TIMEOUT')
uninstall = self.get_variable('UNINSTALL')
install_subcharts = self.get_variable('INSTALL_SUBCHARTS')

Expand Down Expand Up @@ -98,6 +99,7 @@ def run(self):
helm_client.set = set
helm_client.values = values
helm_client.wait = wait
helm_client.wait_timeout = wait_timeout
helm_client.install_subcharts = install_subcharts

if not uninstall:
Expand Down
1 change: 1 addition & 0 deletions pipe/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def get_schema():
'SET': {'type': 'list', 'required': False, 'default': []},
'VALUES': {'type': 'list', 'required': False, 'default': []},
'WAIT': {'type': 'boolean', 'required': False, 'default': False},
'WAIT_TIMEOUT': {'type': 'string', 'required': False, 'default': "300s"},
'DEBUG': {'type': 'boolean', 'required': False, 'default': False},
'UNINSTALL': {'type': 'boolean', 'required': False, 'default': False},
'INSTALL_SUBCHARTS': {'type': 'boolean', 'required': False, 'default': False}
Expand Down