replicatedhq / kURL

Production-grade, airgapped Kubernetes installer combining upstream k8s with overlays and popular components
https://kurl.sh
Apache License 2.0
750 stars 79 forks source link

Unable to build the images to contribute with #3676

Closed camilamacedo86 closed 1 year ago

camilamacedo86 commented 1 year ago

By following the contributing guide we should able to run make build/packages/docker/<docker-version>/ubuntu-<version>. However, it fails as follows:

make build/packages/docker/20.10.17/ubuntu-22.04                                    
./bundles/docker-ubuntu2204/build.sh 20.10.17 `pwd`/build/packages/docker/20.10.17/ubuntu-22.04
+ set -e
+ DOCKER_VERSION=20.10.17
+ OUTPATH=/Users/camilamacedo/go/src/github.com/replicatedhq/kURL/build/packages/docker/20.10.17/ubuntu-22.04
+ SEMVER_COMPARE_RESULT=
+ semverCompare 20.10.17 20.10.17
+ semverParse 20.10.17
+ major=20
+ minor=10.17
+ minor=10
+ patch=17
+ patch=17
+ _a_major=20
+ _a_minor=10
+ _a_patch=17
+ semverParse 20.10.17
+ major=20
+ minor=10.17
+ minor=10
+ patch=17
+ patch=17
+ _b_major=20
+ _b_minor=10
+ _b_patch=17
+ '[' 20 -lt 20 ']'
+ '[' 20 -gt 20 ']'
+ '[' 10 -lt 10 ']'
+ '[' 10 -gt 10 ']'
+ '[' 17 -lt 17 ']'
+ '[' 17 -gt 17 ']'
+ SEMVER_COMPARE_RESULT=0
+ '[' 0 = -1 ']'
+ docker build --build-arg DOCKER_VERSION=20.10.17 -t kurl/ubuntu-2204-docker:20.10.17 -f bundles/docker-ubuntu2204/Dockerfile bundles/docker-ubuntu2204
[+] Building 0.2s (13/13) FINISHED                                                                                                               
 => [internal] load build definition from Dockerfile                                                                                        0.0s
 => => transferring dockerfile: 1.37kB                                                                                                      0.0s
 => [internal] load .dockerignore                                                                                                           0.0s
 => => transferring context: 2B                                                                                                             0.0s
 => [internal] load metadata for docker.io/library/ubuntu:22.04                                                                             0.0s
 => [1/9] FROM docker.io/library/ubuntu:22.04                                                                                               0.0s
 => CACHED [2/9] RUN apt-get -y update                                                                                                      0.0s
 => CACHED [3/9] RUN apt-get -y install         ca-certificates         curl         gnupg         lsb-release                              0.0s
 => CACHED [4/9] RUN mkdir -p /etc/apt/keyrings                                                                                             0.0s
 => CACHED [5/9] RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg                0.0s
 => CACHED [6/9] RUN echo       "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.co  0.0s
 => CACHED [7/9] RUN mkdir -p /packages/archives                                                                                            0.0s
 => CACHED [8/9] RUN apt-get -y update                                                                                                      0.0s
 => CACHED [9/9] RUN apt-get -d -y install --no-install-recommends       docker-ce-cli=$(apt-cache madison docker-ce-cli | grep 20.10.17 |  0.0s
 => exporting to image                                                                                                                      0.0s
 => => exporting layers                                                                                                                     0.0s
 => => writing image sha256:0facb56707405fda4249d5d7f7ad51d88a440b42f44e984aec7a0125974fd3ab                                                0.0s
 => => naming to docker.io/kurl/ubuntu-2204-docker:20.10.17                                                                                 0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
+ docker rm -f docker-ubuntu2204-20.10.17
+ docker create --name docker-ubuntu2204-20.10.17 kurl/ubuntu-2204-docker:20.10.17
e118a3a5df6aaff4fe088a3da637e62a535cf173d14039ee81da62824099237f
+ mkdir -p build/packages/docker/20.10.17/ubuntu-22.04
+ docker cp docker-ubuntu2204-20.10.17:/packages/archives/. /Users/camilamacedo/go/src/github.com/replicatedhq/kURL/build/packages/docker/20.10.17/ubuntu-22.04
+ docker rm docker-ubuntu2204-20.10.17
docker-ubuntu2204-20.10.17
➜  kURL git:(main) ✗ make build/packages/docker/20.10.17/ubuntu-22.04
make: `build/packages/docker/20.10.17/ubuntu-22.04' is up to date.
➜  kURL git:(main) ✗ make build/packages/docker/20.10.17/ubuntu-22.04
./bundles/docker-ubuntu2204/build.sh 20.10.17 `pwd`/build/packages/docker/20.10.17/ubuntu-22.04
+ set -e
+ DOCKER_VERSION=20.10.17
+ OUTPATH=/Users/camilamacedo/go/src/github.com/replicatedhq/kURL/build/packages/docker/20.10.17/ubuntu-22.04
+ SEMVER_COMPARE_RESULT=
+ semverCompare 20.10.17 20.10.17
+ semverParse 20.10.17
+ major=20
+ minor=10.17
+ minor=10
+ patch=17
+ patch=17
+ _a_major=20
+ _a_minor=10
+ _a_patch=17
+ semverParse 20.10.17
+ major=20
+ minor=10.17
+ minor=10
+ patch=17
+ patch=17
+ _b_major=20
+ _b_minor=10
+ _b_patch=17
+ '[' 20 -lt 20 ']'
+ '[' 20 -gt 20 ']'
+ '[' 10 -lt 10 ']'
+ '[' 10 -gt 10 ']'
+ '[' 17 -lt 17 ']'
+ '[' 17 -gt 17 ']'
+ SEMVER_COMPARE_RESULT=0
+ '[' 0 = -1 ']'
+ docker build --build-arg DOCKER_VERSION=20.10.17 -t kurl/ubuntu-2204-docker:20.10.17 -f bundles/docker-ubuntu2204/Dockerfile bundles/docker-ubuntu2204
[+] Building 24.1s (12/12) FINISHED                                                                                                              
 => [internal] load build definition from Dockerfile                                                                                        0.0s
 => => transferring dockerfile: 848B                                                                                                        0.0s
 => [internal] load .dockerignore                                                                                                           0.0s
 => => transferring context: 2B                                                                                                             0.0s
 => [internal] load metadata for docker.io/library/ubuntu:22.04                                                                             0.0s
 => [1/9] FROM docker.io/library/ubuntu:22.04                                                                                               0.0s
 => CACHED [2/9] RUN apt-get -y update                                                                                                      0.0s
 => [3/9] RUN apt-get -y upgrade                                                                                                            0.9s
 => [4/9] RUN apt-get -y install apt-utils apt-transport-https ca-certificates curl software-properties-common                             17.2s
 => [5/9] RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -                                                       0.6s 
 => [6/9] RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"                      2.0s 
 => [7/9] RUN apt-get -y update                                                                                                             1.4s 
 => [8/9] RUN mkdir -p /packages/archives                                                                                                   0.2s 
 => ERROR [9/9] RUN apt-get -d -y install --no-install-recommends   docker-ce-cli=$(apt-cache madison 'docker-ce-cli' | grep 20.10.17 | he  1.7s 
------                                                                                                                                           
 > [9/9] RUN apt-get -d -y install --no-install-recommends   docker-ce-cli=$(apt-cache madison 'docker-ce-cli' | grep 20.10.17 | head -1 | awk '{$1=$1};1' | cut -d' ' -f 3)   docker-ce=$(apt-cache madison 'docker-ce' | grep 20.10.17 | head -1 | awk '{$1=$1};1' | cut -d' ' -f 3)   -oDebug::NoLocking=1 -o=dir::cache=/packages/:                                                                                                            
#12 1.210 Reading package lists...
#12 1.625 Building dependency tree...
#12 1.718 Reading state information...
#12 1.722 Package docker-ce is not available, but is referred to by another package.
#12 1.722 This may mean that the package is missing, has been obsoleted, or
#12 1.722 is only available from another source
#12 1.722 However the following packages replace it:
#12 1.722   docker-ce-cli:amd64
#12 1.722 
#12 1.730 E: Unable to locate package docker-ce-cli
#12 1.730 E: Version '' for 'docker-ce' was not found
------
executor failed running [/bin/sh -c apt-get -d -y install --no-install-recommends   docker-ce-cli=$(apt-cache madison 'docker-ce-cli' | grep ${DOCKER_VERSION} | head -1 | awk '{$1=$1};1' | cut -d' ' -f 3)   docker-ce=$(apt-cache madison 'docker-ce' | grep ${DOCKER_VERSION} | head -1 | awk '{$1=$1};1' | cut -d' ' -f 3)   -oDebug::NoLocking=1 -o=dir::cache=/packages/]: exit code: 100
make: *** [build/packages/docker/20.10.17/ubuntu-22.04] Error 1 
camilamacedo86 commented 1 year ago

By checking the code used to build the images (see here ) we can:

# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK
Reading package lists... Done
W: https://download.docker.com/linux/ubuntu/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
root@4a0f3bee93c8:/# mkdir -p /packages/archives
root@4a0f3bee93c8:/# apt-get -d -y install --no-install-recommends \
  docker-ce-cli=$(apt-cache madison 'docker-ce-cli' | grep 20.10.17 | head -1 | awk '{$1=$1};1' | cut -d' ' -f 3) \
  docker-ce=$(apt-cache madison 'docker-ce' | grep grep 20.10.17 | head -1 | awk '{$1=$1};1' | cut -d' ' -f 3) \
  -oDebug::NoLocking=1 -o=dir::cache=/packages/
grep: 20.10.17: No such file or directory
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package docker-ce is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  docker-ce-cli:amd64

E: Unable to locate package docker-ce-cli
E: Version '' for 'docker-ce' was not found
root@4a0f3bee93c8:/# 

The solution is proposed into the PR: #3677