-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathaction.yaml
More file actions
171 lines (164 loc) · 7.84 KB
/
action.yaml
File metadata and controls
171 lines (164 loc) · 7.84 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: RC Helper
description: Reusable action for RC helper Slack notifications via Docker container.
inputs:
rc_step:
description: RC step (e.g., post_to_thread, update_message_header)
required: true
message_header:
description: Slack message header (for post_to_channel)
required: false
repo_name:
description: GitHub repository name (e.g., owner/repo)
required: false
slack_token:
description: Slack API token (should be passed as a secret)
required: false
slack_channel:
description: Slack channel ID (e.g., G015384QZAB)
required: false
thread_ts:
description: Slack thread timestamp (for thread updates)
required: false
message:
description: Slack message content (for post_to_channel)
required: false
thread_message:
description: Slack thread message content (for post_to_thread)
required: false
new_message_header:
description: Slack message header (for update_message_header step)
required: false
change_log_header_metadata:
description: Change log header metadata (for update_message_header step)
required: false
previous_message:
description: Previous Slack message (for update_message_header step)
required: false
thread_message_ts:
description: thread reply timestamp
required: false
new_thread_message:
description: new message that needs to be updates in thread reply
required: false
deployed_ref:
description: Deployed reference SHA or tag (for changelog message, e.g., previous deployment, base branch, or environment)
required: false
candidate_ref:
description: Candidate reference SHA or tag (for changelog message, e.g., new deployment, PR head, or target commit)
required: false
contributors_raw_list:
description: Contributors list
required: false
ddb_item_to_be_added:
description: JSON string of the item (for add_item_from_json_to_dynamodb_table)
required: false
ddb_table_name:
description: DynamoDB table name (for DynamoDB steps)
required: false
ddb_partition_key:
description: Partition key name (for DynamoDB steps)
required: false
ddb_sort_key:
description: Sort key name (for add_item_from_json_to_dynamodb_table)
required: false
ddb_query_json:
description: JSON string for the query (for item_exists_in_dynamodb)
required: false
ddb_exists_output:
description: "Output variable name (default: ITEM_EXISTS) (for item_exists_in_dynamodb)"
required: false
ddb_field_path:
description: "Dot-separated path to the field (e.g., dev.image_tag for a single value, dev for the whole section) (for get_item_value_from_dynamodb)"
required: false
ddb_output_name:
description: "Output variable name (default: FIELD_VALUE) (for get_item_value_from_dynamodb)"
required: false
ddb_return_section:
description: "If set to true, returns the entire section as clean JSON; if false or omitted, returns a single field value (for get_item_value_from_dynamodb)"
required: false
ddb_table_index_name:
description: "DynamoDB table's index name"
required: false
ddb_index_field_name:
description: "DynamoDB table field used for index"
required: false
ddb_index_field_value:
description: "DynamoDB table, value used to match index field value"
required: false
aws_region:
description: "AWS region to use (optional, defaults to us-east-1 if not set)"
required: false
runs:
using: docker
image: docker://ghcr.io/solacedev/maas-build-actions:master
entrypoint: /bin/sh
args:
- -c
- |
export SLACK_TOKEN="$INPUT_SLACK_TOKEN"
export SLACK_CHANNEL="$INPUT_SLACK_CHANNEL"
export RC_STEP="$INPUT_RC_STEP"
export RC_PYTHON="python3"
export RC_HELPER_SCRIPT="/maas-build-actions/scripts/cicd-helper/cicd-helper.py"
if [ -n "$INPUT_THREAD_TS" ]; then export THREAD_TS="$INPUT_THREAD_TS"; fi
if [ -n "$INPUT_MESSAGE" ]; then export MESSAGE="$INPUT_MESSAGE"; fi
if [ -n "$INPUT_THREAD_MESSAGE" ]; then export THREAD_MESSAGE="$INPUT_THREAD_MESSAGE"; fi
if [ -n "$INPUT_MESSAGE_HEADER" ]; then export MESSAGE_HEADER="$INPUT_MESSAGE_HEADER"; fi
if [ -n "$INPUT_NEW_MESSAGE_HEADER" ]; then export NEW_MESSAGE_HEADER="$INPUT_NEW_MESSAGE_HEADER"; fi
if [ -n "$INPUT_CHANGE_LOG_HEADER_METADATA" ]; then export CHANGE_LOG_HEADER_METADATA="$INPUT_CHANGE_LOG_HEADER_METADATA"; fi
if [ -n "$INPUT_PREVIOUS_MESSAGE" ]; then export PREVIOUS_MESSAGE="$INPUT_PREVIOUS_MESSAGE"; fi
if [ -n "$INPUT_REPO_NAME" ]; then export REPO_NAME="$INPUT_REPO_NAME"; fi
if [ -n "$INPUT_DEPLOYED_REF" ]; then export DEPLOYED_REF="$INPUT_DEPLOYED_REF"; fi
if [ -n "$INPUT_CANDIDATE_REF" ]; then export CANDIDATE_REF="$INPUT_CANDIDATE_REF"; fi
if [ -n "$INPUT_CONTRIBUTORS_RAW_LIST" ]; then export CONTRIBUTORS_RAW_LIST="$INPUT_CONTRIBUTORS_RAW_LIST"; fi
if [ -n "$INPUT_DDB_ITEM_TO_BE_ADDED" ]; then export DDB_ITEM_TO_BE_ADDED="$INPUT_DDB_ITEM_TO_BE_ADDED"; fi
if [ -n "$INPUT_DDB_TABLE_NAME" ]; then export DDB_TABLE_NAME="$INPUT_DDB_TABLE_NAME"; fi
if [ -n "$INPUT_DDB_PARTITION_KEY" ]; then export DDB_PARTITION_KEY="$INPUT_DDB_PARTITION_KEY"; fi
if [ -n "$INPUT_DDB_SORT_KEY" ]; then export DDB_SORT_KEY="$INPUT_DDB_SORT_KEY"; fi
if [ -n "$INPUT_DDB_QUERY_JSON" ]; then export DDB_QUERY_JSON="$INPUT_DDB_QUERY_JSON"; fi
if [ -n "$INPUT_DDB_EXISTS_OUTPUT" ]; then export DDB_EXISTS_OUTPUT="$INPUT_DDB_EXISTS_OUTPUT"; fi
if [ -n "$INPUT_DDB_FIELD_PATH" ]; then export DDB_FIELD_PATH="$INPUT_DDB_FIELD_PATH"; fi
if [ -n "$INPUT_DDB_OUTPUT_NAME" ]; then export DDB_OUTPUT_NAME="$INPUT_DDB_OUTPUT_NAME"; fi
if [ -n "$INPUT_DDB_RETURN_SECTION" ]; then export DDB_RETURN_SECTION="$INPUT_DDB_RETURN_SECTION"; fi
if [ -n "$INPUT_THREAD_MESSAGE_TS" ]; then export THREAD_MESSAGE_TS="$INPUT_THREAD_MESSAGE_TS"; fi
if [ -n "$INPUT_NEW_THREAD_MESSAGE" ]; then export NEW_THREAD_MESSAGE="$INPUT_NEW_THREAD_MESSAGE"; fi
if [ -n "$INPUT_DDB_TABLE_INDEX_NAME" ]; then export DDB_TABLE_INDEX_NAME="$INPUT_DDB_TABLE_INDEX_NAME"; fi
if [ -n "$INPUT_DDB_INDEX_FIELD_NAME" ]; then export DDB_INDEX_FIELD_NAME="$INPUT_DDB_INDEX_FIELD_NAME"; fi
if [ -n "$INPUT_DDB_INDEX_FIELD_VALUE" ]; then export DDB_INDEX_FIELD_VALUE="$INPUT_DDB_INDEX_FIELD_VALUE"; fi
# Set AWS_REGION, default to us-east-1 if not set
if [ -n "$INPUT_AWS_REGION" ]; then
export AWS_REGION="$INPUT_AWS_REGION"
else
export AWS_REGION="us-east-1"
fi
echo "Debug: Inputs:"
echo "RC_STEP: $RC_STEP"
echo "SLACK_TOKEN: [REDACTED]"
echo "SLACK_CHANNEL: $SLACK_CHANNEL"
echo "THREAD_TS: $THREAD_TS"
echo "MESSAGE: $MESSAGE"
echo "THREAD_MESSAGE: $THREAD_MESSAGE"
echo "NEW_MESSAGE_HEADER: $NEW_MESSAGE_HEADER"
echo "CHANGE_LOG_HEADER_METADATA: $CHANGE_LOG_HEADER_METADATA"
echo "PREVIOUS_MESSAGE: $PREVIOUS_MESSAGE"
echo "REPO_NAME: $REPO_NAME"
echo "DEPLOYED_REF: $DEPLOYED_REF"
echo "CANDIDATE_REF: $CANDIDATE_REF"
echo "DDB_ITEM_TO_BE_ADDED: $DDB_ITEM_TO_BE_ADDED"
echo "DDB_TABLE_NAME: $DDB_TABLE_NAME"
echo "DDB_PARTITION_KEY: $DDB_PARTITION_KEY"
echo "DDB_SORT_KEY: $DDB_SORT_KEY"
echo "DDB_QUERY_JSON: $DDB_QUERY_JSON"
echo "DDB_EXISTS_OUTPUT: $DDB_EXISTS_OUTPUT"
echo "CONTRIBUTORS_RAW_LIST: $CONTRIBUTORS_RAW_LIST"
echo "DDB_FIELD_PATH: $DDB_FIELD_PATH"
echo "DDB_OUTPUT_NAME: $DDB_OUTPUT_NAME"
echo "DDB_RETURN_SECTION: $DDB_RETURN_SECTION"
echo "AWS_REGION: $AWS_REGION"
echo "THREAD_MESSAGE_TS: $THREAD_MESSAGE_TS"
echo "NEW_THREAD_MESSAGE: $NEW_THREAD_MESSAGE"
echo "DDB_TABLE_INDEX_NAME: $DDB_TABLE_INDEX_NAME"
echo "DDB_INDEX_FIELD_NAME: $DDB_INDEX_FIELD_NAME"
echo "DDB_INDEX_FIELD_VALUE: $DDB_INDEX_FIELD_VALUE"
source /maas-build-actions/venv/bin/activate
$RC_PYTHON $RC_HELPER_SCRIPT