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

fix(concourse): support old and new concourse auth #762

Merged
merged 3 commits into from
Jun 30, 2020
Merged

fix(concourse): support old and new concourse auth #762

merged 3 commits into from
Jun 30, 2020

Conversation

jaredstehler
Copy link
Contributor

Fixes concourse authentication for clusters >= v6.1.0 by detecting version and providing different implementation accordingly.

Addresses issue: spinnaker/spinnaker#5797

Fixes concourse authentication for clusters >= v6.1.0 by detecting version and providing different implementation accordingly.

Addresses issue: spinnaker/spinnaker#5797
Sending basic auth header to /info endpoint causes 401

Addresses issue: spinnaker/spinnaker#5797
@gal-yardeni gal-yardeni requested a review from jervi June 16, 2020 23:12
tokenExpiration = token.getExpiry();
return token;
}

public Response userInfo() {
return skyServiceV1 != null ? skyServiceV1.userInfo() : skyServiceV2.userInfo();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels a bit dirty to me. I'd consider creating a new SkyService interface that both V1 and V2 extends from, given that they both just contains the userInfo() method signature. Then you can have just a single skyService field, and not care about the implementation and possible null-values here.
And then do exactly the same with TokenService.

Copy link
Contributor

Choose a reason for hiding this comment

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

Example:

public interface SkyServiceV2 extends SkyService {
  @GET("/api/v1/user")
  @Override
  Response userInfo();
}

Copy link
Contributor Author

@jaredstehler jaredstehler Jun 17, 2020

Choose a reason for hiding this comment

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

fully agree! unfortunately, the library in use here, retrofit, doesn't allow extending interfaces :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see square/retrofit#504 (appears this may have been fixed in a recent version; the one in use here is quite old)

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I wasn't aware... Yuck. 😛
Maybe put a little comment in the code with that explanation?

Copy link
Contributor

@jervi jervi left a comment

Choose a reason for hiding this comment

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

Thanks a lot! I think this is great 👍
I've suggested a couple of changes related to generalization of SkyService and TokenService to get rid of nullable fields in the ConcourseClient class, but apart from that, this looks good to me.

@robzienert robzienert added the ready to merge Approved and ready for merge label Jun 29, 2020
@mergify mergify bot added the auto merged label Jun 29, 2020
@mergify mergify bot merged commit 97e62db into spinnaker:master Jun 30, 2020
@donnyyung
Copy link
Contributor

Would it be possible for us to cherry-pick this commit into 1.21 and 1.20 as well?

@jaredstehler
Copy link
Contributor Author

@Mergifyio backport release-1.20.x

@mergify
Copy link
Contributor

mergify bot commented Jul 1, 2020

@jaredstehler is not allowed to run commands

@PFacheris
Copy link

Noticed the above backport attempt failed and would also like to see this backported.

@robzienert + @jervi are you the appropriate people to ping for that?

@kevinawoo
Copy link
Member

FYI, we have a new backport policy that only accepts regressions. There isn't a regression that the community introduced, but an external service changed.

Since we don't have any control of external services and we're supporting 3 minor versions, if concourse decided to change their auth and it broke a prior version, then Spinnaker as a service does have a regression and we'll need to backport the fix for it.

@Mergifyio backport release-1.20.x release-1.21.x

@kevinawoo
Copy link
Member

kevinawoo commented Jul 21, 2020

@Mergifyio backport release-1.20.x

mergifyio seems to not be working, so we made #824

@kevinawoo
Copy link
Member

kevinawoo commented Jul 21, 2020

@Mergifyio backport release-1.21.x

mergifyio doesn't work for some reason, so we just made #823

dogonthehorizon pushed a commit to armory-io/igor that referenced this pull request Jul 21, 2020
* fix(concourse): support old and new concourse auth

Fixes concourse authentication for clusters >= v6.1.0 by detecting version and providing different implementation accordingly.

Addresses issue: spinnaker/spinnaker#5797

* fix(concourse): support old and new concourse auth

Sending basic auth header to /info endpoint causes 401

Addresses issue: spinnaker/spinnaker#5797

Co-authored-by: Jared Stehler <jared.stehler@edgenuity.com>
dogonthehorizon pushed a commit to armory-io/igor that referenced this pull request Jul 21, 2020
* fix(concourse): support old and new concourse auth

Fixes concourse authentication for clusters >= v6.1.0 by detecting version and providing different implementation accordingly.

Addresses issue: spinnaker/spinnaker#5797

* fix(concourse): support old and new concourse auth

Sending basic auth header to /info endpoint causes 401

Addresses issue: spinnaker/spinnaker#5797

Co-authored-by: Jared Stehler <jared.stehler@edgenuity.com>
mergify bot pushed a commit that referenced this pull request Jul 22, 2020
* fix(concourse): support old and new concourse auth

Fixes concourse authentication for clusters >= v6.1.0 by detecting version and providing different implementation accordingly.

Addresses issue: spinnaker/spinnaker#5797

* fix(concourse): support old and new concourse auth

Sending basic auth header to /info endpoint causes 401

Addresses issue: spinnaker/spinnaker#5797

Co-authored-by: Jared Stehler <jared.stehler@edgenuity.com>

Co-authored-by: Jared Stehler <jared.stehler@gmail.com>
Co-authored-by: Jared Stehler <jared.stehler@edgenuity.com>
mergify bot pushed a commit that referenced this pull request Jul 22, 2020
* fix(concourse): support old and new concourse auth

Fixes concourse authentication for clusters >= v6.1.0 by detecting version and providing different implementation accordingly.

Addresses issue: spinnaker/spinnaker#5797

* fix(concourse): support old and new concourse auth

Sending basic auth header to /info endpoint causes 401

Addresses issue: spinnaker/spinnaker#5797

Co-authored-by: Jared Stehler <jared.stehler@edgenuity.com>

Co-authored-by: Jared Stehler <jared.stehler@gmail.com>
Co-authored-by: Jared Stehler <jared.stehler@edgenuity.com>
@mergify
Copy link
Contributor

mergify bot commented Jul 22, 2020

Command backport release-1.20.x release-1.21.x: failure

No backport have been created

  • Backport to branch release-1.20.x failed

Cherry-pick of 97e62db has failed:

On branch mergify/bp/release-1.20.x/pr-762
Your branch is up to date with 'origin/release-1.20.x'.

You are currently cherry-picking commit 97e62db2.
  (all conflicts fixed: run "git cherry-pick --continue")
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

nothing to commit, working tree clean
  • Backport to branch release-1.21.x failed

Cherry-pick of 97e62db has failed:

On branch mergify/bp/release-1.21.x/pr-762
Your branch is up to date with 'origin/release-1.21.x'.

You are currently cherry-picking commit 97e62db2.
  (all conflicts fixed: run "git cherry-pick --continue")
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

nothing to commit, working tree clean

@mergify
Copy link
Contributor

mergify bot commented Jul 22, 2020

Command backport release-1.20.x: failure

No backport have been created

  • Backport to branch release-1.20.x failed

Cherry-pick of 97e62db has failed:

On branch mergify/bp/release-1.20.x/pr-762
Your branch is up to date with 'origin/release-1.20.x'.

You are currently cherry-picking commit 97e62db2.
  (all conflicts fixed: run "git cherry-pick --continue")
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

nothing to commit, working tree clean

@mergify
Copy link
Contributor

mergify bot commented Jul 22, 2020

Command backport release-1.21.x: failure

No backport have been created

  • Backport to branch release-1.21.x failed

Cherry-pick of 97e62db has failed:

On branch mergify/bp/release-1.21.x/pr-762
Your branch is up to date with 'origin/release-1.21.x'.

You are currently cherry-picking commit 97e62db2.
  (all conflicts fixed: run "git cherry-pick --continue")
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

nothing to commit, working tree clean

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants