balena-io-modules / balena-preload

Script for preloading containers onto balena device images
https://www.balena.io/
Apache License 2.0
35 stars 8 forks source link

preload fails on github actions #267

Open shawaj opened 2 years ago

shawaj commented 2 years ago

when running balena preload in a github action, it fails with the following output. I guess this is due to trying to run docker inside a docker container so it fails.

any way to fix this?

balena preload balena-base.img --fleet nebraltd/helium-indoor-470 --pin-device-to-release -c current --debug
[debug] new argv=[/opt/balena-cli/balena,/snapshot/versioned-source/bin/balena,preload,balena-base.img,--fleet,nebraltd/helium-indoor-470,--pin-device-to-release,-c,current] length=9
[debug] Deprecation check: 0.00028 days since last npm registry query for next major version release date.
[debug] Will not query the registry again until at least 7 days have passed.

Building Docker preloader image. [                        ] 0%
Step 1/7 : FROM alpine:3.12

 ---> b0925e081921
Step 2/7 : WORKDIR /usr/src/app
Building Docker preloader image. [===                     ] 12%

Building Docker preloader image. [======                  ] 25%
 ---> Running in afb6af93f98a
Removing intermediate container afb6af93f98a

 ---> d687bc67bf54
Building Docker preloader image. [=========               ] 37%
Step 3/7 : RUN apk add --no-cache curl py3-pip parted btrfs-progs util-linux sfdisk file coreutils sgdisk e2fsprogs-extra docker
 ---> Running in f48930b36d86
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
(1/83) Installing libblkid (2.35.2-r0)
(2/83) Installing lzo (2.10-r2)
(3/83) Installing libuuid (2.35.2-r0)
(4/83) Installing zstd-libs (1.4.9-r0)
(5/83) Installing btrfs-progs (5.6.1-r0)
(6/83) Installing libacl (2.2.53-r0)
(7/83) Installing libattr (2.4.48-r0)
(8/83) Installing coreutils (8.32-r0)
(9/83) Installing ca-certificates (20191127-r4)
(10/83) Installing nghttp2-libs (1.41.0-r0)
(11/83) Installing libcurl (7.79.1-r0)
(12/83) Installing curl (7.79.1-r0)
(13/83) Installing libseccomp (2.4.4-r0)
(14/83) Installing runc (1.0.0_rc95-r0)
(15/83) Installing containerd (1.4.4-r0)
(16/83) Installing libmnl (1.0.4-r0)
(17/83) Installing libnftnl-libs (1.1.6-r0)
(18/83) Installing iptables (1.8.4-r2)
(19/83) Installing tini-static (0.19.0-r0)
(20/83) Installing device-mapper-libs (2.02.186-r1)
(21/83) Installing docker-engine (20.10.3-r0)
(22/83) Installing docker-cli (20.10.3-r0)
(23/83) Installing docker (20.10.3-r0)
Executing docker-20.10.3-r0.pre-install
(24/83) Installing libcom_err (1.45.6-r0)
(25/83) Installing e2fsprogs-libs (1.45.6-r0)
(26/83) Installing e2fsprogs (1.45.6-r0)
(27/83) Installing e2fsprogs-extra (1.45.6-r0)
(28/83) Installing libmagic (5.38-r0)
(29/83) Installing file (5.38-r0)
(30/83) Installing ncurses-terminfo-base (6.2_p20200523-r0)
(31/83) Installing ncurses-libs (6.2_p20200523-r0)
(32/83) Installing readline (8.0.4-r0)
(33/83) Installing parted (3.3-r0)
(34/83) Installing libbz2 (1.0.8-r1)
(35/83) Installing expat (2.2.9-r1)
(36/83) Installing libffi (3.3-r2)
(37/83) Installing gdbm (1.13-r1)
(38/83) Installing xz-libs (5.2.5-r0)
(39/83) Installing sqlite-libs (3.32.1-r1)
(40/83) Installing python3 (3.8.10-r0)
(41/83) Installing py3-appdirs (1.4.4-r1)
(42/83) Installing py3-ordered-set (4.0.1-r0)
(43/83) Installing py3-parsing (2.4.7-r0)
(44/83) Installing py3-six (1.15.0-r0)
(45/83) Installing py3-packaging (20.4-r0)
(46/83) Installing py3-setuptools (47.0.0-r0)
(47/83) Installing py3-chardet (3.0.4-r4)
(48/83) Installing py3-idna (2.9-r0)
(49/83) Installing py3-certifi (2020.4.5.1-r0)
(50/83) Installing py3-urllib3 (1.25.9-r0)
(51/83) Installing py3-requests (2.23.0-r0)
(52/83) Installing py3-msgpack (1.0.0-r0)
(53/83) Installing py3-lockfile (0.12.2-r3)
(54/83) Installing py3-cachecontrol (0.12.6-r0)
(55/83) Installing py3-colorama (0.4.3-r0)
(56/83) Installing py3-distlib (0.3.0-r0)
(57/83) Installing py3-distro (1.5.0-r1)
(58/83) Installing py3-webencodings (0.5.1-r3)
(59/83) Installing py3-html5lib (1.0.1-r4)
(60/83) Installing py3-pytoml (0.1.21-r0)
(61/83) Installing py3-pep517 (0.8.2-r0)
(62/83) Installing py3-progress (1.5-r0)
(63/83) Installing py3-toml (0.10.1-r0)
(64/83) Installing py3-retrying (1.3.3-r0)
(65/83) Installing py3-contextlib2 (0.6.0-r0)
(66/83) Installing py3-pip (20.1.1-r0)
(67/83) Installing libfdisk (2.35.2-r0)
(68/83) Installing libsmartcols (2.35.2-r0)
(69/83) Installing sfdisk (2.35.2-r0)
(70/83) Installing libgcc (9.3.0-r2)
(71/83) Installing popt (1.16-r7)
(72/83) Installing libstdc++ (9.3.0-r2)
(73/83) Installing sgdisk (1.0.6-r0)
(74/83) Installing blkid (2.35.2-r0)
(75/83) Installing libcap-ng (0.7.10-r1)
(76/83) Installing setpriv (2.35.2-r0)
(77/83) Installing libmount (2.35.2-r0)
(78/83) Installing findmnt (2.35.2-r0)
(79/83) Installing mcookie (2.35.2-r0)
(80/83) Installing hexdump (2.35.2-r0)
(81/83) Installing lsblk (2.35.2-r0)
(82/83) Installing cfdisk (2.35.2-r0)
(83/83) Installing util-linux (2.35.2-r0)
Executing busybox-1.31.1-r21.trigger
Executing ca-certificates-20191127-r4.trigger
OK: 380 MiB in 97 packages
Removing intermediate container f48930b36d86

 ---> bdd845ffa31c
Building Docker preloader image. [============            ] 50%
Step 4/7 : COPY requirements.txt ./
 ---> 4e60ca918788

Step 5/7 : RUN pip3 install --no-cache-dir -r requirements.txt
Building Docker preloader image. [===============         ] 62%
 ---> Running in 3b27b9870a8e
Collecting sh==1.12.14
  Downloading sh-1.12.14-py2.py3-none-any.whl (38 kB)
Collecting retry==0.9.2
  Downloading retry-0.9.2-py2.py3-none-any.whl (8.0 kB)
Collecting decorator>=3.4.2
  Downloading decorator-5.1.0-py3-none-any.whl (9.1 kB)
Collecting py<2.0.0,>=1.4.26
  Downloading py-1.11.0-py2.py3-none-any.whl (98 kB)
Installing collected packages: sh, decorator, py, retry
Successfully installed decorator-5.1.0 py-1.11.0 retry-0.9.2 sh-1.12.14
Removing intermediate container 3b27b9870a8e
 ---> aa099e4ba9b3
Step 6/7 : COPY src/ ./

Building Docker preloader image. [==================      ] 75%
 ---> ce3570226895
Step 7/7 : CMD ["python3", "/usr/src/app/preload.py"]

Building Docker preloader image. [=====================   ] 87%
 ---> Running in 5aa20a559b3b
Removing intermediate container 5aa20a559b3b
 ---> 97c0388ed7d1
Successfully built 97c0388ed7d1
Successfully tagged balena/balena-preload:latest

Building Docker preloader image. [========================] 100%

(HTTP code 400) unexpected - invalid mount config for type "bind": bind source path does not exist: /github/workspace/balena-base.img 

Error: (HTTP code 400) unexpected - invalid mount config for type "bind": bind source path does not exist: /github/workspace/balena-base.img 
    at /snapshot/versioned-source/node_modules/docker-modem/lib/modem.js:315:17
    at getCause (/snapshot/versioned-source/node_modules/docker-modem/lib/modem.js:345:7)
    at Modem.buildPayload (/snapshot/versioned-source/node_modules/docker-modem/lib/modem.js:314:5)
    at IncomingMessage.<anonymous> (/snapshot/versioned-source/node_modules/docker-modem/lib/modem.js:286:14)
    at IncomingMessage.emit (events.js:203:15)
    at IncomingMessage.EventEmitter.emit (domain.js:448:20)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
From previous event:
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
    at process.topLevelDomainCallback (domain.js:126:23)
From previous event:
    at Preloader.prepare (/snapshot/versioned-source/node_modules/balena-preload/build/preload.js:612:48)
    at PreloadCmd.prepareAndPreload (/snapshot/versioned-source/build/commands/preload.js:296:25)
    at run.Promise (/snapshot/versioned-source/build/commands/preload.js:133:30)
    at new Promise (<anonymous>)
    at PreloadCmd.run (/snapshot/versioned-source/build/commands/preload.js:131:19)
    at process._tickCallback (internal/process/next_tick.js:68:7)

For further help or support, visit:
https://www.balena.io/docs/reference/balena-cli/#support-faq-and-troubleshooting
klutchell commented 2 years ago

Hey @shawaj, I haven't tried this myself so I'm not sure what kind of complications the github runner is throwing into the mix.

Can you share some of your workflow file so I can see how you are getting to this point?