gocd-contrib / gomatic

A Python API for configuring GoCD
https://pypi.python.org/pypi/gomatic
MIT License
142 stars 60 forks source link

[Gomatic 0.6.8] Make gomatic agnostic of cd.go.authentication.passwordfile plugin #63

Closed mansab closed 4 years ago

mansab commented 4 years ago

Summary With this PR we are extending Gomatic support till GOCD version 19.6.0 along with improvements on how Gomatic authenticates with GOCD.

Problem statement Use 'cd.go.authorization.github' plugin so that basic authentication can be disabled completely on the GOCD server. This enhances security and removes the management overhead of password file-based authentication.

Issues identified When we installed the Github authentication plugin on GOCD 19.6.0, we found that gomatic 0.6.7 still lacks the support for access token-based authentication to GOCD API.

Solution Hence, we enhanced the 'HostRestClient' class to entertain token-based authentication via 'Authentication: Bearer' header in GOCD API calls.

Since we wanted to add support till the latest version of GOCD available, i.e., 19.6.0, it required us to add support for an updated attribute called 'artifactOrigin' (earlier called as 'origin') for 'FetchArtifactTask' class. We have also updated the test for that.

We also updated the 'config_url' URL as per the GOCD API documentation, as the old 'config_url' did not seem to entertain API calls with header-based authentication.

Comments We have not added any new tests for HostRestClient class but all existing unit and integration tests PASS and the supported GOCD versions have been updated in the README.

Authors Varun Saraogi Mansab Uppal

ghost commented 4 years ago

CLA assistant check
All committers have signed the CLA.