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

update rebuildstaging workflow to use external tool #28473

Merged
merged 3 commits into from
Sep 7, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion requirements/dev-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ wheel==0.29.0
transifex-client==0.12.4
modernize
gnureadline==6.3.8
git-branch-builder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: git commands are usually verbs or verb phrases. Ex: git-build-branch. Is it too late to change that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there still some way to go in the renaming? The pypi entry and the repo https://github.com/dimagi/git-build-branch are renamed, but looking at the code in the repo it looks like the main directory as well as the executable are still called git-branch-builder.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to push my changes. The repo is now updated.


# documentation
Sphinx~=2.2.1
Expand All @@ -21,6 +22,5 @@ sphinxcontrib-django~=0.5
recommonmark
graphviz==0.13.1


# linting
flake8
13 changes: 7 additions & 6 deletions requirements/dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ git+git://github.com/dimagi/celery@dc7253614fd8500af78b09d1ceb79c50f1baac8d#egg=
certifi==2019.9.11 # via requests, sentry-sdk
cffi==1.13.2 # via cairocffi, csiphash, weasyprint
chardet==3.0.4 # via ghdiff, requests
click==7.0 # via pip-tools
click==7.0 # via git-branch-builder, pip-tools
cloudant==2.12.0 # via jsonobject-couchdbkit
colorama==0.4.1 # via sniffer
commcaretranslationchecker==0.9.7 # via -r requirements/requirements.in
commonmark==0.9.1 # via recommonmark
concurrent-log-handler==0.9.12 # via -r requirements/requirements.in
contextlib2==0.5.5 # via schema
contextlib2==0.5.5 # via git-branch-builder, schema
coverage==4.5.1 # via -r requirements/test-requirements.in
csiphash==0.0.5 # via -r requirements/requirements.in
cssselect2==0.2.2 # via cairosvg, weasyprint
Expand Down Expand Up @@ -86,9 +86,10 @@ fixture==1.5.11 # via -r requirements/dev-requirements.in
flake8==3.7.9 # via -r requirements/dev-requirements.in
flaky==3.6.0 # via -r requirements/test-requirements.in
freezegun==0.3.12 # via -r requirements/test-requirements.in
gevent==1.4.0 # via -r requirements/requirements.in, django-websocket-redis, gipc
gevent==1.4.0 # via -r requirements/requirements.in, django-websocket-redis, gipc, git-branch-builder
ghdiff==0.4 # via -r requirements/requirements.in
gipc==1.0.1 # via -r requirements/requirements.in
git-branch-builder==0.1.8 # via -r requirements/dev-requirements.in
gnureadline==6.3.8 # via -r requirements/dev-requirements.in
graphviz==0.13.1 # via -r requirements/dev-requirements.in
greenlet==0.4.15 # via -r requirements/requirements.in, django-websocket-redis, gevent
Expand All @@ -110,7 +111,7 @@ jmespath==0.9.4 # via boto3, botocore
json-delta==2.0 # via -r requirements/requirements.in
jsonfield==2.1.1 # via -r requirements/requirements.in, django-prbac
jsonobject-couchdbkit==1.0.1 # via -r requirements/requirements.in
jsonobject==0.9.9 # via -r requirements/requirements.in, jsonobject-couchdbkit
jsonobject==0.9.9 # via -r requirements/requirements.in, git-branch-builder, jsonobject-couchdbkit
jsonpath-rw==1.4.0 # via -r requirements/requirements.in
kafka-python==1.4.7 # via -r requirements/requirements.in
kombu==4.2.2.post1 # via -r requirements/requirements.in, celery
Expand Down Expand Up @@ -167,7 +168,7 @@ python-magic==0.4.15 # via -r requirements/requirements.in
python-mimeparse==1.6.0 # via django-tastypie
python-termstyle==0.1.10 # via sniffer
pytz==2019.3 # via -r requirements/requirements.in, babel, celery, django, jenkinsapi, twilio
pyyaml==5.1.2 # via -r requirements/requirements.in
pyyaml==5.1.2 # via -r requirements/requirements.in, git-branch-builder
pyzxcvbn==0.8.0 # via -r requirements/requirements.in
qrcode==4.0.4 # via -r requirements/requirements.in, django-two-factor-auth
quickcache==0.5.4 # via -r requirements/requirements.in
Expand All @@ -183,7 +184,7 @@ rjsmin==1.0.12 # via django-compressor
s3transfer==0.2.1 # via boto3
schema==0.7.1 # via -r requirements/requirements.in
sentry-sdk==0.14.4 # via -r requirements/requirements.in
sh==1.09 # via -r requirements/requirements.in
sh==1.09 # via -r requirements/requirements.in, git-branch-builder
simpleeval==0.9.8 # via -r requirements/requirements.in
simplejson==3.16.0 # via -r requirements/requirements.in, datadog, django-prbac
six==1.13.0 # via -r requirements/requirements.in, django-appconf, django-extensions, django-prbac, django-simple-captcha, django-statici18n, django-transfer, django-websocket-redis, dropbox, ethiopian-date-converter, eulxml, faker, fixture, freezegun, ghdiff, html5lib, jsonfield, jsonobject, jsonobject-couchdbkit, jsonpath-rw, mock, packaging, pip-tools, python-dateutil, pyzxcvbn, qrcode, quickcache, requests-mock, sqlalchemy-postgres-copy, traitlets, transifex-client, twilio, unittest2
Expand Down
22 changes: 0 additions & 22 deletions scripts/checkyaml.py

This file was deleted.

59 changes: 1 addition & 58 deletions scripts/commit-staging
Original file line number Diff line number Diff line change
@@ -1,60 +1,3 @@
#!/bin/bash

function get_branch() {
git branch | grep '^\*' | sed 's/* //'
}

function abort () {
echo $1
echo "Aborting."
exit 1
}

filename=scripts/staging.yaml
branch=$(get_branch)
COMMIT_MESSAGE='update staging.yaml'

if [[ $branch != 'master' ]]
then
abort "You may only commit staging.yaml changes to master."
fi

# add staging.yaml if the user hasn't
git add $filename


# make sure the only thing about to be committed is scripts/staging.yaml
staged_files=$(git diff --staged --stat | grep '|' | cut -d '|' -f1 | cut -d ' ' -f2)
if [[ 'scripts/staging.yaml' != $staged_files ]]
then
if [[ '' = $staged_files ]]
then
abort "You have no changes to commit."
else
abort "You have staged changes to more files than just $filename."
fi
fi


# make sure staging.yaml parses as yaml
python scripts/checkyaml.py $filename
if [[ $? -ne 0 ]]
then
abort "Fix staging.yml and try again"
fi

# make sure local is not ahead of origin
git fetch
if [[ -n $(git log --max-count=1 origin/$branch..$branch) ]]
then
abort "Your local $branch is ahead of origin/$branch."
fi

# have the commit follow a certain template
git commit --edit --message="$COMMIT_MESSAGE" --message "[ci skip]"

# push if using --push option
if [[ $1 = '--push' ]]
then
git push origin $branch
fi
safe-commit-files scripts/staging.yaml
178 changes: 0 additions & 178 deletions scripts/gitutils.py

This file was deleted.

11 changes: 3 additions & 8 deletions scripts/rebuildstaging
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ rebuild staging from yaml configuration (scripts/staging.yaml)
--deploy deploy after rebuild is complete
--no-push do not push changes (cannot be used with --deploy)
--skip-fetch assume local copy is already update date with remote
--enterprise rebuild the enterprise branch
EOF
}

Expand Down Expand Up @@ -39,10 +38,6 @@ do
no_push=y
echo no-push
;;
--enterprise)
enterprise=y
echo enterprise
;;
*)
usage
exit 1
Expand All @@ -52,13 +47,13 @@ done

function rebuildstaging() {
echo "rebuilding staging branch, this might take a while..."
python scripts/rebuildstaging.py scripts/staging.yaml "$@"
git-branch-builder scripts/staging.yaml "$@"
}

args=''

[[ $verbose = 'y' ]] && args="$args -v"
[[ $no_push = 'y' ]] && args="$args --no-push"
[[ -z "$no_push" || $no_push != 'y' ]] && args="$args --push"

[[ $skip_fetch = 'y' ]] && args="$args sync rebuild"

Expand All @@ -71,7 +66,7 @@ then
exit 1
fi

if [[ $deploy = 'y' && $no_push != 'y' && $enterprise != 'y' ]]
if [[ $deploy = 'y' && $no_push != 'y' ]]
then
rebuildstaging $args && {
which commcare-cloud \
Expand Down
Loading