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

Old, modified way of deploying repository #205

Closed
wants to merge 16 commits into from
Closed

Conversation

rzadp
Copy link
Contributor

@rzadp rzadp commented Sep 11, 2019

@@ -3,6 +3,9 @@
hosts: all
become: true
tasks:
- import_role:
name: ../../../deployment/roles/common
tasks_from: dependencies
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to add dependencies in this test scenario because otherwise there is no git installed on host machine

tar zxfv monorepo.tar.gz && rm monorepo.tar.gz
mkdir -p contracts && tar zxfv contracts.tar.gz -C ./contracts && rm contracts.tar.gz
# If this is a forked PR, the branch needs to be fetched in a special way
[ ! "CIRCLE_PR_NUMBER" = "" ] && git fetch --force origin -- "{{ bridge_repo_branch }}/head:remotes/origin/{{ bridge_repo_branch }}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

CIRCLE_PR_NUMBER is only available on forked PR. So if it is available, we fetch the forked branch in a special way.

@rzadp rzadp changed the title [WIP] Forked PR Old, modified way of deploying repository Sep 13, 2019
@rzadp rzadp marked this pull request as ready for review September 13, 2019 15:02
@@ -2,8 +2,10 @@
cd $(dirname $0)
set -e # exit when any command fails

CODEBASE_BRANCH=${CIRCLE_BRANCH-$(git symbolic-ref --short HEAD)}
Copy link
Collaborator

Choose a reason for hiding this comment

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

will it still be possible to run e2e deployment tests locally?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question.

  • In a normal repository - yes
  • In a forked repository - I will work on it now and make sure that it is possible

tar zxfv monorepo.tar.gz && rm monorepo.tar.gz
mkdir -p contracts && tar zxfv contracts.tar.gz -C ./contracts && rm contracts.tar.gz
# If this is a forked PR, the branch needs to be fetched in a special way
[ ! "CIRCLE_PR_NUMBER" = "" ] && git fetch --force origin -- "{{ bridge_repo_branch }}/head:remotes/origin/{{ bridge_repo_branch }}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

does it make sense to limit the number of downloaded artifacts by --depth parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. Done in a4caf18

@rzadp rzadp closed this Sep 16, 2019
@rzadp rzadp deleted the forked-pr branch September 16, 2019 11:37
@rzadp rzadp restored the forked-pr branch September 16, 2019 11:37
@rzadp rzadp reopened this Sep 16, 2019
@rzadp
Copy link
Contributor Author

rzadp commented Sep 16, 2019

@akolotov I have trouble making it work on forked PRs. Turns out, the tests were passing before for the wrong reason. I found that I had two branches named the same way on both forked and original repository, and it was actually checking out the wrong one!

My current opinion is that approach to git clone is arguably more complex than the approach we have currently with tar archives.

When running deployment-e2e tests, and also when manually testing deployment on DigitalOcean/AWS, the approach to git clone needs to take into account 4 cases:

  1. Locally on original repository
    • The local branch needs to be pushed to remote (in order to be git cloned later)
    • Need to make sure that in fact given branch is checked out and tested, and not the default master
  2. CI testing PR from original repository
    • Need to make sure that in fact given branch is checked out and tested
  3. Locally on forked repository
    • The local branch needs to be pushed to remote
    • Need to make sure that in fact given branch is checked out and tested
    • Need to make sure that in fact the forked repository is tested, and not the default poanetwork/tokenbridge
  4. CI testing PR from forked repository
    • Need to make sure that in fact given branch from forked repository is checked out and tested
    • This branch must be fetched and checked-out in a special way

If something gets wrong, it is easy to overlook, because the codebase from original repository's master has high chance to just work. Just like I overlooked it with two branches.

I think that our current approach is better and simpler. The tasks to tar/untar are complex, but the principles are simple:

  1. Locally, the code you see is deployed / tested. No matter if you have original repository, forked repository, or if you downloaded repository .zip
  2. When testing original/forked PR, CI checks out proper code. This code gets tested.

In conclusion, I argue that it would be better to leave our current approach with copying repository as it is.
@akolotov What do you think?

@akolotov
Copy link
Collaborator

akolotov commented Sep 17, 2019

I think that our current approach is better and simpler. The tasks to tar/untar are complex, but the principles are simple:

  1. Locally, the code you see is deployed / tested. No matter if you have original repository, forked repository, or if you downloaded repository .zip
  2. When testing original/forked PR, CI checks out proper code. This code gets tested.

In conclusion, I argue that it would be better to leave our current approach with copying repository as it is.
@akolotov What do you think?

Thanks @rzadp for detailed explanation. Please add this comment to the issue #200.

@akolotov
Copy link
Collaborator

If nothing is going to be changed as part of this PR, please close it.

@rzadp rzadp closed this Sep 17, 2019
@rzadp rzadp deleted the forked-pr branch September 20, 2020 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

remove dependency on rsync Investigate repository deployment method
2 participants