Skip to content
Open
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ https://docs.travis-ci.com/user/environment-variables/#defining-variables-in-rep
#### Execute the script
To execute the script, you can use git clone followed by bash dd-deploy-metric/dd-deploy-metric.sh command.

In travis we can add the following a after_script to be executed. It will run after every deploy (or script if you don't have deploy section) stages and only if success:
In travis we can add the following a after_deploy to be executed. It will run after every deploy stages and only if success:
```yaml
after_script:
after_deploy:
- git clone https://github.com/searchmetrics/dd-deploy-metric.git && bash dd-deploy-metric/dd-deploy-metric.sh
```
In case you want to ensure this step only runs on specific branch, like main, you can use the following test:
```yaml
after_script:
after_deploy:
- if [ "$TRAVIS_BRANCH" = "main" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then git clone https://github.com/searchmetrics/dd-deploy-metric.git ; bash dd-deploy-metric/dd-deploy-metric.sh; fi
```
> By checking TRAVIS_PULL_REQUEST equals false avoids execution on PRs as Travis sets TRAVIS_BRANCH to the target branch on PRs.
Expand All @@ -46,7 +46,7 @@ jobs:

Another option is to checkout an specific branch or tag:
```yaml
after_script:
after_deploy:
- git clone --branch v0.1 https://github.com/searchmetrics/dd-deploy-metric.git && bash dd-deploy-metric/dd-deploy-metric.sh
```

Expand Down
4 changes: 2 additions & 2 deletions simple-cicd-configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ deploy:
provider: script
script: echo deploying my app

after_script:
- if [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then git clone https://github.com/searchmetrics/dd-deploy-metric.git ; bash dd-deploy-metric/dd-deploy-metric.sh; fi
after_deploy:
Copy link
Contributor

@amalioadam amalioadam Dec 28, 2020

Choose a reason for hiding this comment

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

Shouldn't we report metrics only after the story is delivered to production ?

Copy link
Contributor

Choose a reason for hiding this comment

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

It shall be executed only when it's deployed to production.
In that case maybe it makes sense to clarify that the "deploy" phase shall be used only for production deployment.

Copy link
Contributor

Choose a reason for hiding this comment

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

@amalioadam only when its production
@sm-tomislav-civcija its should be after script and not after deploy

- git clone https://github.com/searchmetrics/dd-deploy-metric.git ; bash dd-deploy-metric/dd-deploy-metric.sh