The deliverable fails to be created with "failed to checkout and determine revision: unable to clone '<GIT-URL>': authentication required" error
search cancel

The deliverable fails to be created with "failed to checkout and determine revision: unable to clone '<GIT-URL>': authentication required" error

book

Article ID: 404873

calendar_today

Updated On:

Products

VMware Tanzu Application Platform

Issue/Introduction

A TAP (Tanzu Application Platform) deliverable was created but it is in READY=False state.

NAME                     SOURCE      DELIVERY         READY   REASON                 AGE
<DELIVERALE-NSAME>       <GIT-URL>   delivery-basic   False   HealthyConditionRule   55s

Describing the failing deliverable will show the following error message:

Message:               failed to checkout and determine revision: unable to clone '<GIT-URL>': authentication required
Reason:                HealthyConditionRule
Status:                False
Type:                  Ready

Resolution

This issue has two possible causes:

① Users might need to specify a secret to access the git repos when creating a workload. 

apiVersion: v1
kind: Secret
metadata:
  name: SECRET-NAME
  annotations:
    tekton.dev/git-0: GIT-SERVER        # ! required
type: kubernetes.io/basic-auth          # ! required
stringData:
  username: GIT-USERNAME
  password: GIT-PASSWORD

For the password field of the secret, it should be a token instead of a login password. For instance, a personal access token will need to be assigned when Github is in use.

Therefore, users need to validate the password is a valid personal access token and can be used to access the repository normally.

② If users specify both the git-repo and gitops-repository when creating the workload, then it would be necessary to add the following parameters. 

  • --param source_credentials_secret=<SECRET-NAME> 
  • --param gitops_credentials_secret=<SECRET-NAME> 

A full command looks like:

tanzu apps workload apply <WORKLOAD-NAME> \
  -n demo \
  --git-repo <GIT-URL> \
  --git-branch master \
  --label apps.tanzu.vmware.com/has-tests=true \
  --type web \
  --app <APP-NAME> \
  --param gitops_branch=main \
  --param gitops_commit_message=<SOME-MESSAGE> \
  --param gitops_server_address=<SERVER-ADDRESS> \
  --param gitops_repository_owner=<OWNER-NAME> \
  --param gitops_repository_name=<REPO-NAME> \
  --param gitops_server_kind=<KIND> \
  --param gitops_user_email=<E-MAIL-ADDR> \
  --param gitops_user_name=<USER-NAME> \
  --param source_credentials_secret=<SECRET-NAME> \
  --param gitops_credentials_secret=<SECRET-NAME> \
  --annotation autoscaling.knative.dev/minScale=1 \
  --param-yaml testing_pipeline_matching_labels='{"apps.tanzu.vmware.com/language":"nodejs","apps.tanzu.vmware.com/pipeline":"test"}' \
  --request-memory 1Gi \
  --limit-memory 1Gi \
  --request-cpu 600m \
  --limit-cpu 600m \
  -y