Comments (8)
Hey,
sorry for the late reply. Can you add some logging on your own? Especialy around the chanes that came with the last Version:
3e82ec0#diff-9a2cdc7907fa6a4bfc94da76b035c282R52
Namely repoBranch
, commitBranch
, before
and after
.
Im unsure why this is causing issues.
Thanks!
from drone-tree-config.
Thanks for the response @foosinn! I tried running everything locally with the latest build and it appears to build the master branch; however, now it is always building the same sub-project and referencing the same commit every time.
I am new to go, but tried looking through the source code and found that drone-tree-config calls the github api asking for the difference between two commits.
Below is an example output I get from pushing a commit on a master branch: GitHub Webhook -> GitHub Diff -> drone-tree-config log.
GitHub Webhook
{
...
"compare":
"https://github.com/org/monorepo/compare/2974355b58a8...1132d604c2e0",
"commits": [
{
"id": "fb8c7401619411a8e2ab5faffccd2ba6ce8a0e88",
"tree_id": "f1271afa1d56c36f6936959f8f78ea1d755041bd",
"distinct": false,
"message": "Ignore local .env.production file",
"timestamp": "2020-03-09T11:40:30-06:00",
"url": "https://github.com/org/monorepo/commit/fb8c7401619411a8e2ab5faffccd2ba6ce8a0e88",
"author": {
"name": "Eric Shelley",
"email": "[email protected]",
"username": "bartimaeus"
},
"committer": {
"name": "Eric Shelley",
"email": "[email protected]",
"username": "bartimaeus"
},
"added": [],
"removed": [],
"modified": [
"packages/manage/.gitignore"
]
},
{
"id": "1132d604c2e054125389943105c3a333aa6b9426",
"tree_id": "60745b1959163b42237d0fca04247a71b76b6fc8",
"distinct": true,
"message": "Merge branch 'develop'\n\n* develop:\n Ignore local .env.production file",
"timestamp": "2020-03-09T11:40:57-06:00",
"url": "https://github.com/org/monorepo/commit/1132d604c2e054125389943105c3a333aa6b9426",
"author": {
"name": "Eric Shelley",
"email": "[email protected]",
"username": "bartimaeus"
},
"committer": {
"name": "Eric Shelley",
"email": "[email protected]",
"username": "bartimaeus"
},
"added": [],
"removed": [],
"modified": [
"packages/manage/.gitignore"
]
}
],
...
}
GitHub Diff API Response
{
...
"files": [
{
"sha": "2538b99d3538b702c705cc6b9b24f99cd7dd070a",
"filename": "packages/manage/.gitignore",
"status": "modified",
"additions": 1,
"deletions": 0,
"changes": 1,
...
"patch": "@@ -16,6 +16,7 @@\n .env.local\n .env.development.local\n .env.test.local\n+.env.production\n .env.production.local\n \n npm-debug.log*"
}
]
}
drone-tree-config log
drone_tree_config | time="2020-03-09T19:10:39Z" level=debug msg="3a511a34-c67b-4603-a766-33b73e89eb60 changed files: \n packages/app/src/referrals/referrals/DetailsDrawer.js"
No matter what I push to the master branch, it appears to always try to build packages/app
because it thinks I changed DetailsDrawer.js
. I was hoping that a fresh github oauth app and running drone-tree-config locally would produce a different result, but it did not.
Could there be a git cache somewhere?
from drone-tree-config.
Sorry for the long delay. I was out of office last week.
Is the default branch configured in drone the master branch?
from drone-tree-config.
No worries @foosinn. I appreciate your help. I have two pipelines in the file. The first one works fine and is triggered on the develop
branch. The second pipeline is triggered on the master
branch
Here is my .drone.yml
---
kind: pipeline
name: manage [staging]
steps:
- name: restore npm cache
image: drillster/drone-volume-cache
volumes:
- name: cache
path: /staging-manage
settings:
restore: true
mount:
- ./packages/manage/node_modules
- name: test & build
image: node
environment:
GENERATE_SOURCEMAP: true
REACT_APP_API_ENDPOINT:
from_secret: staging_main_api_url
commands:
- cd packages/manage
- yarn install
- yarn test
- yarn build
- name: sync
image: mesosphere/aws-cli
environment:
AWS_ACCESS_KEY_ID:
from_secret: staging_aws_access_key_id
AWS_SECRET_ACCESS_KEY:
from_secret: staging_aws_secret_access_key
S3_BUCKET:
from_secret: staging_manage_bucket_name
DISTRIBUTION_ID:
from_secret: staging_manage_cloudfront_distribution_id
commands:
- aws s3 sync packages/manage/build s3://$S3_BUCKET --cache-control "max-age=14400,public"
- aws s3 cp s3://$S3_BUCKET/service-worker.js s3://$S3_BUCKET/service-worker.js --metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type application/javascript
- aws s3 cp s3://$S3_BUCKET/index.html s3://$S3_BUCKET/index.html --metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type text/html
- aws cloudfront create-invalidation --distribution-id $${DISTRIBUTION_ID} --paths '/*'
- name: rebuild npm cache
image: drillster/drone-volume-cache
volumes:
- name: cache
path: /staging-manage
settings:
rebuild: true
mount:
- ./packages/manage/node_modules
- name: slack
image: plugins/slack
settings:
webhook:
from_secret: slack_webhook
channel: status
template: >
{{#success build.status}}
*success* <{{build.link}}|manage ({{build.branch}})> by {{build.author}}
{{else}}
*failure* <{{build.link}}|manage ({{build.branch}})> by {{build.author}}
{{/success}}
when:
status: [success, failure]
volumes:
- name: cache
host:
path: /mnt/efs/drone/cache
trigger:
branch:
- develop
---
kind: pipeline
name: manage [production]
steps:
- name: restore npm cache
image: drillster/drone-volume-cache
volumes:
- name: cache
path: /production-manage
settings:
restore: true
mount:
- ./packages/manage/node_modules
- name: test & build
image: node
environment:
GENERATE_SOURCEMAP: true
REACT_APP_API_ENDPOINT:
from_secret: production_main_api_url
commands:
- cd packages/manage
- yarn install
- yarn test
- yarn build
- name: sync
image: mesosphere/aws-cli
environment:
AWS_ACCESS_KEY_ID:
from_secret: production_aws_access_key_id
AWS_SECRET_ACCESS_KEY:
from_secret: production_aws_secret_access_key
S3_BUCKET:
from_secret: production_manage_bucket_name
DISTRIBUTION_ID:
from_secret: production_manage_cloudfront_distribution_id
commands:
- aws s3 sync packages/manage/build s3://$S3_BUCKET --cache-control "max-age=14400,public"
- aws s3 cp s3://$S3_BUCKET/service-worker.js s3://$S3_BUCKET/service-worker.js --metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type application/javascript
- aws s3 cp s3://$S3_BUCKET/index.html s3://$S3_BUCKET/index.html --metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type text/html
- aws cloudfront create-invalidation --distribution-id $${DISTRIBUTION_ID} --paths '/*'
- name: rebuild npm cache
image: drillster/drone-volume-cache
volumes:
- name: cache
path: /production-manage
settings:
rebuild: true
mount:
- ./packages/manage/node_modules
- name: slack
image: plugins/slack
settings:
webhook:
from_secret: slack_webhook
channel: status
template: >
{{#success build.status}}
*success* <{{build.link}}|manage ({{build.branch}})> by {{build.author}}
{{else}}
*failure* <{{build.link}}|manage ({{build.branch}})> by {{build.author}}
{{/success}}
when:
status: [success, failure]
volumes:
- name: cache
host:
path: /mnt/efs/drone/cache
trigger:
branch:
- master
from drone-tree-config.
Hey, can you please validate with the latest release? (v0.3.6)
from drone-tree-config.
Hi @foosinn, I just tried with v0.3.6. Same error. It recognized the commit I pushed, but started processing an old commit in a different directory. I wish I knew go better.
from drone-tree-config.
@foosinn, I believe I found the issue. My repos are setup so that develop
is the main branch and automatically deploys to staging. The master
branch is the branch that will automatically deploy to production.
Because my repo's default branch is set to develop
, this line will always set before to develop
when commits are made to the master branch.
from drone-tree-config.
Can you verify using v0.4.1?
from drone-tree-config.
Related Issues (20)
- Failed SCM connections should be handled properly HOT 4
- Auth server for BitBucket client is not specified HOT 6
- Gitlab support? HOT 4
- Add support for root folder files changing - trigger multiple pipelines HOT 2
- Git tags / Release support HOT 3
- How to use it on k8s HOT 2
- The plugin omit "..." in commands in steps HOT 2
- Documentation: Timeouts of consideration HOT 1
- Drone rebuilds everything every time HOT 7
- Rate limit hit HOT 1
- did not find a .drone.yml HOT 4
- Docker images for ARM
- bitbucket cloud authorization error
- BitBucker Server(previously known as Stash) support?
- Add GitLab self-hosted support? HOT 1
- Bitbucket integration error "unable to fetch diff"
- Wait the end of all pipelines? HOT 7
- Gitea support? HOT 7
- Multiple commits HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from drone-tree-config.