datawire / forge

Define and run multi-container apps in Kubernetes
http://forge.sh
Apache License 2.0
415 stars 43 forks source link

Forge does not build if the path containing the Dockerfile contains a dot #232

Open GODBS opened 4 years ago

GODBS commented 4 years ago

Error Forge does not build if the path containing the Dockerfile contains a dot

Steps to reproduce Folder structure:

  |
  +---service.yaml
  |
  +---module.api/Dockerfile
  |
  +---module.api/src/...

code in service.yaml:

name: module
memory: 0.25G
cpu: 0.25
endpoint: /{{branch}}
containers:
  - dockerfile: module.api/DockerFile
    context: .

with the following command: forge -v --no-scan-base build

Result: I get the following error:

║ CONFIG: /Users/sample/Project/forge.yaml
║ git rev-parse --abbrev-ref HEAD
║ sample
║ git diff --quiet HEAD .
║ git log --no-color -n1 --format=oneline -- .
║ 8cd3b82cce81addf78762c905d9b2e7bbfaaab24 added backward compatibility on paging endpoints
║ docker login -u sample -p <ELIDED> registry.gitlab.com
║ WARNING! Using --password via the CLI is insecure. Use --password-stdin.
║ Login Succeeded
║ GET https://registry.gitlab.com/v2/sample/registry/module-module.api/manifests/8cd3b82cce81addf78762c905d9b2e7bbfaaab24.git
║ == response could not be parsed as JSON ==
║ 404 page not found
║ 20 tasks run, 1 errors
║   None: unexpected error
║     
║     Traceback (most recent call last):
║       File "/Users/sample/.pex/install/Forge-0.4.15-py2-none-any.whl.9231fb8ee2b34ba80e2fa9fab3e8592e4ca4ae54/Forge-0.4.15-py2-none-any.whl/forge/core.py", line 330, in root
║         service.go(name)
║       File "/Users/sample/.pex/install/Forge-0.4.15-py2-none-any.whl.9231fb8ee2b34ba80e2fa9fab3e8592e4ca4ae54/Forge-0.4.15-py2-none-any.whl/forge/core.py", line 323, in service
║         goal(svc)
║       File "/Users/sample/.pex/install/Forge-0.4.15-py2-none-any.whl.9231fb8ee2b34ba80e2fa9fab3e8592e4ca4ae54/Forge-0.4.15-py2-none-any.whl/forge/core.py", line 255, in build
║         self.bake(service)
║       File "/Users/sample/.pex/install/Forge-0.4.15-py2-none-any.whl.9231fb8ee2b34ba80e2fa9fab3e8592e4ca4ae54/Forge-0.4.15-py2-none-any.whl/forge/core.py", line 200, in bake
║         raw = list(cull(lambda c: not service.docker.exists(c.image, c.version), service.containers))
║       File "/Users/sample/.pex/install/Forge-0.4.15-py2-none-any.whl.9231fb8ee2b34ba80e2fa9fab3e8592e4ca4ae54/Forge-0.4.15-py2-none-any.whl/forge/tasks.py", line 330, in cull
║         execs.append((task.go(obj), obj))
║       File "/Users/sample/.pex/install/Forge-0.4.15-py2-none-any.whl.9231fb8ee2b34ba80e2fa9fab3e8592e4ca4ae54/Forge-0.4.15-py2-none-any.whl/forge/tasks.py", line 313, in applicator
║         return obj(*args, **kwargs)
║       File "/Users/sample/.pex/install/Forge-0.4.15-py2-none-any.whl.9231fb8ee2b34ba80e2fa9fab3e8592e4ca4ae54/Forge-0.4.15-py2-none-any.whl/forge/core.py", line 200, in <lambda>
║         raw = list(cull(lambda c: not service.docker.exists(c.image, c.version), service.containers))
║       File "/Users/sample/.pex/install/Forge-0.4.15-py2-none-any.whl.9231fb8ee2b34ba80e2fa9fab3e8592e4ca4ae54/Forge-0.4.15-py2-none-any.whl/forge/docker.py", line 63, in exists
║         return self.remote_exists(name, version) or self.local_exists(name, version)
║       File "/Users/sample/.pex/install/Forge-0.4.15-py2-none-any.whl.9231fb8ee2b34ba80e2fa9fab3e8592e4ca4ae54/Forge-0.4.15-py2-none-any.whl/forge/docker.py", line 279, in remote_exists
║         result = response.json()
║       File "/Users/sample/.pex/install/Forge-0.4.15-py2-none-any.whl.9231fb8ee2b34ba80e2fa9fab3e8592e4ca4ae54/Forge-0.4.15-py2-none-any.whl/forge/tasks.py", line 409, in patched
║         return parser()
║       File "/Users/sample/.pex/install/requests-2.18.4-py2.py3-none-any.whl.8cc7b78f7356654aee86dfc3d77c12f71ef0bb58/requests-2.18.4-py2.py3-none-any.whl/requests/models.py", line 892, in json
║         return complexjson.loads(self.text, **kwargs)
║       File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 339, in loads
║         return _default_decoder.decode(s)
║       File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 367, in decode
║         raise ValueError(errmsg("Extra data", s, end, len(s)))
║     ValueError: Extra data: line 1 column 5 - line 2 column 1 (char 4 - 19)

It works without issues if i place the k8s folder with the service.yaml directly in the module.api folder and remove the containers section in service.yaml