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

graph-builder/plugins/github scraper: add token authorization handling #233

Conversation

steveej
Copy link
Contributor

@steveej steveej commented Feb 27, 2020

This implements reading a token from a file and setting the authorization header on the request towards the GitHub API.

It also adjusts the deployment template.

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 27, 2020
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 27, 2020
@steveej
Copy link
Contributor Author

steveej commented Feb 27, 2020

e2e flake: level=fatal msg="failed to fetch Cluster: failed to generate asset "Cluster": failed to create cluster: failed to apply using Terraform"

/retest

@steveej
Copy link
Contributor Author

steveej commented Feb 27, 2020

more flakes: level=error msg="Error: Error waiting for AMI (ami-0b526b366cf36f573) to be ready: timeout while waiting for state to become 'available' (last state: 'pending', timeout: 40m0s)"

/retest

@steveej steveej force-pushed the pr/plugin-gh-scraper-tokenauth branch from 2534549 to 3113fb0 Compare February 27, 2020 21:08
vrutkovs added a commit to vrutkovs/release that referenced this pull request Mar 2, 2020
@@ -174,7 +176,7 @@ objects:
volumes:
- name: secrets
secret:
secretName: cincinnati-registry-credentials
secretName: cincinnati-credentials
Copy link
Member

Choose a reason for hiding this comment

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

hack/e2e.sh is still using cincinnati-registry-credentials.

I think this needs two template options:

  • CREDENTIALS_SECRET_NAME (set by default to stage github token secret)
  • CINCINNATI_GITHUB_SCRAPER_OAUTH_TOKEN_PATH (set to github token path by default)

and have hack/e2e.sh adjusted to create a dummy secret and pass -p CINCINNATI_GITHUB_SCRAPER_OAUTH_TOKEN_PATH="" in oc new-app.

This way we can have:

  • CREDENTIALS_SECRET_NAME in PR e2e set to docker credentials and CINCINNATI_GITHUB_SCRAPER_OAUTH_TOKEN_PATH set to none. e2e test for PRs won't use github token for authentication
  • stage / prod deploy would mount the secret and use token-based authentication

This is similar to RUST_BACKTRACE env var

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since CINCINNATI_GITHUB_SCRAPER_OAUTH_TOKEN_PATH="" will lead to the error, I tried to find a way to leave this variable unset in the e2e environment. Please see the latest commit and let me know if it's a viable approach or not.

Copy link
Member

Choose a reason for hiding this comment

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

That would work, but wouldn't template look cleaner if Cincinnati support empty path in CINCINNATI_GITHUB_SCRAPER_OAUTH_TOKEN_PATH?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In my mind that's a workaround and I would prefer to indicate the absence of the secret by the absence of the environment variable, instead of special casing the "" value.

If you feel strongly against this exercise I can be convinced otherwise.

@steveej steveej force-pushed the pr/plugin-gh-scraper-tokenauth branch 2 times, most recently from dbad675 to 32c5ab5 Compare March 2, 2020 19:09
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 6, 2020
@steveej steveej force-pushed the pr/plugin-gh-scraper-tokenauth branch from 32c5ab5 to c4f443d Compare March 9, 2020 14:31
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 9, 2020
@steveej
Copy link
Contributor Author

steveej commented Mar 9, 2020

/retest

@steveej steveej force-pushed the pr/plugin-gh-scraper-tokenauth branch 5 times, most recently from 30fe23d to 109c3b3 Compare March 10, 2020 09:35
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: LalatenduMohanty, steveeJ

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [LalatenduMohanty,steveeJ]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@vrutkovs
Copy link
Member

/hold cancel

LGTM

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 11, 2020
@openshift-merge-robot openshift-merge-robot merged commit f234448 into openshift:master Mar 11, 2020
@steveej steveej deleted the pr/plugin-gh-scraper-tokenauth branch March 11, 2020 13:44
wking added a commit to wking/cincinnati that referenced this pull request Nov 5, 2020
In preparation for consuming the 'version' file that graph-data grew
in [1].  This gets us the first main-line commit to include the
'version' file:

  cincinnati-graph-data$ git --no-pager show --date=short --format='%ad %h %s' d980578d2e b87e7c2782
  2020-03-18 d980578 Merge pull request openshift#125 from marun/unique-service-ca-serial

  2020-05-11 b87e7c2 Merge pull request openshift#233 from wking/version-file

[1]: openshift/cincinnati-graph-data#233
wking added a commit to wking/cincinnati that referenced this pull request Nov 5, 2020
Consuming the 'version' file that graph-data grew in [1], so the logs
will contain more useful error messages when the plugin is fed an
incompatible schema version.

Bumping the graph-data commit used for CI moves us to the first
main-line commit to include the 'version' file:

  cincinnati-graph-data$ git --no-pager show --date=short --format='%ad %h %s' d980578d2e b87e7c2782
  2020-03-18 d980578 Merge pull request openshift#125 from marun/unique-service-ca-serial

  2020-05-11 b87e7c2 Merge pull request openshift#233 from wking/version-file

[1]: openshift/cincinnati-graph-data#233
LalatenduMohanty pushed a commit to LalatenduMohanty/cincinnati that referenced this pull request Jan 20, 2021
In preparation for consuming the 'version' file that graph-data grew
in [1].  This gets us the first main-line commit to include the
'version' file:

  cincinnati-graph-data$ git --no-pager show --date=short --format='%ad %h %s' d980578d2e b87e7c2782
  2020-03-18 d980578 Merge pull request openshift#125 from marun/unique-service-ca-serial

  2020-05-11 b87e7c2 Merge pull request openshift#233 from wking/version-file

[1]: openshift/cincinnati-graph-data#233
LalatenduMohanty pushed a commit to LalatenduMohanty/cincinnati that referenced this pull request Jan 20, 2021
Consuming the 'version' file that graph-data grew in [1], so the logs
will contain more useful error messages when the plugin is fed an
incompatible schema version.

Bumping the graph-data commit used for CI moves us to the first
main-line commit to include the 'version' file:

  cincinnati-graph-data$ git --no-pager show --date=short --format='%ad %h %s' d980578d2e b87e7c2782
  2020-03-18 d980578 Merge pull request openshift#125 from marun/unique-service-ca-serial

  2020-05-11 b87e7c2 Merge pull request openshift#233 from wking/version-file

[1]: openshift/cincinnati-graph-data#233
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/cincinnati that referenced this pull request Mar 19, 2021
In preparation for consuming the 'version' file that graph-data grew
in [1].  This gets us the first main-line commit to include the
'version' file:

  cincinnati-graph-data$ git --no-pager show --date=short --format='%ad %h %s' d980578d2e b87e7c2782
  2020-03-18 d980578 Merge pull request openshift#125 from marun/unique-service-ca-serial

  2020-05-11 b87e7c2 Merge pull request openshift#233 from wking/version-file

[1]: openshift/cincinnati-graph-data#233
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/cincinnati that referenced this pull request Mar 19, 2021
Consuming the 'version' file that graph-data grew in [1], so the logs
will contain more useful error messages when the plugin is fed an
incompatible schema version.

Bumping the graph-data commit used for CI moves us to the first
main-line commit to include the 'version' file:

  cincinnati-graph-data$ git --no-pager show --date=short --format='%ad %h %s' d980578d2e b87e7c2782
  2020-03-18 d980578 Merge pull request openshift#125 from marun/unique-service-ca-serial

  2020-05-11 b87e7c2 Merge pull request openshift#233 from wking/version-file

[1]: openshift/cincinnati-graph-data#233
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants