Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add sync readme to ecr public #345

Merged
merged 1 commit into from
Jan 12, 2021
Merged
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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ jobs:

- name: Sync Readme to Dockerhub
run: make sync-readme-to-dockerhub

- name: Sync Readme to ECR Public
run: make sync-readme-to-ecr-public

- name: Create NTH README Update PR
run: make create-release-prep-pr-readme
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ generate-k8s-yaml:
sync-readme-to-dockerhub:
${MAKEFILE_PATH}/scripts/sync-readme-to-dockerhub

sync-readme-to-ecr-public:
@ECR_REGISTRY=${ECR_REGISTRY} ${MAKEFILE_PATH}/scripts/ecr-public-login
${MAKEFILE_PATH}/scripts/sync-readme-to-ecr-public

ekscharts-sync:
${MAKEFILE_PATH}/scripts/sync-to-aws-eks-charts -b ${BINARY_NAME} -r ${REPO_FULL_NAME}

Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
<a href="https://goreportcard.com/report/github.com/aws/aws-node-termination-handler">
<img src="https://goreportcard.com/badge/github.com/aws/aws-node-termination-handler" alt="go-report-card">
</a>
<a href="https://travis-ci.org/aws/aws-node-termination-handler">
<img src="https://travis-ci.org/aws/aws-node-termination-handler.svg?branch=main" alt="build-status">
</a>
<a href="https://codecov.io/gh/aws/aws-node-termination-handler">
<img src="https://img.shields.io/codecov/c/github/aws/aws-node-termination-handler" alt="build-status">
</a>
Expand All @@ -26,6 +23,8 @@
</a>
</p>

![NTH Continuous Integration and Release](https://github.com/aws/aws-node-termination-handler/workflows/NTH%20Continuous%20Integration%20and%20Release/badge.svg)

<div>
<hr>
</div>
Expand Down
32 changes: 32 additions & 0 deletions scripts/sync-readme-to-ecr-public
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
set -euo pipefail

SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
REPO_NAME="aws-node-termination-handler"
#about and usage section char max
MAX_CHAR_COUNT=10240
USAGE_TEXT="See About section"
ADDITIONAL_MSG="...

**truncated due to char limits**...
A complete version of the ReadMe can be found [here](https://github.com/aws/aws-node-termination-handler#aws-node-termination-handler)\""


if git --no-pager diff --name-only HEAD^ HEAD | grep 'README.md'; then
#converting to json to insert esc chars, then replace newlines for proper markdown render
raw_about=$(jq -n --arg msg "$(<$SCRIPTPATH/../README.md)" '{"usageText": $msg}' | jq '.usageText' | sed 's/\\n/\
/g')
char_to_trunc="$(($MAX_CHAR_COUNT-${#ADDITIONAL_MSG}))"
raw_truncated="${raw_about:0:$char_to_trunc}"
raw_truncated+="$ADDITIONAL_MSG"
resp=$(aws ecr-public put-repository-catalog-data --repository-name="${REPO_NAME}" --catalog-data aboutText="${raw_truncated}",usageText="${USAGE_TEXT}" --region us-east-1)

if [[ $resp -ge 1 ]]; then
echo "README sync to ecr-public failed"
exit 1
else
echo "README sync to ecr-public succeeded!"
fi
else
echo "README.md did not change in the last commit. Not taking any action."
fi