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

Building task with output named anything but "image" fails at exporting the built tarball. #56

Closed
vrga opened this issue Feb 5, 2021 · 7 comments

Comments

@vrga
Copy link

vrga commented Feb 5, 2021

This works:

      - task:       build-base
        privileged: true
        config:
          platform: linux
          image_resource:
            type: registry-image
            source:
              repository: vito/oci-build-task

          params:
            TARGET:                  main
            CONTEXT: .
            DOCKERFILE:              git-resource/base_images/debian-base/Dockerfile
            BUILD_ARG_APT_CACHE_URL: http://10.10.1.1:3142
            BUILD_ARG_ROOTFS_FILE:   ./built_roots/base/rootfs.tar

          inputs:
            - name: git-resource
            - name: built_roots

          outputs:
            - name: image

          run:
            path: build

Output:

#2 [internal] load .dockerignore
#2 DONE 0.0s

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 489B done
#1 DONE 1.6s

#2 [internal] load .dockerignore
#2 transferring context: 2B done
#2 DONE 2.6s

#3 [internal] load build context
#3 transferring context: 119.25MB 0.8s done
#3 DONE 1.8s

#4 [build 1/2] ADD ./built_roots/base/rootfs.tar /
#4 DONE 2.9s

#5 [build 2/2] RUN printf "Acquire::http { Proxy "%s"; }; " "http://10.10.1...
#5 1.125 Get:1 http://deb.debian.org/debian buster InRelease [121 kB]
#5 1.126 Get:2 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
#5 1.134 Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
#5 1.221 Get:4 http://security.debian.org/debian-security buster/updates/main amd64 Packages [266 kB]
#5 1.307 Get:5 http://deb.debian.org/debian buster/main amd64 Packages [7907 kB]
#5 1.402 Get:6 http://deb.debian.org/debian buster-updates/main amd64 Packages [7848 B]
#5 2.184 Fetched 8420 kB in 1s (7886 kB/s)
#5 2.184 Reading package lists...
#5 2.612 
#5 2.612 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
#5 2.612 
#5 2.620 Reading package lists...
#5 3.040 Building dependency tree...
#5 3.130 Reading state information...
#5 3.208 The following additional packages will be installed:
#5 3.208   libssl1.1 openssl
#5 3.222 The following NEW packages will be installed:
#5 3.222   ca-certificates dumb-init libssl1.1 openssl
#5 3.238 0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
#5 3.238 Need to get 2560 kB of archives.
#5 3.238 After this operation, 6115 kB of additional disk space will be used.
#5 3.238 Get:1 http://security.debian.org/debian-security buster/updates/main amd64 libssl1.1 amd64 1.1.1d-0+deb10u4 [1538 kB]
#5 3.238 Get:2 http://deb.debian.org/debian buster-updates/main amd64 ca-certificates all 20200601~deb10u2 [166 kB]
#5 3.240 Get:3 http://deb.debian.org/debian buster/main amd64 dumb-init amd64 1.2.2-1.1 [13.6 kB]
#5 3.250 Get:4 http://security.debian.org/debian-security buster/updates/main amd64 openssl amd64 1.1.1d-0+deb10u4 [843 kB]
#5 4.093 debconf: delaying package configuration, since apt-utils is not installed
#5 4.111 Fetched 2560 kB in 0s (120 MB/s)
#5 4.759 Selecting previously unselected package libssl1.1:amd64.
(Reading database ... 6677 files and directories currently installed.)
#5 4.769 Preparing to unpack .../libssl1.1_1.1.1d-0+deb10u4_amd64.deb ...
#5 5.042 Unpacking libssl1.1:amd64 (1.1.1d-0+deb10u4) ...
#5 5.842 Selecting previously unselected package openssl.
#5 5.844 Preparing to unpack .../openssl_1.1.1d-0+deb10u4_amd64.deb ...
#5 5.933 Unpacking openssl (1.1.1d-0+deb10u4) ...
#5 6.975 Selecting previously unselected package ca-certificates.
#5 6.977 Preparing to unpack .../ca-certificates_20200601~deb10u2_all.deb ...
#5 7.058 Unpacking ca-certificates (20200601~deb10u2) ...
#5 8.117 Selecting previously unselected package dumb-init.
#5 8.119 Preparing to unpack .../dumb-init_1.2.2-1.1_amd64.deb ...
#5 8.183 Unpacking dumb-init (1.2.2-1.1) ...
#5 9.015 Setting up dumb-init (1.2.2-1.1) ...
#5 9.508 Setting up libssl1.1:amd64 (1.1.1d-0+deb10u4) ...
#5 10.26 debconf: unable to initialize frontend: Dialog
#5 10.26 debconf: (TERM is not set, so the dialog frontend is not usable.)
#5 10.26 debconf: falling back to frontend: Readline
#5 10.26 debconf: unable to initialize frontend: Readline
#5 10.26 debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.28.1 /usr/local/share/perl/5.28.1 /usr/lib/x86_64-linux-gnu/perl5/5.28 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.28 /usr/share/perl/5.28 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
#5 10.26 debconf: falling back to frontend: Teletype
#5 11.55 Setting up openssl (1.1.1d-0+deb10u4) ...
#5 12.47 Setting up ca-certificates (20200601~deb10u2) ...
#5 12.85 debconf: unable to initialize frontend: Dialog
#5 12.85 debconf: (TERM is not set, so the dialog frontend is not usable.)
#5 12.85 debconf: falling back to frontend: Readline
#5 12.85 debconf: unable to initialize frontend: Readline
#5 12.85 debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.28.1 /usr/local/share/perl/5.28.1 /usr/lib/x86_64-linux-gnu/perl5/5.28 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.28 /usr/share/perl/5.28 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
#5 12.85 debconf: falling back to frontend: Teletype
#5 13.14 Updating certificates in /etc/ssl/certs...
#5 13.59 137 added, 0 removed; done.
#5 14.53 Processing triggers for libc-bin (2.28-10) ...
#5 14.91 Processing triggers for ca-certificates (20200601~deb10u2) ...
#5 15.14 Updating certificates in /etc/ssl/certs...
#5 15.51 0 added, 0 removed; done.
#5 15.51 Running hooks in /etc/ca-certificates/update.d...
#5 15.51 done.
#5 15.86 Reading package lists...
#5 16.29 Building dependency tree...
#5 16.40 Reading state information...
#5 16.50 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
#5 DONE 17.4s

#6 [main 1/1] COPY --from=build / /
#6 DONE 3.2s

#7 exporting to oci image format
#7 exporting layers
#7 exporting layers 8.4s done
#7 exporting manifest sha256:79c0e05d1dc08376d0272c8a6e6370b6535644b2a1e5795c74769ce4a20c4d70
#7 exporting manifest sha256:79c0e05d1dc08376d0272c8a6e6370b6535644b2a1e5795c74769ce4a20c4d70 0.7s done
#7 exporting config sha256:87c8335f99eab45b7282223a29e2c9b2966510aad198916c782033842bbc33b4
#7 exporting config sha256:87c8335f99eab45b7282223a29e2c9b2966510aad198916c782033842bbc33b4 1.1s done
#7 sending tarball
#7 sending tarball 0.3s done
#7 DONE 11.8s

This does not:

      - task:       build-base
        privileged: true
        config:
          platform: linux
          image_resource:
            type: registry-image
            source:
              repository: vito/oci-build-task

          params:
            TARGET:                  main
            CONTEXT: .
            DOCKERFILE:              git-resource/base_images/debian-base/Dockerfile
            BUILD_ARG_APT_CACHE_URL: http://10.10.1.1:3142
            BUILD_ARG_ROOTFS_FILE:   ./built_roots/base/rootfs.tar

          inputs:
            - name: git-resource
            - name: built_roots

          outputs:
            - name: image_base

          run:
            path: build

Output:

selected worker: work-01
#2 [internal] load .dockerignore
#2 transferring context: 2B done
#2 ...

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 489B done
#1 DONE 1.7s

#2 [internal] load .dockerignore
#2 DONE 2.3s

#3 [internal] load build context
#3 transferring context: 119.25MB 0.7s done
#3 DONE 3.7s

#4 [build 1/2] ADD ./built_roots/base/rootfs.tar /
#4 DONE 2.7s

#5 [build 2/2] RUN printf "Acquire::http { Proxy "%s"; }; " "http://10.10.1...
#5 1.128 Get:1 http://deb.debian.org/debian buster InRelease [121 kB]
#5 1.130 Get:2 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
#5 1.139 Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
#5 1.236 Get:4 http://deb.debian.org/debian buster/main amd64 Packages [7907 kB]
#5 1.333 Get:5 http://deb.debian.org/debian buster-updates/main amd64 Packages [7848 B]
#5 1.401 Get:6 http://security.debian.org/debian-security buster/updates/main amd64 Packages [266 kB]
#5 2.159 Fetched 8420 kB in 1s (8093 kB/s)
#5 2.159 Reading package lists...
#5 2.580 
#5 2.580 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
#5 2.580 
#5 2.587 Reading package lists...
#5 3.013 Building dependency tree...
#5 3.104 Reading state information...
#5 3.178 The following additional packages will be installed:
#5 3.178   libssl1.1 openssl
#5 3.195 The following NEW packages will be installed:
#5 3.196   ca-certificates dumb-init libssl1.1 openssl
#5 3.215 0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
#5 3.215 Need to get 2560 kB of archives.
#5 3.215 After this operation, 6115 kB of additional disk space will be used.
#5 3.215 Get:1 http://security.debian.org/debian-security buster/updates/main amd64 libssl1.1 amd64 1.1.1d-0+deb10u4 [1538 kB]
#5 3.215 Get:2 http://deb.debian.org/debian buster-updates/main amd64 ca-certificates all 20200601~deb10u2 [166 kB]
#5 3.216 Get:3 http://deb.debian.org/debian buster/main amd64 dumb-init amd64 1.2.2-1.1 [13.6 kB]
#5 3.230 Get:4 http://security.debian.org/debian-security buster/updates/main amd64 openssl amd64 1.1.1d-0+deb10u4 [843 kB]
#5 3.762 debconf: delaying package configuration, since apt-utils is not installed
#5 3.779 Fetched 2560 kB in 0s (116 MB/s)
#5 4.173 Selecting previously unselected package libssl1.1:amd64.
(Reading database ... 6677 files and directories currently installed.)
#5 4.183 Preparing to unpack .../libssl1.1_1.1.1d-0+deb10u4_amd64.deb ...
#5 4.557 Unpacking libssl1.1:amd64 (1.1.1d-0+deb10u4) ...
#5 5.724 Selecting previously unselected package openssl.
#5 5.726 Preparing to unpack .../openssl_1.1.1d-0+deb10u4_amd64.deb ...
#5 5.898 Unpacking openssl (1.1.1d-0+deb10u4) ...
#5 7.835 Selecting previously unselected package ca-certificates.
#5 7.835 Preparing to unpack .../ca-certificates_20200601~deb10u2_all.deb ...
#5 8.057 Unpacking ca-certificates (20200601~deb10u2) ...
#5 9.442 Selecting previously unselected package dumb-init.
#5 9.446 Preparing to unpack .../dumb-init_1.2.2-1.1_amd64.deb ...
#5 9.542 Unpacking dumb-init (1.2.2-1.1) ...
#5 10.45 Setting up dumb-init (1.2.2-1.1) ...
#5 11.02 Setting up libssl1.1:amd64 (1.1.1d-0+deb10u4) ...
#5 11.51 debconf: unable to initialize frontend: Dialog
#5 11.51 debconf: (TERM is not set, so the dialog frontend is not usable.)
#5 11.51 debconf: falling back to frontend: Readline
#5 11.51 debconf: unable to initialize frontend: Readline
#5 11.51 debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.28.1 /usr/local/share/perl/5.28.1 /usr/lib/x86_64-linux-gnu/perl5/5.28 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.28 /usr/share/perl/5.28 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
#5 11.51 debconf: falling back to frontend: Teletype
#5 12.41 Setting up openssl (1.1.1d-0+deb10u4) ...
#5 13.31 Setting up ca-certificates (20200601~deb10u2) ...
#5 13.53 debconf: unable to initialize frontend: Dialog
#5 13.53 debconf: (TERM is not set, so the dialog frontend is not usable.)
#5 13.53 debconf: falling back to frontend: Readline
#5 13.53 debconf: unable to initialize frontend: Readline
#5 13.53 debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.28.1 /usr/local/share/perl/5.28.1 /usr/lib/x86_64-linux-gnu/perl5/5.28 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.28 /usr/share/perl/5.28 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
#5 13.53 debconf: falling back to frontend: Teletype
#5 13.82 Updating certificates in /etc/ssl/certs...
#5 14.28 137 added, 0 removed; done.
#5 15.08 Processing triggers for libc-bin (2.28-10) ...
#5 15.54 Processing triggers for ca-certificates (20200601~deb10u2) ...
#5 15.76 Updating certificates in /etc/ssl/certs...
#5 16.15 0 added, 0 removed; done.
#5 16.15 Running hooks in /etc/ca-certificates/update.d...
#5 16.15 done.
#5 16.60 Reading package lists...
#5 17.03 Building dependency tree...
#5 17.12 Reading state information...
#5 17.21 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
#5 DONE 18.5s

#6 [main 1/1] COPY --from=build / /
#6 DONE 3.0s

TL;DR:
Changing outputs from:

          outputs:
            - name: image

to

          outputs:
            - name: image_base

results in no execution of the "exporting to oci image format" step

@vrga
Copy link
Author

vrga commented Feb 5, 2021

changing output to this:

          outputs:
            - name: image/image_base
              path: image

Makes it actually output the data to the expected folders.
The other variants result in no output to the folders, no digest, no tarball.

@marksunio
Copy link

I am facing the same question

@jutkko
Copy link

jutkko commented May 19, 2021

This will limit the number of oci-build-tasks we can run in a job. If we also want to do two puts, we have to do them in two separate jobs...

@chenbh
Copy link
Contributor

chenbh commented May 19, 2021

FWIW you can always use output_mapping at the step level to rename the output.

It would look something like

- task: build-base
    privileged: true
    config:
            ...
    output_mapping:
        image: some-other-name

@chenbh
Copy link
Contributor

chenbh commented May 19, 2021

There's also a RFC trying to address the interface for input/output of prototypes (aka reusable tasks like this one).

@marksunio
Copy link

FWIW you can always use output_mapping at the step level to rename the output.

It would look something like

- task: build-base
    privileged: true
    config:
            ...
    output_mapping:
        image: some-other-name

thank you very much. Your comment solved my problem

@vito vito closed this as completed in b39205d May 26, 2021
@vito
Copy link
Member

vito commented May 26, 2021

Chiming in late, but output_mapping is the expected approach. I've updated the README to mention it more clearly. PRs for further clarity welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants