Workspace not attaching when using circleci cli locally


I am trying to debug a failing test in our project and for that I am running the failing test locally.
The process kind of works, but I am getting an error which - as I understand - is because it didn’t attach the workspace to the docker container.
Here is the error/proplematic part:

Making checkout directory "/home/circleci/project"
Copying files from "/tmp/_circleci_local_build_repo" to "/home/circleci/project"
====>> Attaching Workspace (skipped)
Warning: skipping this step: Missing workflow workspace identifiers, this step must be run in the context of a workflow

All those paths seem to be inside docker, at least they don’t exist on my system.
And it’s says it’s skipping the attach step, which seems a problem to me.

Here is my command:

/snap/circleci/current/circleci local execute -c process.yml  --job t_native_test_ext_ens
Fetching latest build environment...
Docker image digest: sha256:647a869b9ea97a714bbbd5e7cb38833bbc66d5a4501a21ac9423a348898cec8d
====>> Spin up environment
Build-agent version  ()
System information:
 Server Version: 20.10.12
 Storage Driver: overlay2
  Backing Filesystem: extfs
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Kernel Version: 5.4.0-120-generic
 Operating System: Ubuntu 20.04.4 LTS
 OSType: linux
 Architecture: x86_64

Starting container circleci/node:16
Warning: No authentication provided, using CircleCI credentials for pulls from Docker Hub.
  image is cached as circleci/node:16, but refreshing...
  using image circleci/node@sha256:1803e9ed7deec9456ad2609124b7333d40b2eec0cf34998ae766cbf90c9a3625
  pull stats: Image was already available so the image was not pulled
  time to create container: 10ms
Creating Docker containers in parallel
16: Pulling from circleci/node
Digest: sha256:1803e9ed7deec9456ad2609124b7333d40b2eec0cf34998ae766cbf90c9a3625
Status: Image is up to date for circleci/node:16
Time to upload agent and config: 275.337402ms
Time to start containers: 304.353775ms
WARN: Missing API Key.
====>> Preparing environment variables
Using build environment variables:

The redacted variables listed above will be masked in run step output.====>> Checkout code
Making checkout directory "/home/circleci/project"
Copying files from "/tmp/_circleci_local_build_repo" to "/home/circleci/project"
====>> Attaching Workspace (skipped)
Warning: skipping this step: Missing workflow workspace identifiers, this step must be run in the context of a workflow
====>> Install lsof
  #!/bin/bash -eo pipefail
# lsof is used by Colony in its script
sudo apt-get --quiet --assume-yes --no-install-recommends install lsof

Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 319 kB of archives.
After this operation, 465 kB of additional disk space will be used.
Get:1 buster/main amd64 lsof amd64 4.91+dfsg-1 [319 kB]
Fetched 319 kB in 0s (2188 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package lsof.
(Reading database ... 27337 files and directories currently installed.)
Preparing to unpack .../lsof_4.91+dfsg-1_amd64.deb ...
Unpacking lsof (4.91+dfsg-1) ...
Setting up lsof (4.91+dfsg-1) ...
====>> External ens tests (native)
  #!/bin/bash -eo pipefail
test/externalTests/ native /tmp/workspace/build/solc/solc

The compiler binary does not exist at '/tmp/workspace/build/solc/solc'

So, after investigating further:

I need to provide a compiled binary for that test (I have it) and I need to provide it to the container.
I can’t use attach_workspace or persist_to_workspace as those commands don’t seem to work locally.
So now I am looking for how to provide the binary to the docker instance…

The warnings all relate to what you have expressed in your process.yml file as running a circleci pipeline locally has a number of limitations that are detailed here

From what you have posted it would seem that process.yml contains a workflow, which can not be correctly configured as the wider CircleCI eco-system is not available to define the environment needed. The result is that you will have to modify your process.yml so that it contains a single job, rather than a workflow.

I mean, I understood that all the workflow commands are ignored, but to fix this the “proper” way would be to put the whole building of the binary in the test.

All I really need is a simple way to copy a binary into that local docker, right?

That was the bit I was not sure about - as the process.yml was not executing correctly I did not know where ‘/tmp/workspace/build/solc/solc’ was coming from.

As you do not have access to attach_workspace/ persist_to_workspace yes you need to move the binary around using a different tool set - depending on your environment (and the size of the binary) git or FTP via a central server would be good solutions within the container.

If you are doing local tests the use of a workspace may not be a good solution anyway as it incurs egress fees from the CircleCI based on the amount of data transferred.