Building snaps without `snapd`

I could successfully build snap from Travis CI https://travis-ci.org/yakshaveinc/linux/builds/528809947#L585

I still don’t really understand what is going on there. Starting from original instructions.

curl -L $(curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/core' | jq '.download_url' -r) --output core.snap
  1. ^ Downloads core.snap from snapcraft API
mkdir -p /snap/core && unsquashfs -d /snap/core/current core.snap && rm core.snap
  1. ^ Unpack core.snap to /snap/core/current
curl -L $(curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/snapcraft?channel=stable' | jq '.download_url' -r) --output snapcraft.snap && \
  mkdir -p /snap/snapcraft && unsquashfs -d /snap/snapcraft/current snapcraft.snap
  1. ^ Downloads snapcraft from API and “install” it the same way
COPY bin/snapcraft-wrapper /snap/bin/snapcraft
  1. ^ Add some hacking to make unpacked snapcraft run is familiar environment

What I don’t understand is that I don’t download core18 and yet snap builds successfully. If it detected that it runs on Ubuntu 18.04, then it would be nice to see this as a message.