dgr icon indicating copy to clipboard operation
dgr copied to clipboard

dgr push does not use aci version information

Open BenjaminHerbert opened this issue 9 years ago • 7 comments

For a continuous delivery pipeline, I want to be able to set the aci-version at build time to an arbitrary value.

Guided by this example, I added a runlevels/build/10.install.sh script that contains:

cat > /dgr/builder/attributes/version.yml <<EOF
default:
  version: $VERSION
EOF

and used a placeholder in the aci-manifest.yml:

name: aci.example.com/aci-dummy:{{.version}}

When I run dgr clean push --set-env=VERSION=1.2.3, the build is working as intented and creates an ACI named aci.example.com/aci-dummy:1.2.3

However, the push does not seem to pick up the version, it tries to works on aci.example.com/aci-dummy:<no value> instead.

BenjaminHerbert avatar Aug 15 '16 08:08 BenjaminHerbert

Run it as 2 separate commands for the moment

$ dgr clean build --set-env=VERSION=1.2.3
$ dgr push

I will have a look

n0rad avatar Aug 16 '16 09:08 n0rad

Thanks for having a look.

Is it supposed to work at all this way? Maybe my assumptions are wrong.

Here are some further observations. All log statements (regardless of build or push) show:

aci=aci.dvag.net/aci-dummy:

The log statement that shows a version is stated in the build step.

11:13:23 INFO dgr/bin-dgr/aci-build.go:90 Finished building aci fullname=aci.dvag.net/aci-dummy:1.2.3

This seems to be created in bin-dgr/aci-build.go

fullname := common.ExtractNameVersionFromManifest(im)
logs.WithField("fullname", *fullname).Info("Finished building aci")

The other entries seem to be generated by a statement like: logs.WithF(aci.fields).Info("Gzipping aci")` as in bin-dgr/aci-sign.go.

What I noticed is, that for build, the log output states:

11:13:23 DEBUG d/a/bin-run/builder.go:108 Merged attributes for manifest templating aci=aci-dummy attributes=map[version:1.2.3] 11:13:23 DEBUG d/b/common/dgr-manifest.go:112 Templated manifest content=name: aci.example.com/aci-dummy:1.2.3

for push, it states:

11:13:40 DEBUG d/b/common/dgr-manifest.go:112 Templated manifest content=name: aci.example.com/aci-dummy:

It seems like the template is not working in the push step.

BenjaminHerbert avatar Aug 17 '16 09:08 BenjaminHerbert

Are you talking about dgr clean push or dgr build && dgr push ?

It's normal that during the build logs are using aci-dummy:<no value> since the version is defined by the build itself. -> #190

n0rad avatar Aug 17 '16 09:08 n0rad

I was running it as dgr build && dgr push.

BenjaminHerbert avatar Aug 18 '16 10:08 BenjaminHerbert

I have just tested with acserver and it's working.

Does #190 confuse you on the source of the problem ?

n0rad avatar Aug 26 '16 16:08 n0rad

Yes, I was confused by the log output.

I checked again, using the instructions listed here: https://github.com/blablacar/dgr#push-an-aci-and-run-from-repository.

Build & push now works either way: ./dgr clean build --set-env=VERSION=1.2.3 && ./dgr push or ./dgr clean push --set-env=VERSION=1.2.3.

I checked the (locally) uploaded aci with: tar xf /tmp/acis/aci-dummy-latest-linux-amd64.aci manifest -O | grep -m1 version -C2. It correctly shows version 1.2.3.

So this issue is fixed. Thank you very much!

One further question: the uploaded aci (within acserver) showed up aci-dummy-latest-linux-amd64.aci, whereas I have expected to find aci-dummy-1.2.3-linux-amd64.aci on the acserver.

Fetching the image with rkt fetch --insecure-options http,image --no-store aci.dvag.net/aci-dummy:latest and fetches the aci and rkt image list then displays aci.dvag.net/aci-dummy:1.2.3. Where does the latest come from?

BenjaminHerbert avatar Sep 27 '16 14:09 BenjaminHerbert

I can see a request made to: POST /aci-dummy-latest-linux-amd64.aci/startupload HTTP/1.1

BenjaminHerbert avatar Sep 27 '16 16:09 BenjaminHerbert