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

Show environment variables coming from the builder image in the Environment tab #889

Merged
merged 1 commit into from
Nov 21, 2016

Conversation

jwforres
Copy link
Member

@jwforres jwforres commented Nov 17, 2016

@jwforres
Copy link
Member Author

bc-img-env-collapsed
bc-img-env-expanded

@jwforres
Copy link
Member Author

Implemented for BCs but it is only supported for ImageStreamTag or ImageStreamImage. I hesitate to support this for DockerImage because it is going to put extra load onto the image import API. I didn't do this for individual builds for the same reason because they have already resolved to a particular DockerImage reference.

@bparees @spadgett PTAL

@bparees
Copy link
Contributor

bparees commented Nov 17, 2016

pretty.

@jwforres
Copy link
Member Author

We could do the same thing for DCs that have an ICT

if (_.includes(["ImageStreamTag", "ImageStreamImage"], buildFrom.kind)) {
lastLoadedBuildFromImageKey = buildFromImageKey;
DataService.get(APIService.kindToResource(buildFrom.kind), buildFrom.name, {namespace: buildFrom.namespace || $scope.projectName}).then(function(imageStreamImage){
$scope.BCEnvVarsFromImage = _.map(_.get(imageStreamImage, 'image.dockerImageMetadata.Config.Env'),
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Nevermind, that's looking for a specific key. We might generalize it though or add another filter

@@ -365,6 +365,21 @@
<uib-tab heading="Environment" active="selectedTab.environment" ng-if="buildConfig && !(buildConfig | isJenkinsPipelineStrategy)">
<uib-tab-heading>Environment</uib-tab-heading>
<h3>Environment Variables</h3>
<div style="margin-top: -5px;" ng-if="BCEnvVarsFromImage.length">
The builder image has additional environment variables defined. Variables defined below will overwrite any from the image with the same name.
<a href="" ng-click="expand.imageEnv = true" ng-if="!expand.imageEnv">View image environment variables</a>
Copy link
Member

Choose a reason for hiding this comment

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

"Show image environment variables"? To be consistent with other show/hide links

@@ -365,6 +365,21 @@
<uib-tab heading="Environment" active="selectedTab.environment" ng-if="buildConfig && !(buildConfig | isJenkinsPipelineStrategy)">
<uib-tab-heading>Environment</uib-tab-heading>
<h3>Environment Variables</h3>
<div style="margin-top: -5px;" ng-if="BCEnvVarsFromImage.length">
Copy link
Member

Choose a reason for hiding this comment

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

class="mar-top-sm"?

Copy link
Member Author

Choose a reason for hiding this comment

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

its negative margin, i dont think we have a class for applying negative margin?

Copy link
Member

Choose a reason for hiding this comment

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

You're right

@spadgett
Copy link
Member

We could do the same thing for DCs that have an ICT

I think we have the image stream image already to fill in the pod template details.

@jwforres jwforres changed the title [WIP] Show environment variables coming from the builder image in the Environment tab Show environment variables coming from the builder image in the Environment tab Nov 18, 2016
@jwforres
Copy link
Member Author

@spadgett as discussed this will just cover the BC env vars, will work on another PR for DCs

var pair = entry.split('=');
return {
name: _.head(pair),
value:_.last(pair)
Copy link
Member

Choose a reason for hiding this comment

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

Not a new problem, but this won't correctly handle env var values with a =. Maybe

var index = entry.indexOf('=');
return {
  name: entry.substring(0, index),
  value: entry.substring(index + 1)
};

@jwforres
Copy link
Member Author

Yes we have an open / bug issue for that. I can look at fixing as part of
this

On Nov 18, 2016 1:54 PM, "Sam Padgett" [email protected] wrote:

@spadgett commented on this pull request.

In app/scripts/services/images.js
#889 (review)
:

@@ -213,10 +213,23 @@ angular.module("openshiftConsole")
return resources;
};

  • var getEnvironment = function(imageStreamImage) {
  •  return _.map(_.get(imageStreamImage, 'image.dockerImageMetadata.Config.Env'),
    
  •          function(entry) {
    
  •            var pair = entry.split('=');
    
  •            return {
    
  •              name: _.head(pair),
    
  •              value:_.last(pair)
    

Not a new problem, but this won't correctly handle env var values with a =.
Maybe

var index = entry.indexOf('=');return {
name: entry.substring(0, index),
value: entry.substring(index + 1)
};


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#889 (review),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABZk7dShY_zT4qez7Ql5uEcLLUVYK-S1ks5q_fRNgaJpZM4K1zXQ
.

@spadgett spadgett self-assigned this Nov 21, 2016
@jwforres
Copy link
Member Author

@spadgett updated to handle env var values with =

@spadgett
Copy link
Member

[merge]

@openshift-bot
Copy link

Evaluated for origin web console merge up to 24e766a

@openshift-bot
Copy link

[Test]ing while waiting on the merge queue

@openshift-bot
Copy link

Evaluated for origin web console test up to 24e766a

@openshift-bot
Copy link

Origin Web Console Test Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin_web_console/737/) (Base Commit: 9686826)

@openshift-bot
Copy link

openshift-bot commented Nov 21, 2016

Origin Web Console Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin_web_console/740/) (Base Commit: 07653ad)

@openshift-bot openshift-bot merged commit 00e62d0 into openshift:master Nov 21, 2016
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.

4 participants