Skip to content
This repository was archived by the owner on Nov 28, 2022. It is now read-only.

feat: POST /templates/repos accepts Personal Access Tokens #2762

Conversation

rwalle61
Copy link
Contributor

Signed-off-by: Richard Waller [email protected]

What type of PR is this ?

  • Bug fix
  • Enhancement

What does this PR do ?

Extends POST /templates/repos to accept GitHub Personal Access Tokens when adding tetmplate repos

Which issue(s) does this PR fix ?

part of #2647

Does this PR require a documentation change ?

Included

Any special notes for your reviewer ?

@codecov
Copy link

codecov bot commented Apr 27, 2020

Codecov Report

Merging #2762 into master will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2762      +/-   ##
==========================================
+ Coverage   60.51%   60.56%   +0.05%     
==========================================
  Files         102      102              
  Lines       10337    10340       +3     
  Branches     1745     1747       +2     
==========================================
+ Hits         6255     6262       +7     
+ Misses       4082     4078       -4     
Impacted Files Coverage Δ
src/pfe/portal/modules/Templates.js 97.92% <100.00%> (+0.01%) ⬆️
src/pfe/portal/routes/projects/internal.route.js 54.68% <0.00%> (+6.25%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f646d95...69b0999. Read the comment docs.

Signed-off-by: Richard Waller <[email protected]>
Copy link
Contributor

@hhellyer hhellyer left a comment

Choose a reason for hiding this comment

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

LGTM - Might need additional check for valid combinations of credentials.

options.headers = {
Authorization: `token ${gitCredentials.personalAccessToken}`,
};
}
Copy link
Contributor

Choose a reason for hiding this comment

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

There should probably be an extra check to confirm the user hasn't either sent all 3 when they've sent a username and password and or sent an empty git credentials structure (or just one of username and password).

Copy link
Contributor

Choose a reason for hiding this comment

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

I just noticed the openapi.yml makes it hard to hit these from outside but I think we should probably still have the check as we also load repository configuration from our saved repository file when we start up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea the OpenAPI yaml should do that validation for calls from the outside.

I can add checks here too, but we don't yet support the case where the saved repository file tries to add secure templates to PFE. For example that file currently doesn't save credentials, so can't add secure templates to PFE.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added the checks in a further commit

Copy link
Contributor

@hhellyer hhellyer left a comment

Choose a reason for hiding this comment

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

LGTM - Thanks for adding the validation.

@hhellyer hhellyer merged commit 20f0454 into eclipse-archived:master Apr 30, 2020
@rwalle61 rwalle61 deleted the 2647.4-add-secure-template-repos-with-pat branch April 30, 2020 10:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants