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

Fixing default for destinationNamespace in tag step #87

Merged
merged 1 commit into from
Oct 13, 2016

Conversation

jupierce
Copy link
Contributor

Found issue in public version of plugin where tagger will default to the jenkins/OpenShift namespace if destinationNamespace is not supplied. This should fix it.

ptal @gabemontero @bparees

@jupierce
Copy link
Contributor Author

Replaced whitespace with spaces, so advising PR review with w=1:
https://github.com/openshift/jenkins-plugin/pull/87/files?w=1

}

default String getDestinationNamespace(Map<String, String> overrides) {
return getOverride(getDestinationNamespace(), overrides);
Copy link
Contributor

Choose a reason for hiding this comment

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

doesn't the doc say this falls back to the source namespace if it's empty?

Copy link
Contributor

Choose a reason for hiding this comment

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

correct .... per the discussion @jupierce and I had on IRC, this needs to be

  1. call getOverride(getDestin....), if non-empty return
  2. return getNamespace(overrides)
    getNamespace(overrides) should handle the fetching from NAMESPACE_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.

}

default String getDestinationNamespace(Map<String, String> overrides) {
return getOverride(getDestinationNamespace(), overrides);
Copy link
Contributor

Choose a reason for hiding this comment

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

correct .... per the discussion @jupierce and I had on IRC, this needs to be

  1. call getOverride(getDestin....), if non-empty return
  2. return getNamespace(overrides)
    getNamespace(overrides) should handle the fetching from NAMESPACE_ENV_VAR

default String getSrcTag(Map<String, String> overrides) {
String val = getOverride(getSrcTag(), overrides);
// If there is no source namespace, default to jenkins namespace
if (val.length() == 0 && overrides != null && overrides.containsKey(NAMESPACE_ENV_VAR)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this was meant for getDestinationNamespace .... that tag should not be derived from the namespace env var ... that said, we can just leverage getNamespace there

@bparees
Copy link
Contributor

bparees commented Oct 13, 2016

also, in the future let's do large reformatting changes as their own commit. this is going to be tough to look back at and understand the diff.

@gabemontero
Copy link
Contributor

On Wednesday, October 12, 2016, Ben Parees notifications@github.com wrote:

also, in the future let's do large reformatting changes as their own
commit. this is going to be tough to look back at and understand the diff.

My intention had be to convert all the files to space only once this sprint
was done and the amount of changes settled down.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#87 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADbadMS5imRNVNTmx7Y72pUdr4zoYUqIks5qzXWsgaJpZM4KVPMI
.

@jupierce
Copy link
Contributor Author

I think the confusion arises from where the defaulting logic taking place at https://github.com/openshift/jenkins-plugin/blob/master/src/main/java/com/openshift/jenkins/plugins/pipeline/model/IOpenShiftImageTagger.java#L131

The current PR does the following:
Source namespace order of precedence:

  1. The overridden value for the sourceNamespace field
  2. The value of the sourceNamespace field
  3. The namespace hosting Jenkins

Destination namespace precedence:

  1. The override value for the destinationNamespace field
  2. The destinationNamespace field
    3 The source namespace

@gabemontero
Copy link
Contributor

@jupierce and I looked over this at my cube. He's removing the change he made to getSrcTag, and moving defaulting logic in the coreLogic method to getDestinationNamespace.

@jupierce
Copy link
Contributor Author

Removed erroneous defaulting logic from getSrcTag. Moved actual defaulting logic from coreLogic to getDestinationNamespace for clarity.

@gabemontero
Copy link
Contributor

IGTM ... will hit the button after the test job completes successfully

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

Successfully merging this pull request may close these issues.

3 participants