Open ncbrown1 opened 7 years ago
You may want to add methods to the Git Strategy for accessing & updating the commit/build status for a given repository. You can add those to the files in this folder:
Commit Status API for GitHub: https://developer.github.com/v3/repos/statuses/
Build Status API for GitLab: https://docs.gitlab.com/ce/api/commits.html#post-the-build-status-to-a-commit
Operations needed given a Repo object:
Set Commit Status Get Commit Status
For example, to set the status in the rails console, we might type the following:
machine_octokit.set_commit_status('ucsb-cs-test-org-1/assignment-lab00', {
:state => :pending,
:target_url => 'https://localhost:8000/',
:description => 'Test'
})
status = machine_octokit.get_commit_status('ucsb-cs-test-org-1/assignment-lab00')
Note: the Octokit method you might need is this: https://octokit.github.io/octokit.rb/Octokit/Client/Statuses.html#create_status-instance_method
You probably want to add this method to the base class git_strategy.rb:
create_status(repo, sha, state)
You'll pass through an empty hash to the underlying octokit method documented o this page
http://octokit.github.io/octokit.rb/Octokit/Client/Statuses.html#create_status-instance_method
create_status(repo, sha, state, options = {})
For gitlab, we can just leave it alone for now, since we aren't using it yet. The "not implemented yet" error will get thrown and that's ok for now.
That method comes directly from
We also need a get_most_recent_status(repo, sha) which wraps the
(Array<Sawyer::Resource>) statuses(repo, sha, options = {})
method but only returns the most recent status.
In the assignments index page for instructors, we would like to be able to know the "build status" of each assignment. This allows instructors to know whether they have properly set up their assignment repos for auto-grading.
We would like to be able to see an icon to the right of each assignment list item in the index page of the assignments view:
https://github.com/project-anacapa/course-github-org-tool/blob/feature/assignment-view/app/views/assignments/_index_instructor.html.erb#L5
The icons for each status are as follows:
PENDING == yellow hourglass SUCCESS == green checkmark FAILURE == red X ERROR == red ?