q-shift / openshift-vm-playground

0 stars 1 forks source link

Tekton job deploying Quarkus app fails due to UNAUTHORIZED #30

Closed cmoulliard closed 11 months ago

cmoulliard commented 11 months ago

Issue:

GitHub flow deploying Quarkus app fails due to this auth issue

Error: build-image-deploy : mvn-goals] [ERROR] Caused by: com.google.cloud.tools.jib.api.RegistryAuthenticationFailedException: Failed to authenticate with registry quay.io/snowdrop/quarkus-dev-vm because: 401 UNAUTHORIZED
Error: build-image-deploy : mvn-goals] [ERROR] GET https://quay.io/v2/auth?service=quay.io&scope=repository:snowdrop/quarkus-dev-vm:pull,push
Error: build-image-deploy : mvn-goals] [ERROR] {"errors":[{"code":"UNAUTHORIZED","detail":{},"message":"Could not find robot with username: *** and supplied password."}]}
Error: build-image-deploy : mvn-goals] [ERROR] 

The problem is perhaps related to a wrong base64 command used as job works locally using same credentials

encodeAuth=$(echo "${{ secrets.QUAY_USERNAME }}:${{ secrets.QUAY_ROBOT_TOKEN }}" | base64 -w0)
          cat <<EOF > config.json
          {
            "auths": {
              "quay.io/${{ env.QUAY_ORG }}": {
                "auth": "$encodeAuth"
              }
            }
          }
          EOF
          kubectl create secret generic dockerconfig-secret --from-file=config.json
cmoulliard commented 11 months ago

Fixed after echoing the string without adding a new line echo -n ..... when we generate the Auth base64 string