This repository was archived by the owner on Jan 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
New branching model #34
Open
LeZuse
wants to merge
8
commits into
master
Choose a base branch
from
full-sha
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c095893
rewrite rollbar-source-map
LeZuse 32a9321
deploy-redis: add support for branches
LeZuse 6a267d6
activate-rev: add support for branches
LeZuse 41bed74
add activate-branch command
LeZuse 0ff2ab8
update readme
LeZuse 222ad4c
batch deploy: add support for branches
LeZuse b0510af
add readme for the new branching model
LeZuse ac1130a
rename activate-rev to update-branch
LeZuse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| yarn.lock binary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #!/usr/bin/env node | ||
| var path = require('path'); | ||
| require(path.join(__dirname, '..', 'tasks', 'activate-branch')); | ||
| require('gulp').start('activate-branch'); |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,13 +2,19 @@ | |
| # dont execute next commands on error | ||
| trap 'exit' ERR | ||
|
|
||
| # colors | ||
| RED='\033[0;31m' | ||
| YELLOW='\033[0;33m' | ||
| CYAN='\033[0;36m' | ||
| NC='\033[0m' # No Color | ||
|
|
||
| # let echo interpret escape chars (\n) | ||
| shopt -s xpg_echo | ||
|
|
||
| GULP="`npm bin`/gulp" | ||
|
|
||
| if [[ ! -x "$GULP" ]]; then | ||
| echo "ERROR: gulp executable not found" | ||
| echo "${RED}ERROR: gulp executable not found$NC" | ||
| echo "Check path for valid executable: $GULP" | ||
| exit 1 | ||
| fi | ||
|
|
@@ -33,7 +39,7 @@ set_dirname | |
| # ENV is the first parameter, defaults to "staging" | ||
| ENV=${1-development} | ||
|
|
||
| echo "Environment: $ENV" | ||
| echo "Environment: ${YELLOW}$ENV$NC" | ||
|
|
||
| case "$ENV" in | ||
| production) | ||
|
|
@@ -62,17 +68,17 @@ BRANCH=`git rev-parse --abbrev-ref HEAD` | |
| REV="$COMMIT" | ||
| BUILD_COUNT=`ls -a build*log 2>/dev/null | cat | wc -l | awk {'print $1'}` | ||
|
|
||
| if [ $BRANCH == "dev" -o $BRANCH == "master" -o $BRANCH == "HEAD" ]; then | ||
| echo "Deploying with commit hash $REV\n" | ||
| if [ $BRANCH == "HEAD" ]; then | ||
| echo "Deploying with commit hash ${YELLOW}$REV$NC\n" | ||
| else | ||
| REV="branch/$BRANCH" | ||
| echo "Deploying branch $BRANCH\n" | ||
| REV="$BRANCH" | ||
| echo "Deploying revision ${YELLOW}$COMMIT$NC for branch ${YELLOW}$BRANCH$NC\n" | ||
| fi | ||
|
|
||
| if [[ $BUILD_COUNT -ne 0 ]]; then | ||
| echo "Detected $BUILD_COUNT build app versions:" | ||
| echo "Detected $BUILD_COUNT build app versions from logs:" | ||
| for build in build*log; do | ||
| echo "\t`cat "$build" | grep Hash: | head -1 | cut -d' ' -f2`: `echo $build | cut -d'.' -f2`" | ||
| echo "\t${YELLOW}`grep Hash: "$build" | head -1 | cut -d' ' -f2`$NC: $build" | ||
| done | ||
| echo | ||
| else | ||
|
|
@@ -85,7 +91,7 @@ gulp_config deploy-s3 --env=$ENV | |
|
|
||
| gulp_config rollbar-source-map --env=$ENV --rev=$COMMIT_ROLLBAR | ||
|
|
||
| gulp_config deploy-redis --env=$ENV --rev=$REV | ||
| gulp_config deploy-redis --env=$ENV --rev=$COMMIT --branch=$BRANCH | ||
|
|
||
| gulp_config git-deploy-tag --env=$ENV --rev=$REV | ||
|
|
||
|
|
@@ -95,6 +101,8 @@ gulp_config slack-notify --env=$ENV --rev=$REV | |
| echo "\nDeploy into $ENV environment took ${SECONDS}s.\n" | ||
|
|
||
| echo "TEST with:" | ||
| echo "\t$DOMAIN/?rev=$REV" | ||
| echo "THEN to activate run:" | ||
| echo "\tactivate-rev --notify --env=$ENV --rev=$REV\n" | ||
| echo "\t$DOMAIN/?rev=$REV\n" | ||
| echo "To activate the branch (auto updated revision with every branch deploy):" | ||
| echo "\t${CYAN}activate-branch --env=$ENV --branch=$BRANCH --notify$NC\n" | ||
| echo "To activate the commit:" | ||
| echo "\t${CYAN}activate-rev --env=$ENV --rev=$COMMIT --branch=$BRANCH --notify$NC\n" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't really allow that in the current version. We should change the wording a bit. |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #!/usr/bin/env node | ||
| var path = require('path'); | ||
| require(path.join(__dirname, '..', 'tasks', 'update-branch')); | ||
| require('gulp').start('update-branch'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,35 @@ | ||
| var secrets = require('./secrets.js'); | ||
|
|
||
| var s3Credential = { | ||
| accessKeyId: secrets.s3.accessKeyId, | ||
| accessKeyId: secrets.s3.accessKeyId, | ||
| secretAccessKey: secrets.s3.secretAccessKey, | ||
| params: { | ||
| Bucket: 'productboard-assets' | ||
| } | ||
| Bucket: 'productboard-assets', | ||
| }, | ||
| }; | ||
|
|
||
| var config = { | ||
|
|
||
| redis: { | ||
| development: { | ||
| port: 6379, | ||
| host: 'localhost', | ||
| db: 1, | ||
| options: { }, | ||
| options: {}, | ||
| indexPath: 'dist/index.html', | ||
| indexKey: 'app:%s', | ||
| metaKey: 'meta:%s', | ||
| indexKey: 'app:%s', // revision | ||
| branchKey: 'app:branch:%s', // branch name | ||
| branchRevKey: 'app:branch-revision:%s', // branch name | ||
| metaKey: 'meta:%s', // revision | ||
| mainBranchKey: 'app:current-branch', | ||
| mainIndexKey: 'app:current', | ||
| mainRevKey: 'app:current-revision', | ||
| revTimestampKey: 'app-timestamp:%s', | ||
| lastMajorTimestampKey: 'app:last-major-timestamp', | ||
| revTimestampKey: 'app-timestamp:%s', // revision | ||
| lastMajorTimestampKey: 'app:admin:last-major-timestamp:%s', // branch name | ||
| }, | ||
| staging: { | ||
| port: 9999, | ||
| db: 0, | ||
| host: 'pub-redis-9999.us-east-1-1.2.ec2.garantiadata.com', | ||
| port: 9999, | ||
| db: 0, | ||
| host: 'pub-redis-9999.us-east-1-1.2.ec2.garantiadata.com', | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this good idea to have those URL in the repository?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Anything that's not supposed to be in the repo can be in the |
||
| options: { auth_pass: secrets.redis.staging.auth_pass }, | ||
| indexPath: 'dist/index.html', | ||
| indexKey: 'app:%s', | ||
|
|
@@ -38,9 +40,9 @@ var config = { | |
| lastMajorTimestampKey: 'app:last-major-timestamp', | ||
| }, | ||
| me: { | ||
| port: 8888, | ||
| db: 0, | ||
| host: 'pub-redis-8888.us-east-1-3.3.ec2.garantiadata.com', | ||
| port: 8888, | ||
| db: 0, | ||
| host: 'pub-redis-8888.us-east-1-3.3.ec2.garantiadata.com', | ||
| options: { auth_pass: secrets.redis.me.auth_pass }, | ||
| indexPath: 'dist/index.html', | ||
| indexKey: 'app:%s', | ||
|
|
@@ -51,9 +53,9 @@ var config = { | |
| lastMajorTimestampKey: 'app:last-major-timestamp', | ||
| }, | ||
| production: { | ||
| port: 7777, | ||
| db: 0, | ||
| host: 'pub-redis-7777.us-east-1-1.2.ec2.garantiadata.com', | ||
| port: 7777, | ||
| db: 0, | ||
| host: 'pub-redis-7777.us-east-1-1.2.ec2.garantiadata.com', | ||
| options: { auth_pass: secrets.redis.production.auth_pass }, | ||
| indexPath: 'dist/index.html', | ||
| indexKey: 'app:%s', | ||
|
|
@@ -62,7 +64,7 @@ var config = { | |
| mainRevKey: 'app:current-revision', | ||
| revTimestampKey: 'app-timestamp:%s', | ||
| lastMajorTimestampKey: 'app:last-major-timestamp', | ||
| } | ||
| }, | ||
| }, | ||
|
|
||
| s3: { | ||
|
|
@@ -86,7 +88,7 @@ var config = { | |
| credentials: s3Credential, | ||
| dirname: '/development/assets', | ||
| assetsPath: 'dist/assets/*', | ||
| } | ||
| }, | ||
| }, | ||
|
|
||
| rollbar: { | ||
|
|
@@ -107,17 +109,19 @@ var config = { | |
| sourceMapPath: 'dist/assets/main-%s.map', | ||
| accessToken: secrets.rollbar.production.accessToken, | ||
| abbrev: 7, | ||
| } | ||
| }, | ||
| }, | ||
|
|
||
| slack: { | ||
| staging: { | ||
| url: 'https://staging.example.com', | ||
| notifyWebHook: 'https://hooks.slack.com/services/XXXXYYYY/ZZZZUUUUU/asdjLJFHLFJKHLDJKFHDdfdh', | ||
| notifyWebHook: | ||
| 'https://hooks.slack.com/services/XXXXYYYY/ZZZZUUUUU/asdjLJFHLFJKHLDJKFHDdfdh', | ||
| }, | ||
| production: { | ||
| url: 'https://www.example.com', | ||
| notifyWebHook: 'https://hooks.slack.com/services/ZZZZYYYY/ZZZZTTTTT/asdjLJFHLFJKHLDJKFHDdfdh', | ||
| notifyWebHook: | ||
| 'https://hooks.slack.com/services/ZZZZYYYY/ZZZZTTTTT/asdjLJFHLFJKHLDJKFHDdfdh', | ||
| }, | ||
| }, | ||
|
|
||
|
|
@@ -126,10 +130,8 @@ var config = { | |
| url: 'https://staging.example.com', | ||
| remote: 'origin', | ||
| abbrev: 7, | ||
| } | ||
| }, | ||
| }, | ||
|
|
||
| }; | ||
|
|
||
| module.exports = config; | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need branch here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's how the new setup works. You activate revs inside branches the same way you move a branch tip in Git.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But you don't need information about the branch. There isn't a relation between branch and SHA.