Skip to content

Add a script to upload reports to GitHub #124

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

rhcu
Copy link
Collaborator

@rhcu rhcu commented Aug 3, 2018

Fixes #122
Need to add Taskcluster secrets and to clean up the code. WIll add this later.

@marco-c
Copy link
Collaborator

marco-c commented Aug 3, 2018

The Taskcluster secrets part should be in mozilla-releng/services, as we have code there to load the secrets.
The module here could have parameters git_user_name and git_password that we pass from the caller.

@rhcu rhcu changed the title WIP: Add a script to upload reports to GitHub Add a script to upload reports to GitHub Aug 3, 2018
subprocess.run(['git', 'clone', 'https://github.com/coverage-crawler-updater/coverage-crawler-reports'])
os.chdir('coverage-crawler-reports')

# Remove the content of repository except of README
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can remove the README too, the repository will only be accessed from https://rhcu.github.io/coverage-crawler-reports/, so the README is unneeded.

def upload_to_github(report_path, git_user_name, git_password):
# Clone the repository if doesn't exist
if not os.path.isdir('coverage-crawler-reports'):
subprocess.run(['git', 'clone', 'https://github.com/coverage-crawler-updater/coverage-crawler-reports'])
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can clone the rhcu repository directly.

@rhcu rhcu changed the title Add a script to upload reports to GitHub WIP: Add a script to upload reports to GitHub Aug 6, 2018
@rhcu
Copy link
Collaborator Author

rhcu commented Aug 7, 2018

https://rhcu.github.io/coverage-crawler-reports/ The index.html will look like this.

@rhcu rhcu changed the title WIP: Add a script to upload reports to GitHub Add a script to upload reports to GitHub Aug 7, 2018
@marco-c
Copy link
Collaborator

marco-c commented Aug 20, 2018

https://rhcu.github.io/coverage-crawler-reports/ The index.html will look like this.

Looks great!

shutil.rmtree(f)
elif f.startswith('.') is False:
os.remove(f)
subprocess.run(['git', 'pull', 'https://github.com/rhcu/coverage-crawler-reports', 'master'])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of cloning and pulling, we can do like we do here: https://github.com/mozilla/release-services/blob/master/src/shipit_code_coverage/shipit_code_coverage/github.py#L74 and just always overwrite the contents of the repository.

Copy link
Collaborator

Choose a reason for hiding this comment

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

So basically:

  1. create a coverage-crawler-reports directory;
  2. chdir to ^;
  3. run the crawler;
  4. create the index file;
  5. your current code from git init to the end.

You won't even need to move the reports this way, as they are created directly in the right directory.

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.

2 participants