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

remove the tmp secret data #11116

Merged

Conversation

guangxuli
Copy link
Contributor

No description provided.

@guangxuli
Copy link
Contributor Author

@csrwng ptal,thanks.

1 similar comment
@guangxuli
Copy link
Contributor Author

@csrwng ptal,thanks.

@@ -116,7 +116,7 @@ func (c *builderConfig) setupGitEnvironment() ([]string, error) {
if err != nil {
return nil, fmt.Errorf("cannot fix source secret permissions: %v", err)
}

defer os.RemoveAll(sourceSecretDir)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not the appropriate place to remove the source secret directory, since environment variables have been set that point to files in this directory so git clone can succeed. It would need to be removed after the source has been cloned.

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 3, 2016
@guangxuli guangxuli force-pushed the build_controller_jenkins_test branch 2 times, most recently from 060b137 to acd2eeb Compare October 3, 2016 16:47
@guangxuli
Copy link
Contributor Author

@csrwng thanks, I review the code again, yes, the place is not appropriate. it should be removed after the building over, I found we have to add a return value that need to remove, and I think we need remove this directory in contidion that the build is success. so when build fail, we can check the secret files that exist in temp directory. Is it reasonable?

@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 3, 2016
@guangxuli
Copy link
Contributor Author

@csrwng ptal,thanks.

return nil, fmt.Errorf("cannot fix source secret permissions: %v", err)
sourceSecretDir, errSecret = fixSecretPermissions(c.sourceSecretDir)
if errSecret != nil {
return sourceSecretDir, nil, fmt.Errorf("cannot fix source secret permissions: %v", errSecret)
Copy link
Contributor

Choose a reason for hiding this comment

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

If an error occurred you should delete the secret directory and then return the error. Otherwise, the secret directory will not get removed (the caller function simply returns the error -- line 151)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed

secretsEnv, overrideURL, err := scmAuths.Setup(sourceSecretDir)
if err != nil {
return nil, fmt.Errorf("cannot setup source secret: %v", err)
return sourceSecretDir, nil, fmt.Errorf("cannot setup source secret: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed

@guangxuli guangxuli force-pushed the build_controller_jenkins_test branch from acd2eeb to 7b361d3 Compare October 11, 2016 01:53
@guangxuli
Copy link
Contributor Author

@csrwng ptal,thanks.

@csrwng
Copy link
Contributor

csrwng commented Oct 11, 2016

@guangxuli I'm so sorry, I just realized that the last change I asked you to make is not the right thing to do. If there was an error setting up the secrets, we probably want the directory to remain so we can understand what happened. If you can revert that change, the PR looks good to me. Thank you for your patience.

@guangxuli
Copy link
Contributor Author

@csrwng okay, I will revert that. That's my care about before.:) thanks.

gofmt

reslove conflict

remove the temp secret when build succ

remove defer

remove secret directory if an error occurred

do not remove the secrets when error occurs
@guangxuli guangxuli force-pushed the build_controller_jenkins_test branch from 7b361d3 to 0fe00c9 Compare October 12, 2016 14:24
@guangxuli
Copy link
Contributor Author

@csrwng sorry to bother you again, I have revert the code, ptal, thanks.

@csrwng
Copy link
Contributor

csrwng commented Oct 12, 2016

LGTM
[test]

@guangxuli
Copy link
Contributor Author

@csrwng I check the error cause, the failure seems not relative to this PR.

@csrwng
Copy link
Contributor

csrwng commented Oct 14, 2016

#10263
[test]

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 0fe00c9

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/10052/) (Base Commit: dbdc2f8)

@csrwng
Copy link
Contributor

csrwng commented Oct 14, 2016

[merge]

@openshift-bot
Copy link
Contributor

openshift-bot commented Oct 14, 2016

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/10052/) (Image: devenv-rhel7_5179)

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 0fe00c9

@openshift-bot openshift-bot merged commit b056dd6 into openshift:master Oct 14, 2016
@guangxuli guangxuli deleted the build_controller_jenkins_test branch November 3, 2016 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants