-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
54 lines (49 loc) · 1.94 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: "Push to Prodvana"
description: "Push a new image version to a Prodvana service"
inputs:
app:
description: "name of the app the service belongs to"
required: true
service:
description: "name of the service to push"
required: true
docker_image:
description: "Comma separated key-value pairs of '<program_name>=<docker_image>'. if the service has a single program, you can pass the single <docker_image> directly"
required: false
parameters:
description: "Comma separated key-value pairs of '<parameter_name>=<value>'."
required: false
wait_channels:
description: "comma separated list of name of release channel(s) to wait for before considering the push complete"
required: false
auth_context:
description: "pvnctl auth context to use. If you're using this Action with init-pvnctl, leave as the default"
required: true
default: "default"
outputs: {}
runs:
using: "composite"
steps:
- name: Push Service
shell: bash
run: |
set -euxo pipefail
CMD="pvnctl services --app=${{ inputs.app }}"
if [[ -n "${{ inputs.parameters }}" ]]; then
CMD="$CMD push2 ${{ inputs.service }}"
# Split parameters on comma and send each parameter as a separate arg
IFS="," read -ra PARAM_SPLIT <<< "${{ inputs.parameters }}"
for param in "${PARAM_SPLIT[@]}"; do
CMD="$CMD --param ${param}"
done
elif [[ -n "${{ inputs.docker_image }}" ]]; then
CMD="$CMD update-images ${{ inputs.service }} --image ${{ inputs.docker_image }}"
else
# no parameters specified = use previous values and default values
CMD="$CMD push2 ${{ inputs.service }}"
fi
if [[ -n "${{ inputs.wait_channels }}" ]]; then
CMD="$CMD --wait-channel=${{ inputs.wait_channels }}"
fi
pvnctl auth context use ${{ inputs.auth_context }}
eval "${CMD}"