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

[feat] Provision user and email credentials to gitconfig #708

Closed
wants to merge 7 commits into from

Conversation

JPinkney
Copy link
Contributor

@JPinkney JPinkney commented Dec 10, 2021

Signed-off-by: Josh Pinkney joshpinkney@gmail.com

What does this PR do?

This PR automatically provisions user and email credentials to the gitconfig whenever the label: controller.devfile.io/git-user-credential is true.

If you want to provision git credentials to your gitconfig you can use:

apiVersion: v1
kind: ConfigMap
metadata:
  name: sample-user-credentials
  namespace: devworkspace-controller
  labels:
    controller.devfile.io/git-user-credential: "true"
    controller.devfile.io/watch-configmap: "true"
data:
  name: sampleName
  email: sampleName@sampleName.com

What issues does this PR fix or reference?

#694

Is it tested? How?

Tested manually using the above configmap, but also added unit tests

PR Checklist

  • E2E tests pass (when PR is ready, comment /test v8-devworkspace-operator-e2e, v8-che-happy-path to trigger)
    • v8-devworkspace-operator-e2e: DevWorkspace e2e test
    • v8-che-happy-path: Happy path for verification integration with Che

Signed-off-by: Josh Pinkney <joshpinkney@gmail.com>
@openshift-ci
Copy link

openshift-ci bot commented Dec 10, 2021

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci
Copy link

openshift-ci bot commented Dec 10, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JPinkney

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:

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

@openshift-ci openshift-ci bot requested a review from amisevsk December 10, 2021 14:56
Signed-off-by: Josh Pinkney <joshpinkney@gmail.com>
Signed-off-by: Josh Pinkney <joshpinkney@gmail.com>
Signed-off-by: Josh Pinkney <joshpinkney@gmail.com>
@JPinkney JPinkney force-pushed the provision-user-and-email branch from 939da04 to 1644718 Compare December 13, 2021 14:47
Signed-off-by: Josh Pinkney <joshpinkney@gmail.com>
@JPinkney JPinkney marked this pull request as ready for review December 13, 2021 14:49
@JPinkney JPinkney changed the title Provision user and email credentials to gitconfig [feat] Provision user and email credentials to gitconfig Dec 13, 2021
Signed-off-by: Josh Pinkney <joshpinkney@gmail.com>
Signed-off-by: Josh Pinkney <joshpinkney@gmail.com>
@JPinkney
Copy link
Contributor Author

/test v8-devworkspace-operator-e2e

@l0rd
Copy link
Collaborator

l0rd commented Dec 13, 2021

This is good as first implementation. But rather than a specialized ConfigMap for git config username and email we may want to support a new annotation controller.devfile.io/sub-path for generic ConfigMaps labelled with controller.devfile.io/mount-to-devworkspace: "true".

That would allow to mount a complete gitconfig (not only user name and email) and to mount any file in an existing folder:. For example:

kind: ConfigMap
apiVersion: v1
metadata:
  name: git-config-cm
  annotations:
    controller.devfile.io/mount-path: /etc/gitconfig
    controller.devfile.io/sub-path: gitconfig
  labels:
    controller.devfile.io/mount-to-devworkspace: "true"
data:
  gitconfig: |
    [user]
      email = jojo@gmail.com
      name = Jojo
    [core]
      editor = vim
    [alias]
      ...

@amisevsk
Copy link
Collaborator

But rather than a specialized ConfigMap for git config username and email we may want to support a new annotation controller.devfile.io/sub-path for generic ConfigMaps labelled with controller.devfile.io/mount-to-devworkspace: "true".

I beat you to the punch by about an hour :D #710

@l0rd
Copy link
Collaborator

l0rd commented Dec 14, 2021

I beat you to the punch by about an hour :D #710

I saw that earlier today! I was probably still thinking at the right way to inject a gitconfig when you submitted that PR. And you addressed the problem in a simpler way too. That's magic 🧙 🪄 Unfortunately I noticed it too late and I've lost one hour yesterday 😄

@openshift-ci
Copy link

openshift-ci bot commented Jan 9, 2022

@JPinkney: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ibuziuk
Copy link
Contributor

ibuziuk commented Jan 24, 2022

@amisevsk I believe we can close this one, right?

@amisevsk
Copy link
Collaborator

I think so, I'll leave the branch in place in case it's needed later as this was initially requested by the Che server IIRC.

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.

4 participants