Skip to content

Commit

Permalink
Added workflow for updating boilerplate code (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
yindia authored May 31, 2021
1 parent b61b6ee commit d27e70d
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 41 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 12 additions & 0 deletions boilerplate/flyte/docker_build/Makefile
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ If git head has a git tag, the Dockerhub image will also be tagged ``<IMAGE>:<GI

**To Enable:**

Add ``lyft/docker_build`` to your ``boilerplate/update.cfg`` file.
Add ``flyteorg/docker_build`` to your ``boilerplate/update.cfg`` file.

Add ``include boilerplate/lyft/docker_build/Makefile`` in your main ``Makefile`` _after_ your REPOSITORY environment variable
Add ``include boilerplate/flyte/docker_build/Makefile`` in your main ``Makefile`` _after_ your REPOSITORY environment variable

::

REPOSITORY=<myreponame>
include boilerplate/lyft/docker_build/Makefile
include boilerplate/flyte/docker_build/Makefile

(this ensures the extra Make targets get included in your main Makefile)
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
@@ -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._

Expand All @@ -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/<number>
https://github.com/flyteorg/flyte/issues/<number>

## Follow-up issue
_NA_
OR
_https://github.com/lyft/flyte/issues/<number>_
_https://github.com/flyteorg/flyte/issues/<number>_
Original file line number Diff line number Diff line change
@@ -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

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/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 )"

# 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
12 changes: 0 additions & 12 deletions boilerplate/lyft/docker_build/Makefile

This file was deleted.

6 changes: 3 additions & 3 deletions boilerplate/update.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
lyft/docker_build
lyft/pull_request_template
flyte/
flyte/docker_build
flyte/pull_request_template
flyte/welcome_bot
18 changes: 8 additions & 10 deletions boilerplate/update.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down
10 changes: 8 additions & 2 deletions pull_request_template.md
Original file line number Diff line number Diff line change
@@ -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._

Expand All @@ -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/<number>
https://github.com/flyteorg/flyte/issues/<number>

## Follow-up issue
_NA_
OR
_https://github.com/lyft/flyte/issues/<number>_
_https://github.com/flyteorg/flyte/issues/<number>_

0 comments on commit d27e70d

Please sign in to comment.