Closed dnephin closed 6 years ago
Hey @dnephin the example does not seem to work.
[12:12:20]matus@brno-pc-02:~/dev/dobi/examples/env-vars
> cat dobi.yaml
mount=source:
bind: .
path: /app
image=bash:
image: bash
tags: ['4.4']
pull: once
job=print-version:
use: bash
mounts: [source]
command: /app/print-version.sh
image=dist:
image: repo/myapp
context: .
tags: ["{env.VERSION}"]
depends:
- "print-version:capture(VERSION)"
[12:12:23]matus@brno-pc-02:~/dev/dobi/examples/env-vars
> dobi dist
[WARN] meta.project is not set. Using default "env-vars".
[WARN] [image:pull bash] bash Failed to get image record: stat /home/matus/dev/dobi/examples/env-vars/.dobi/images/bash 4.4: no such file or directory
4.4: Pulling from library/bash
Digest: sha256:72ec7dba36ee88a2296ffc670e30cb1b9f68a0b824bea0e71ea48110d51beaaa
Status: Image is up to date for bash:4.4
[image:pull bash] bash Pulled
[job:capture(VERSION) print-version] /app/print-version.sh Start
[job:capture(VERSION) print-version] /app/print-version.sh Done
[ERROR] a value is required for variable "env.VERSION"
[12:12:29]matus@brno-pc-02:~/dev/dobi/examples/env-vars
> dobi --version
dobi version 0.11.1 (build: ee9138c, date: Sun Jun 24 19:40:44 UTC 2018)
Do I need some newer version than this?
Hmm, weird, when I run it again it works
[12:16:33]matus@brno-pc-02:~/dev/dobi/examples/env-vars
> dobi dist
[WARN] meta.project is not set. Using default "env-vars".
[WARN] [image:pull bash] bash Failed to get image record: stat /home/matus/dev/dobi/examples/env-vars/.dobi/images/bash 4.4: no such file or directory
4.4: Pulling from library/bash
Digest: sha256:72ec7dba36ee88a2296ffc670e30cb1b9f68a0b824bea0e71ea48110d51beaaa
Status: Image is up to date for bash:4.4
[image:pull bash] bash Pulled
[job:capture(VERSION) print-version] /app/print-version.sh Start
3.4.5
[job:capture(VERSION) print-version] /app/print-version.sh Done
Step 1/1 : FROM alpine
---> 3fd9065eaf02
Successfully built 3fd9065eaf02
Successfully tagged repo/myapp:3.4.5
[image:build dist] repo/myapp Created
Same with my own job. What I've done was I rewrote the dependency task as capture('VERSION')
to which it said [ERROR] invalid capture format "capture('VERSION')"
and after that it run through fine.
That is really strange. There is a test for the examples, which should run in a fresh environment in CI, and it seems to have passed.
I'm not sure how the single quotes around VERSION
will work, it's meant to be unquoted.
I mean I caused the build to error with the syntax error, then I removed the quotes and then it passed.
I reproduced this with 3 different projects. I can't send you the production one for obvious reasons but this even happens on the example. I'll try different machine, maybe it's something funny with my computer or maybe there are some caches which are not being cleaned up properly (./dobi/*
?)
I think the problem might be:
[job:capture(VERSION) print-version] /app/print-version.sh Start
[job:capture(VERSION) print-version] /app/print-version.sh Done
It seems that it ran the command but nothing was captured. I think there is a race condition on capturing the stdout
of the process. I believe I've seen this fail in the test suite occasionally.
I'll see if I can find the source of the bug.
Thanks for reporting the issue. I pushed another commit which I believe fixes the problem. The copy of stdout/stderr happens in another goroutine and I wasn't waiting on the copy to finish.
Closes #142 Closes #144