Skip to content

Commit

Permalink
update sns message for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
rcrozean committed Dec 12, 2023
1 parent 96bbef9 commit 7f6f069
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions projects/golang/go/scripts/eks_golang_release_notification.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,30 @@
# See the License for the specific language governing permissions and
# limitations under the License.


if [ "$AWS_ROLE_ARN" == "" ]; then
echo "Empty AWS_ROLE_ARN"
exit 1
echo "Empty AWS_ROLE_ARN"
exit 1
fi

if [ "$ARTIFACT_DEPLOYMENT_ROLE_ARN" == "" ]; then
echo "Empty ARTIFACT_DEPLOYMENT_ROLE_ARN"
exit 1
echo "Empty ARTIFACT_DEPLOYMENT_ROLE_ARN"
exit 1
fi

if [ "$SNS_TOPIC_ARN" == "" ]; then
echo "Empty SNS_TOPIC_ARN"
exit 1
echo "Empty SNS_TOPIC_ARN"
exit 1
fi

if [ "$GO_SOURCE_VERSION" == "" ]; then
echo "Empty GO_SOURCE_VERSION"
exit 1
echo "Empty GO_SOURCE_VERSION"
exit 1
fi

BASE_DIRECTORY=$(git rev-parse --show-toplevel)
cd $BASE_DIRECTORY || exit

cat << EOF > awscliconfig
cat <<EOF >awscliconfig
[default]
output=json
region=${AWS_REGION:-${AWS_DEFAULT_REGION:-us-west-2}}
Expand All @@ -56,21 +55,24 @@ unset AWS_ROLE_ARN AWS_WEB_IDENTITY_TOKEN_FILE
GOLANG_TRACKING_TAG="$(cat $BASE_DIRECTORY/projects/golang/go/$GO_SOURCE_VERSION/GIT_TAG)"
SNS_MESSAGE="eks_golang_release: $(cat $BASE_DIRECTORY/projects/golang/go/$GO_SOURCE_VERSION/RELEASE)
golang_tracking_tag: $GOLANG_TRACKING_TAG
golang_tracking_version: ${GOLANG_TRACKING_TAG:2}" # removes "go" at front
golang_tracking_version: ${GOLANG_TRACKING_TAG:2}
metadata:
summary: This is the EKS Go source release, not the minimal base or debian images. See the link in the github tag for artifact source locations.
github: https://github.com/aws/$BASE_DIRECTORY/projects/golang/go/$GO_SOURCE_VERSION"

SNS_MESSAGE_ID=$(
aws sns publish \
--profile "artifacts-push" \
--topic-arn "$SNS_TOPIC_ARN" \
--subject "New Release of EKS Golang v$GO_SOURCE_VERSION" \
--message "$SNS_MESSAGE"\
--query "MessageId" --output text
aws sns publish \
--profile "artifacts-push" \
--topic-arn "$SNS_TOPIC_ARN" \
--subject "New Release of EKS Golang v$GO_SOURCE_VERSION" \
--message "$SNS_MESSAGE" \
--query "MessageId" --output text
)

if [ "$SNS_MESSAGE_ID" ]; then
echo -e "\nEKS Golang release notification published with SNS MessageId $SNS_MESSAGE_ID"
echo -e "\nEKS Golang release notification published with SNS MessageId $SNS_MESSAGE_ID"
else
echo -e "Received unexpected response while publishing to EKS Golang release SNS topic $SNS_TOPIC_ARN. \
echo -e "Received unexpected response while publishing to EKS Golang release SNS topic $SNS_TOPIC_ARN. \
An error may have occurred, and the notification may not have been published"
exit 1
exit 1
fi

0 comments on commit 7f6f069

Please sign in to comment.