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

return codes not working #417

Closed
kfox1111 opened this issue Dec 16, 2019 · 9 comments
Closed

return codes not working #417

kfox1111 opened this issue Dec 16, 2019 · 9 comments
Labels
type/bug Issue that reports an unexpected behaviour.

Comments

@kfox1111
Copy link

Building an app that has an issue:

[kfox@zathras pytest]$ pack version
v0.5.0 (git sha: c9cfac75b49609524e1ea33f809c12071406547c)
[kfox@zathras pytest]$ pack build simple-app --path . --builder cloudfoundry/cnb:cflinuxfs3

<snip>

[builder] ERROR: No matching distribution found for json (from -r /workspace/requirements.txt (line 2))
[builder] WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
[builder] You should consider upgrading via the 'pip install --upgrade pip' command.
[builder] exit status 1
[builder] ERROR: failed to build: exit status 103
===> EXPORTING
[exporter] Adding layer 'app'
[exporter] Reusing layer 'config'
[exporter] ERROR: failed to export: exporting config layer: no previous image provided to reuse layers from
===> CACHING
[cacher] Caching layer 'org.cloudfoundry.python-runtime:4d63479543a71379d40318f7727424807258dbe7e6f724ee64a43bf3279f156d'
[cacher] Caching layer 'org.cloudfoundry.python-runtime:python'
Successfully built image simple-app
[kfox@zathras pytest]$ echo $?
0
[kfox@zathras pytest]$ docker images | grep simple
[kfox@zathras pytest]$ 

The image clearly failed to build, but the shell result is 0 and text was "Successfully built image simple-app. This seems very wrong.

@zmackie
Copy link
Contributor

zmackie commented Dec 16, 2019

@kfox1111 Indeed there seems to be something wrong! Would you mind sharing the app you're building against?

@kfox1111
Copy link
Author

Basically the code from: buildpacks-community/kpack#237

but I had 'json' also in the requirements.txt file unnecessarily. it wasn't found and failed with a success.

@zmackie
Copy link
Contributor

zmackie commented Dec 18, 2019

@kfox1111 What platform are you on? I just tried this locally and it failed. Maybe can you paste the whole output so we can get versions? Unlikely, but it an error in one of the components could be the cause.

± zm |develop ?:1 ✗| → pack build test --path . --builder cloudfoundry/cnb:cflinuxfs3
cflinuxfs3: Pulling from cloudfoundry/cnb
Digest: sha256:b31ead78f99670b3c7eb38356577104e9edcb18ea46798ac867d3b3063d1a87d
Status: Image is up to date for cloudfoundry/cnb:cflinuxfs3
full-cnb: Pulling from cloudfoundry/run
Digest: sha256:469f092c28ab64c6798d6f5e24feb4252ae5b36c2ed79cc667ded85ffb49d996
Status: Image is up to date for cloudfoundry/run:full-cnb
===> DETECTING
[detector] 2 of 3 buildpacks participating
[detector] org.cloudfoundry.python-runtime 0.0.57
[detector] org.cloudfoundry.pip            0.0.53
===> RESTORING
[restorer] Cache '/cache': metadata not found, nothing to restore
===> ANALYZING
[analyzer] Warning: Image 'index.docker.io/library/test:latest' not found
===> BUILDING
[builder] -----> Python Runtime Buildpack &{[34] <nil>}
[builder]   Python 3.7.5: Contributing to layer
[builder]     Downloading from https://buildpacks.cloudfoundry.org/dependencies/python/python-3.7.5-linux-x64-cflinuxfs3-4d634795.tgz
[builder]     Verifying checksum
[builder]        Expanding to /layers/org.cloudfoundry.python-runtime/python
[builder]     Writing PYTHONPATH to shared
[builder]     Writing PYTHONHOME to shared
[builder]     Writing PYTHONUNBUFFERED to shared
[builder]     Writing PYTHONHASHSEED to shared
[builder]     Writing LANG to shared
[builder] -----> Pip Buildpack &{[34] <nil>}
[builder] -----> Python Packages &{[34] <nil>}: Contributing to layer
[builder] pip installing to: /layers/org.cloudfoundry.pip/python_packages
[builder] Collecting flask (from -r /workspace/requirements.txt (line 1))
[builder]   Downloading https://files.pythonhosted.org/packages/9b/93/628509b8d5dc749656a9641f4caf13540e2cdec85276964ff8f43bbb1d3b/Flask-1.1.1-py2.py3-none-any.whl (94kB)
[builder] Collecting gunicorn (from -r /workspace/requirements.txt (line 2))
[builder]   Downloading https://files.pythonhosted.org/packages/69/ca/926f7cd3a2014b16870086b2d0fdc84a9e49473c68a8dff8b57f7c156f43/gunicorn-20.0.4-py2.py3-none-any.whl (77kB)
[builder] Collecting json (from -r /workspace/requirements.txt (line 3))
[builder]   ERROR: Could not find a version that satisfies the requirement json (from -r /workspace/requirements.txt (line 3)) (from versions: none)
[builder] ERROR: No matching distribution found for json (from -r /workspace/requirements.txt (line 3))
[builder] WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
[builder] You should consider upgrading via the 'pip install --upgrade pip' command.
[builder] exit status 1
[builder] ERROR: failed to build: exit status 103
ERROR: failed with status code: 7
± zm |develop ?:1|cat app.py

from flask import Flask, Response
import os
import json

app = Flask(__name__)

@app.route('/')
def get_root():
    js = json.dumps({'hello':'test'})
    resp = Response(js, status=200, mimetype='application/json')
    return resp
if __name__ == '__main__':
    app.run()
± zm |develop ?:1 ✗| → cat requirements.txt
flask
gunicorn
json

@jromero jromero added status/awaiting-response type/bug Issue that reports an unexpected behaviour. labels Dec 18, 2019
@kfox1111
Copy link
Author

centos7

Fulll run:
[kfox@zathras pytest]$ pack build test --path . --builder cloudfoundry/cnb:cflinuxfs3
Trying to pull repository docker.io/cloudfoundry/cnb ...
cflinuxfs3: Pulling from docker.io/cloudfoundry/cnb
a15d98bff734: Pulling fs layer
5fc72bd1c95d: Pulling fs layer
a171588cfd4e: Pulling fs layer
5312ff4c2544: Waiting
26bbecca8d72: Waiting
c4e27ba2d968: Waiting
a64a4419715b: Waiting
df3128e790b7: Waiting
f003be7d63bc: Waiting
172d6c6991c9: Waiting
f11cad633d89: Waiting
b7255b5af648: Waiting
b006cdcbadca: Waiting
1e501b3ccc95: Waiting
ced139d62bec: Waiting
1976372ec5f9: Waiting
18534139289b: Waiting
674cf91a194c: Waiting
270f430b1957: Waiting
d6b7f8920095: Pulling fs layer
1a8652b3cb04: Pulling fs layer
918ee0bf5364: Pulling fs layer
d6b7f8920095: Waiting
1a8652b3cb04: Waiting
c7ed4205e07e: Pull complete
a91c3d5eac80: Pull complete
735d24a649b0: Pull complete
150ccdd22b88: Pull complete
d677802eb642: Pull complete
55f094fc380f: Pull complete
4060809860f8: Pull complete
d640f275fa01: Pull complete
1590af40d6ca: Pull complete
0c45b5158249: Pull complete
ea0be33c7862: Pull complete
20f3401a0dc9: Pull complete
ac4896383548: Pull complete
48f8e4c3e4c5: Pull complete
7eb1005dcaff: Pull complete
d70308f5e60b: Pull complete
4fc678606a85: Pull complete
9b3923734f82: Pull complete
86110173ccbc: Pull complete
ea0c3a1f2645: Pull complete
ae36fd01adde: Pull complete
faf3e07302d7: Pull complete
89732bc75041: Pull complete
Digest: sha256:b31ead78f99670b3c7eb38356577104e9edcb18ea46798ac867d3b3063d1a87d
Status: Downloaded newer image for docker.io/cloudfoundry/cnb:cflinuxfs3
Trying to pull repository docker.io/cloudfoundry/run ...
full-cnb: Pulling from docker.io/cloudfoundry/run
Digest: sha256:469f092c28ab64c6798d6f5e24feb4252ae5b36c2ed79cc667ded85ffb49d996
Status: Image is up to date for docker.io/cloudfoundry/run:full-cnb
===> DETECTING
[detector] 2 of 3 buildpacks participating
[detector] org.cloudfoundry.python-runtime 0.0.57
[detector] org.cloudfoundry.pip 0.0.53
===> RESTORING
[restorer] Cache '/cache': metadata not found, nothing to restore
===> ANALYZING
[analyzer] Warning: Image 'index.docker.io/library/test:latest' not found
===> BUILDING
[builder] -----> Python Runtime Buildpack &{[34] }
[builder] Python 3.7.5: Contributing to layer
[builder] Downloading from https://buildpacks.cloudfoundry.org/dependencies/python/python-3.7.5-linux-x64-cflinuxfs3-4d634795.tgz
[builder] Verifying checksum
[builder] Expanding to /layers/org.cloudfoundry.python-runtime/python
[builder] Writing PYTHONPATH to shared
[builder] Writing PYTHONHOME to shared
[builder] Writing PYTHONUNBUFFERED to shared
[builder] Writing PYTHONHASHSEED to shared
[builder] Writing LANG to shared
[builder] -----> Pip Buildpack &{[34] }
[builder] -----> Python Packages &{[34] }: Contributing to layer
[builder] pip installing to: /layers/org.cloudfoundry.pip/python_packages
[builder] Collecting flask (from -r /workspace/requirements.txt (line 1))
[builder] Downloading https://files.pythonhosted.org/packages/9b/93/628509b8d5dc749656a9641f4caf13540e2cdec85276964ff8f43bbb1d3b/Flask-1.1.1-py2.py3-none-any.whl (94kB)
[builder] Collecting gunicorn (from -r /workspace/requirements.txt (line 2))
[builder] Downloading https://files.pythonhosted.org/packages/69/ca/926f7cd3a2014b16870086b2d0fdc84a9e49473c68a8dff8b57f7c156f43/gunicorn-20.0.4-py2.py3-none-any.whl (77kB)
[builder] Collecting json (from -r /workspace/requirements.txt (line 3))
[builder] ERROR: Could not find a version that satisfies the requirement json (from -r /workspace/requirements.txt (line 3)) (from versions: none)
[builder] ERROR: No matching distribution found for json (from -r /workspace/requirements.txt (line 3))
[builder] WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
[builder] You should consider upgrading via the 'pip install --upgrade pip' command.
[builder] exit status 1
[builder] ERROR: failed to build: exit status 103
===> EXPORTING
[exporter] Adding layer 'app'
[exporter] Reusing layer 'config'
[exporter] ERROR: failed to export: exporting config layer: no previous image provided to reuse layers from
===> CACHING
[cacher] Caching layer 'org.cloudfoundry.python-runtime:4d63479543a71379d40318f7727424807258dbe7e6f724ee64a43bf3279f156d'
[cacher] Caching layer 'org.cloudfoundry.python-runtime:python'
Successfully built image test
[kfox@zathras pytest]$ echo $?
0

@jromero
Copy link
Member

jromero commented Jan 3, 2020

Still unable to reproduce this issue. I've attempted to run 0.5.0 and 0.6.0 on Centos 8. Although I'm getting a network related issue it resorts to the same "exit status 103" message but the process exits as expected.

===> DETECTING
[detector] 2 of 3 buildpacks participating
[detector] org.cloudfoundry.python-runtime 0.0.57
[detector] org.cloudfoundry.pip            0.0.53
===> RESTORING
[restorer] Cache '/cache': metadata not found, nothing to restore
===> ANALYZING
[analyzer] Warning: Image 'index.docker.io/library/simple-app:latest' not found
===> BUILDING
[builder] -----> Python Runtime Buildpack &{[34] <nil>}
[builder]   Python 3.7.5: Contributing to layer
[builder]     Downloading from https://buildpacks.cloudfoundry.org/dependencies/python/python-3.7.5-linux-x64-cflinuxfs3-4d634795.tgz
[builder] Get https://buildpacks.cloudfoundry.org/dependencies/python/python-3.7.5-linux-x64-cflinuxfs3-4d634795.tgz: dial tcp: lookup buildpacks.cloudfoundry.org on 192.168.2.2:53: read udp 172.17.0.2:42668->192.168.2.2:53: read: no route to host
[builder] ERROR: failed to build: exit status 103
ERROR: failed with status code: 7
[root@localhost jromero]# echo $?
1

This is the current setup:

[root@localhost jromero]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="8 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="8"

[root@localhost jromero]# $SHELL --version
GNU bash, version 4.4.19(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

[root@localhost jromero]# ./pack report
Pack:
  Version:  v0.6.0 (git sha: 109b629d388cec0ed3836b9fed6717727a9187c1)
  OS/Arch:  linux/amd64

Default Lifecycle Version:  0.5.0

Config:
(error: open /root/.pack/config.toml: no such file or directory)

@kfox1111
Copy link
Author

kfox1111 commented Jan 3, 2020

I had to reinstall my laptop as its ssd was warning it was going to fail soon. So I'm on centos 8 now. I can confirm it works as expected on centos 8. So something on centos 7 tickles it.

@jromero
Copy link
Member

jromero commented Jan 3, 2020

I'm glad it's resolved for you. I went ahead and tested it on Centos 7 and sure enough I was able to reproduce the issue. It appears that it's related to an older version of docker available in the yum repo by default. After following the docker installation instructions for the latest docker-ce version the issue is resolved.

I honestly didn't dig into any reported/resolved issues given that there are many versions in between (since 1.13.1 (2017-02-08)) but it's most likely related to an issue with the API we are using to await the execution of the container. It does bring up a question as to what versions of docker we support and whether we'd want hard restrictions to prevent elusive issues such as these.

As for this issue, I will go ahead and close it.

Reproduction

Docker version:
image

Output:
Screen Shot 2020-01-02 at 11 46 26 PM

Resolution

Docker version:
image

Output:
Screen Shot 2020-01-03 at 12 39 08 AM

@jromero jromero closed this as completed Jan 3, 2020
@kfox1111
Copy link
Author

kfox1111 commented Jan 3, 2020

Ah, ok. That makes sense. I was using centos's docker rather then docker-ce. So I can confirm that.

That brings up a new question though related to your support question.

Redhat's not supporting docker at all anymore on el8. They prefer buildah. Its working pretty well here. It can even do unprivileged builds which is very nice.

To do the test, I installed only the docker cli, and attached it to minikube to use its dockerd.

I'm running a lot of docker-less Kubernetes clusters these days (containerd, cri-o).

Under Kubernetes, I've had pretty good luck using Kaniko (https://github.com/GoogleContainerTools/kaniko) to produce images. It also can do unprivileged builds.

So are there any plans for pack to support building without dockerd?

@jromero
Copy link
Member

jromero commented Jan 3, 2020

@kfox1111 We are certainly looking into it. We used docker as a quick simple implementation. We haven't fully fleshed out exactly what it would entail but would look favorably at any contributions going in that direction.

Here's a bit more info:
#413 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Issue that reports an unexpected behaviour.
Projects
None yet
Development

No branches or pull requests

3 participants