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.57k stars 787 forks source link

Pipeline exection failed on the step export VERSION=`cat VERSION` && skaffold build -f skaffold.yaml #1619

Closed shawnho1018 closed 6 years ago

shawnho1018 commented 6 years ago

Summary

I am beginning to use jenkins-x. After playing with jx create quickstart -l python, I found my created pipeline could not successfully be built. It failed on skaffold build step with the following error: 2018/09/09 23:08:34 Unable to read "/home/jenkins/.docker/config.json", falling back on anonymous: open /home/jenkins/.docker/config.json: no such file or directory time="2018-09-09T23:08:35Z" level=fatal msg="build step: building [changeme]: build artifact: running build: docker build: Error response from daemon: Error processing tar file(exit status 1): unexpected EOF" I checked my jenkins system settings (http://jenkins.jx.54.246.167.203.nip.io/configure) and found the secret-volume of jenkins-docker-config. I also checked my kubectl get secrets jenkins-docker-config and confirms its existence.

Steps to reproduce the behavior

  1. Reproduce secret jenkins-docker-cfg kubectl create secret generic jenkins-docker-cfg --from-file=./config-pks.json with the following files { "auths": { "harbor-fqdn.vke-user.com": { "auth": "YWRtaW46Zm94YmVyeWw=" } }, "HttpHeaders": { "User-Agent": "Docker-Client/18.01.0-ce (linux)" } }
  2. jx create quickstart -l python
  3. Check Jenkins BlueOcean
  4. Open the pipeline execution. I will find

export VERSION=cat VERSION && skaffold build -f skaffold.yaml [shawnho1018_p1-jx5_master-KQMDCPF6VK4MUDYVCGIADCZUNBPWHXEIL4ABZM4AKRVKWOAEEBFA] Running shell script ++ cat VERSION + export VERSION=0.0.1 + VERSION=0.0.1 + skaffold build -f skaffold.yaml Starting build... Building [changeme]...

2018/09/09 23:08:34 Unable to read "/home/jenkins/.docker/config.json", falling back on anonymous: open /home/jenkins/.docker/config.json: no such file or directory time="2018-09-09T23:08:35Z" level=fatal msg="build step: building [changeme]: build artifact: running build: docker build: Error response from daemon: Error processing tar file(exit status 1): unexpected EOF"

script returned exit code 1

Jx version

1.3.209 The output of jx version is:

NAME               VERSION
jx                 1.3.209

Kubernetes cluster

What kind of Kubernetes cluster are you using & how did you create it? VKE K8S cluster opened in privileged mode. vke create cluster

Operating system / Environment

Expected behavior

The pipeline can be executed correctly.

Actual behavior

The pipeline failed in the skaffold step.

jstrachan commented 6 years ago

when doing kubectl create secret generic jenkins-docker-cfg --from-file=./config-pks.json you must use ta file called config.json as this CLI results in the key of the Secret being the name of the file. e.g.

kubectl create secret generic jenkins-docker-cfg --from-file=./config.json as per these docs: https://jenkins-x.io/architecture/docker-registry/#update-the-config-json-secret

you can also now use the CLI command jx create docker auth https://jenkins-x.io/commands/jx_create_docker/

jstrachan commented 6 years ago

I added a bit more clarity to the docs here: https://jenkins-x.io/architecture/docker-registry/#update-the-config-json-secret and a warning about not using config.json as the file name

nandar999 commented 4 years ago

When I build pipeline with jenkins x on AWS EKS, the following error shows:

build artifact: docker build: error during connect: creating docker context: getting relative tar paths: file pattern [repositories] must match at least one file" script returned exit code 1 How could I solve this error?