From d27e70d045870d2cfcee0af9cb190a215626a1d9 Mon Sep 17 00:00:00 2001 From: Yuvraj Date: Mon, 31 May 2021 23:39:27 +0530 Subject: [PATCH] Added workflow for updating boilerplate code (#168) --- Makefile | 3 ++- boilerplate/flyte/docker_build/Makefile | 12 ++++++++++++ .../{lyft => flyte}/docker_build/Readme.rst | 6 +++--- .../docker_build/docker_build.sh | 4 ++-- .../pull_request_template/Readme.rst | 2 +- .../pull_request_template.md | 10 ++++++++-- .../pull_request_template/update.sh | 4 ++-- boilerplate/flyte/{ => welcome_bot}/Readme.rst | 0 boilerplate/flyte/{ => welcome_bot}/config.yml | 0 boilerplate/flyte/{ => welcome_bot}/update.sh | 6 +++--- boilerplate/lyft/docker_build/Makefile | 12 ------------ boilerplate/update.cfg | 6 +++--- boilerplate/update.sh | 18 ++++++++---------- pull_request_template.md | 10 ++++++++-- 14 files changed, 52 insertions(+), 41 deletions(-) create mode 100644 boilerplate/flyte/docker_build/Makefile rename boilerplate/{lyft => flyte}/docker_build/Readme.rst (66%) rename boilerplate/{lyft => flyte}/docker_build/docker_build.sh (91%) rename boilerplate/{lyft => flyte}/pull_request_template/Readme.rst (55%) rename boilerplate/{lyft => flyte}/pull_request_template/pull_request_template.md (54%) rename boilerplate/{lyft => flyte}/pull_request_template/update.sh (61%) rename boilerplate/flyte/{ => welcome_bot}/Readme.rst (100%) rename boilerplate/flyte/{ => welcome_bot}/config.yml (100%) rename boilerplate/flyte/{ => welcome_bot}/update.sh (55%) delete mode 100644 boilerplate/lyft/docker_build/Makefile diff --git a/Makefile b/Makefile index 93faabab9..d6ffd713e 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,9 @@ export REPOSITORY=flyteconsole -include boilerplate/lyft/docker_build/Makefile +include boilerplate/flyte/docker_build/Makefile .PHONY: update_boilerplate update_boilerplate: + @curl https://raw.githubusercontent.com/flyteorg/boilerplate/master/boilerplate/update.sh -o boilerplate/update.sh @boilerplate/update.sh .PHONY: install diff --git a/boilerplate/flyte/docker_build/Makefile b/boilerplate/flyte/docker_build/Makefile new file mode 100644 index 000000000..e2b2b8a18 --- /dev/null +++ b/boilerplate/flyte/docker_build/Makefile @@ -0,0 +1,12 @@ +# WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES. +# ONLY EDIT THIS FILE FROM WITHIN THE 'FLYTEORG/BOILERPLATE' REPOSITORY: +# +# TO OPT OUT OF UPDATES, SEE https://github.com/flyteorg/boilerplate/blob/master/Readme.rst + +.PHONY: docker_build +docker_build: + IMAGE_NAME=$$REPOSITORY ./boilerplate/flyte/docker_build/docker_build.sh + +.PHONY: dockerhub_push +dockerhub_push: + IMAGE_NAME=flyteorg/$$REPOSITORY REGISTRY=docker.io ./boilerplate/flyte/docker_build/docker_build.sh diff --git a/boilerplate/lyft/docker_build/Readme.rst b/boilerplate/flyte/docker_build/Readme.rst similarity index 66% rename from boilerplate/lyft/docker_build/Readme.rst rename to boilerplate/flyte/docker_build/Readme.rst index bb6af9b49..7790b8fbf 100644 --- a/boilerplate/lyft/docker_build/Readme.rst +++ b/boilerplate/flyte/docker_build/Readme.rst @@ -11,13 +11,13 @@ If git head has a git tag, the Dockerhub image will also be tagged ``: - include boilerplate/lyft/docker_build/Makefile + include boilerplate/flyte/docker_build/Makefile (this ensures the extra Make targets get included in your main Makefile) diff --git a/boilerplate/lyft/docker_build/docker_build.sh b/boilerplate/flyte/docker_build/docker_build.sh similarity index 91% rename from boilerplate/lyft/docker_build/docker_build.sh rename to boilerplate/flyte/docker_build/docker_build.sh index f504c100c..a77f8a2d7 100755 --- a/boilerplate/lyft/docker_build/docker_build.sh +++ b/boilerplate/flyte/docker_build/docker_build.sh @@ -1,9 +1,9 @@ #!/usr/bin/env bash # WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES. -# ONLY EDIT THIS FILE FROM WITHIN THE 'LYFT/BOILERPLATE' REPOSITORY: +# ONLY EDIT THIS FILE FROM WITHIN THE 'FLYTEORG/BOILERPLATE' REPOSITORY: # -# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst +# TO OPT OUT OF UPDATES, SEE https://github.com/flyteorg/boilerplate/blob/master/Readme.rst set -e diff --git a/boilerplate/lyft/pull_request_template/Readme.rst b/boilerplate/flyte/pull_request_template/Readme.rst similarity index 55% rename from boilerplate/lyft/pull_request_template/Readme.rst rename to boilerplate/flyte/pull_request_template/Readme.rst index b85a4ea12..ee5443725 100644 --- a/boilerplate/lyft/pull_request_template/Readme.rst +++ b/boilerplate/flyte/pull_request_template/Readme.rst @@ -5,4 +5,4 @@ Provides a Pull Request template. **To Enable:** -Add ``lyft/golang_test_targets`` to your ``boilerplate/update.cfg`` file. +Add ``flyteorg/golang_test_targets`` to your ``boilerplate/update.cfg`` file. diff --git a/boilerplate/lyft/pull_request_template/pull_request_template.md b/boilerplate/flyte/pull_request_template/pull_request_template.md similarity index 54% rename from boilerplate/lyft/pull_request_template/pull_request_template.md rename to boilerplate/flyte/pull_request_template/pull_request_template.md index d2becf38b..d7699558b 100644 --- a/boilerplate/lyft/pull_request_template/pull_request_template.md +++ b/boilerplate/flyte/pull_request_template/pull_request_template.md @@ -1,3 +1,9 @@ +## Read then delete + +- Make sure to use a concise title for the pull-request. +- Use #patch, #minor or #major in the pull-request title to bump the corresponding version. Otherwise, the patch version +will be bumped. [More details](https://github.com/marketplace/actions/github-tag-bump) + # TL;DR _Please replace this text with a description of what this PR accomplishes._ @@ -18,9 +24,9 @@ _Please replace this text with a description of what this PR accomplishes._ _How did you fix the bug, make the feature etc. Link to any design docs etc_ ## Tracking Issue -https://github.com/lyft/flyte/issues/ +https://github.com/flyteorg/flyte/issues/ ## Follow-up issue _NA_ OR -_https://github.com/lyft/flyte/issues/_ +_https://github.com/flyteorg/flyte/issues/_ diff --git a/boilerplate/lyft/pull_request_template/update.sh b/boilerplate/flyte/pull_request_template/update.sh similarity index 61% rename from boilerplate/lyft/pull_request_template/update.sh rename to boilerplate/flyte/pull_request_template/update.sh index 13f0c3b57..051e9dbce 100755 --- a/boilerplate/lyft/pull_request_template/update.sh +++ b/boilerplate/flyte/pull_request_template/update.sh @@ -1,9 +1,9 @@ #!/usr/bin/env bash # WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES. -# ONLY EDIT THIS FILE FROM WITHIN THE 'LYFT/BOILERPLATE' REPOSITORY: +# ONLY EDIT THIS FILE FROM WITHIN THE 'FLYTEORG/BOILERPLATE' REPOSITORY: # -# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst +# TO OPT OUT OF UPDATES, SEE https://github.com/flyteorg/boilerplate/blob/master/Readme.rst set -e diff --git a/boilerplate/flyte/Readme.rst b/boilerplate/flyte/welcome_bot/Readme.rst similarity index 100% rename from boilerplate/flyte/Readme.rst rename to boilerplate/flyte/welcome_bot/Readme.rst diff --git a/boilerplate/flyte/config.yml b/boilerplate/flyte/welcome_bot/config.yml similarity index 100% rename from boilerplate/flyte/config.yml rename to boilerplate/flyte/welcome_bot/config.yml diff --git a/boilerplate/flyte/update.sh b/boilerplate/flyte/welcome_bot/update.sh similarity index 55% rename from boilerplate/flyte/update.sh rename to boilerplate/flyte/welcome_bot/update.sh index 506c3221b..120dbd365 100755 --- a/boilerplate/flyte/update.sh +++ b/boilerplate/flyte/welcome_bot/update.sh @@ -1,9 +1,9 @@ #!/usr/bin/env bash # WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES. -# ONLY EDIT THIS FILE FROM WITHIN THE 'LYFT/BOILERPLATE' REPOSITORY: +# ONLY EDIT THIS FILE FROM WITHIN THE 'FLYTEORG/BOILERPLATE' REPOSITORY: # -# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst +# TO OPT OUT OF UPDATES, SEE https://github.com/flyteorg/boilerplate/blob/master/Readme.rst set -e @@ -11,4 +11,4 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" # Clone the config.yml file echo " - copying ${DIR}/config.yml to the root directory." -cp ${DIR}/config.yml ${DIR}/../../.github/config.yml +cp "${DIR}"/config.yml "${DIR}"/../../../.github/config.yml diff --git a/boilerplate/lyft/docker_build/Makefile b/boilerplate/lyft/docker_build/Makefile deleted file mode 100644 index 4019dab83..000000000 --- a/boilerplate/lyft/docker_build/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES. -# ONLY EDIT THIS FILE FROM WITHIN THE 'LYFT/BOILERPLATE' REPOSITORY: -# -# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst - -.PHONY: docker_build -docker_build: - IMAGE_NAME=$$REPOSITORY ./boilerplate/lyft/docker_build/docker_build.sh - -.PHONY: dockerhub_push -dockerhub_push: - IMAGE_NAME=lyft/$$REPOSITORY REGISTRY=docker.io ./boilerplate/lyft/docker_build/docker_build.sh diff --git a/boilerplate/update.cfg b/boilerplate/update.cfg index 489f054e9..07a65c51f 100644 --- a/boilerplate/update.cfg +++ b/boilerplate/update.cfg @@ -1,3 +1,3 @@ -lyft/docker_build -lyft/pull_request_template -flyte/ +flyte/docker_build +flyte/pull_request_template +flyte/welcome_bot diff --git a/boilerplate/update.sh b/boilerplate/update.sh index 374e4b930..9173b662d 100755 --- a/boilerplate/update.sh +++ b/boilerplate/update.sh @@ -1,23 +1,21 @@ #!/usr/bin/env bash # WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES. -# ONLY EDIT THIS FILE FROM WITHIN THE 'LYFT/BOILERPLATE' REPOSITORY: +# ONLY EDIT THIS FILE FROM WITHIN THE 'FLYTEORG/BOILERPLATE' REPOSITORY: # -# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst +# TO OPT OUT OF UPDATES, SEE https://github.com/flyteorg/boilerplate/blob/master/Readme.rst set -e DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" OUT="$(mktemp -d)" -trap "rm -fr $OUT" EXIT +trap 'rm -fr $OUT' EXIT -git clone git@github.com:flyteorg/boilerplate.git "${OUT}" +git clone https://github.com/flyteorg/boilerplate.git "${OUT}" echo "Updating the update.sh script." cp "${OUT}/boilerplate/update.sh" "${DIR}/update.sh" -echo "" - CONFIG_FILE="${DIR}/update.cfg" README="https://github.com/flyteorg/boilerplate/blob/master/Readme.rst" @@ -30,12 +28,12 @@ if [ ! -f "$CONFIG_FILE" ]; then fi if [ -z "$REPOSITORY" ]; then - echo '$REPOSITORY is required to run this script' + echo "$REPOSITORY is required to run this script" echo "See $README for more details." exit 1 fi -while read directory junk; do +while read -r directory junk; do # Skip comment lines (which can have leading whitespace) if [[ "$directory" == '#'* ]]; then continue @@ -63,8 +61,8 @@ while read directory junk; do echo "$directory is configured in update.cfg." echo "-----------------------------------------------------------------------------------" echo "syncing files from source." - rm -rf "${DIR}/${directory}" - mkdir -p $(dirname "${DIR}/${directory}") + rm -rf "${DIR:?}/${directory}" + mkdir -p "$(dirname "${DIR}"/"${directory}")" cp -r "$dir_path" "${DIR}/${directory}" if [ -f "${DIR}/${directory}/update.sh" ]; then echo "executing ${DIR}/${directory}/update.sh" diff --git a/pull_request_template.md b/pull_request_template.md index d2becf38b..d7699558b 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -1,3 +1,9 @@ +## Read then delete + +- Make sure to use a concise title for the pull-request. +- Use #patch, #minor or #major in the pull-request title to bump the corresponding version. Otherwise, the patch version +will be bumped. [More details](https://github.com/marketplace/actions/github-tag-bump) + # TL;DR _Please replace this text with a description of what this PR accomplishes._ @@ -18,9 +24,9 @@ _Please replace this text with a description of what this PR accomplishes._ _How did you fix the bug, make the feature etc. Link to any design docs etc_ ## Tracking Issue -https://github.com/lyft/flyte/issues/ +https://github.com/flyteorg/flyte/issues/ ## Follow-up issue _NA_ OR -_https://github.com/lyft/flyte/issues/_ +_https://github.com/flyteorg/flyte/issues/_