jenkins-x / jx

Jenkins X provides automated CI+CD for Kubernetes with Preview Environments on Pull Requests using Cloud Native pipelines from Tekton
https://jenkins-x.io/
Apache License 2.0
4.58k stars 788 forks source link

jx create quickstart node-http fails in "Build Container Build" #7397

Closed fakoe closed 3 years ago

fakoe commented 4 years ago

Summary

When executing jx create quickstart -> node-http, the pipeline stops at "Build Container Build" and fails. I'm using a local minikube kubernetes cluster with a non default docker registry set to https://index.docker.io/v1/

Now, before I get the "We don't support minikube anymore" answer again, please let me say this: Jx boot ran without ANY problems (looking good). It setup the git repositories and everything. I don't think that minikube is responsible for this error. Maybe the local installation vs the cloud and me using docker hub instead a default cloud registry, yes. BUT, when you recommend the default docker hub url to me, when I select yes on using a non default registry, then this should work, right?

I followed your recommendations on https://jenkins-x.io/docs/reference/components/docker-registry/#using-docker-hub and recreated the jenkins-docker-cfg, pointing to my .docker/config.json file after I logged into docker (Side note: I also used the same credentials, when I was asked by jx boot, so the config.json file hasn't changed). I re-ran the pipeline after recreating the cfg with the exact same outcome (see "Error" below).

As you can see below, my parameters.yaml, jx-requirements and my kubernetes/values.tmp.yaml are looking like you recommend them to look.

Now, what I suspect: When you look at the Error, the push permission fails for "docker.io/lobster-jx/node-http:0.0.1" aswell as pull, since it claims, that I'm unauthorized. My actual docker hub username is lobsterjx and NOT lobster-jx (that is my git user) lobster-jx isn't my repositories' name either.

I tried multible ways to push a hello-world image to my docker account. All of them worked when I used lobsterjx and all of them failed when I used lobster-jx:

docker push docker.io/lobsterjx/hello-world
docker push lobsterjx/hello-world
docker push lobsterjx/my-repository:hello-world

So, I'm assuming, that my github username or my pipeline username is switched with my docker hub username somewhere along the pipeline, since all the docker pushes and pulls in the error-log are with lobster-jx

Can you tell me how I can update my settings, so that the pipeline pushes as lobsterjx and not as lobster-jx?

Error

Showing logs for build lobster-jx/node-http/master #2 stage from-build-pack and container step-build-container-build
E0625 14:20:38.224511       9 aws_credentials.go:77] while getting AWS credentials NoCredentialProviders: no valid providers in chain. Deprecated.
        For verbose messaging see aws.Config.CredentialsChainVerboseErrors
error checking push permissions -- make sure you entered the correct tag name, and that you are authenticated correctly, and try again: checking push permission for "docker.io/lobster-jx/node-http:0.0.1": POST https://index.docker.io/v2/lobster-jx/node-http/blobs/uploads/: UNAUTHORIZED: authentication required; [map[Action:pull Class: Name:lobster-jx/node-http Type:repository] map[Action:push Class: Name:lobster-jx/node-http Type:repository]]

Pipeline failed on stage 'from-build-pack' : container 'step-build-container-build'. The execution of the pipeline has stopped.

Steps to reproduce the behavior

Expected behavior

pipeline finishes

Actual behavior

pipeline fails and stopps.

Settings in "jx-requirements.yaml"

cluster:
  clusterName: minikube
  devEnvApprovers:
  - lobster-jx
  environmentGitOwner: lobster-jx
  gitKind: github
  gitName: github
  gitServer: https://github.com
  namespace: jx
  provider: kubernetes
  registry: docker.io

Settings in "env/parameters.yaml"

adminUser:
  password: local:minikube/adminUser:password
  username: xxx
docker:
  email: xxx@xxx.com
  password: local:minikube/docker:password
  url: https://index.docker.io/v1/
  username: lobsterjx
enableDocker: true
pipelineUser:
  email: xxx@xxx.com
  token: local:minikube/pipelineUser:token
  username: lobster-jx
prow:
  hmacToken: local:minikube/prow:hmacToken

Settings in "kubeProviders/kubernetes/values.tmpl.yaml"

# Override configuration from https://github.com/jenkins-x/jenkins-x-platform/blob/master/jenkins-x-platform/values.yaml
jenkins-x-platform:
  PipelineSecrets:

{{- if eq .Parameters.enableDocker true }}
    DockerConfig: |-
      {
        "auths":{
          {{ .Parameters.docker.url | quote }}:
            {
              "auth": {{ printf "%s:%s" .Parameters.docker.username .Parameters.docker.password | b64enc | quote}},
              "email": {{ .Parameters.docker.email | quote}}
            }
        }
      }
{{- end}}
fakoe commented 4 years ago

I want to give you an update about the wrong username:

I created another VM with the exact same settings, except that I changed my github-username to the same as my docker hub username: lobsterjx

Now, when I run jx create quickstart and select node-http, the "Build Container Build" step of the pipeline works!

Am I missing something, or is this intended to work like that?

deanesmith commented 4 years ago

Hi @fakoe, seems like a legit bug. Might be a documentation issue. Thank you.

nodece commented 4 years ago

I have same issues, I think improve it is important.

my issues: #7446

how jx get dockerRegistry org?

first of all, jx read dockerRegistryOwner from jenkins-x.yml, if it is nil, jx read config from k8s, if it is nil, jx read DOCKER_REGISTRY_ORG from env, if it is nil, jx will use git username as dockerRegistry org.

jenkins-x-bot commented 4 years ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with /close. Provide feedback via https://jenkins-x.io/community. /lifecycle stale

jenkins-x-bot commented 3 years ago

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity. If this issue is safe to close now please do so with /close. Provide feedback via https://jenkins-x.io/community. /lifecycle rotten

jenkins-x-bot commented 3 years ago

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten. Provide feedback via https://jenkins-x.io/community. /close

jenkins-x-bot commented 3 years ago

@jenkins-x-bot: Closing this issue.

In response to [this](https://github.com/jenkins-x/jx/issues/7397#issuecomment-745306136): >Rotten issues close after 30d of inactivity. >Reopen the issue with `/reopen`. >Mark the issue as fresh with `/remove-lifecycle rotten`. >Provide feedback via https://jenkins-x.io/community. >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [jenkins-x/lighthouse](https://github.com/jenkins-x/lighthouse/issues/new?title=Command%20issue:) repository.