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

Improve error reporting in project clone #485

Merged
merged 2 commits into from
Jul 13, 2021

Conversation

amisevsk
Copy link
Collaborator

@amisevsk amisevsk commented Jul 8, 2021

What does this PR do?

  • Never restart the project-clone container since it's not re-entrant. Instead, log output to a file and copy it into $PROJECTS_ROOT if an error occurs.
  • Run git reset --hard after checking out a branch to emulate git's behavior in (misconfigured?) git repos such as https://github.com/che-samples/java-spring-petclinic/tree/devfilev2 (.vscode/extensions is commited to the repo and .gitignored, which causes go-git to ignore it even for git reset)

What issues does this PR fix or reference?

Closes #457

Is it tested? How?

  • Update RELATED_IMAGE_project_clone in a DWO deployment to quay.io/amisevsk/project-clone:error-reporting
  • Create a devworkspace to test error reporting:
    cat <<EOF | kubectl apply -f -
    kind: DevWorkspace
    apiVersion: workspace.devfile.io/v1alpha2
    metadata:
      name: test-dw
    spec:
      started: true
      template:
        projects:
        - name: dwo
          git:
            checkoutFrom:
              remote: amisevsk
              revision: non-existent-branch
            remotes:
              amisevsk: https://github.com/amisevsk/devworkspace-operator.git
              origin: https://github.com/devfile/devworkspace-operator.git
              sleshchenko: https://github.com/sleshchenko/devworkspace-operator.git
        components:
          - name: theia
            plugin:
              uri: https://che-plugin-registry-main.surge.sh/v3/plugins/eclipse/che-theia/next/devfile.yaml
    EOF
    • /projects should contain a file named project-clone-errors.log after workspace is started
  • Create a devworkspace to test reset behaviour:
    cat <<EOF | kubectl apply -f -
    kind: DevWorkspace
    apiVersion: workspace.devfile.io/v1alpha2
    metadata:
      name: test-dw
    spec:
      started: true
      template:
        projects:
        - name: spring-petclinic
          git:
            checkoutFrom:
              revision: devfilev2
            remotes:
              origin: https://github.com/che-samples/spring-petclinic
        components:
          - name: theia
            plugin:
              uri: https://che-plugin-registry-main.surge.sh/v3/plugins/eclipse/che-theia/next/devfile.yaml
    EOF
    • Project's git state should be clean.

PR Checklist

  • E2E tests pass (when PR is ready, comment /test v7-devworkspaces-operator-e2e, v7-devworkspace-happy-path to trigger)
    • v7-devworkspaces-operator-e2e: DevWorkspace e2e test
    • v7-devworkspace-happy-path: DevWorkspace e2e test

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
This is required since go-git's reset implementation ignores files in
.gitignore even if the files in question are committed to the repo.

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
@openshift-ci openshift-ci bot requested a review from JPinkney July 8, 2021 21:37
@openshift-ci openshift-ci bot added the approved label Jul 8, 2021
Copy link
Member

@sleshchenko sleshchenko left a comment

Choose a reason for hiding this comment

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

I haven't tested but changes LGTM

Copy link
Contributor

@JPinkney JPinkney left a comment

Choose a reason for hiding this comment

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

LGTM

@openshift-ci
Copy link

openshift-ci bot commented Jul 13, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: amisevsk, JPinkney, sleshchenko

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:
  • OWNERS [JPinkney,amisevsk,sleshchenko]

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

@amisevsk
Copy link
Collaborator Author

/test v7-devworkspaces-operator-e2e, v7-devworkspace-happy-path

@amisevsk amisevsk merged commit 7e6a6f5 into devfile:main Jul 13, 2021
@amisevsk amisevsk deleted the project-clone-error-reporting branch July 13, 2021 22:21
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.

Errors during project clone are not reported
3 participants