New CircleCI user here. I’ve been struggling trying to execute a mkdir command. The step exits successfully in my workflow, but the folder is not created. I’m unable to locate it anywhere in the file system.
Here’s my config.yml file, up to and including the step in question. I removed the rest for the sake of brevity. Note: Changing the shell was another troubleshooting step, though it yielded the same (missing) result.
Hmm, OK. Can you add a ls -l /var/user_image as a second line to the last run step?
Check the stdout in the build logs too, in case there is a filing system or parameter error. Edit: ah, it comes back with Unix code zero - which is fine.
#!/bin/bash -eo pipefail
sudo mkdir -m 0755 -p /var/user_image
ls -l /var/user_image
total 0
Exited with code 0 and the full workflow completed. It appears the directory is being created, although I don’t know what happens after that.
Perhaps my config has it treated as a temporary directory only? I wouldn’t have thought so, given what I’ve seen in my research (e.g., stalking other people’s configs), but perhaps I missed something critical.
Hmm, not seen that before. You’re in a Docker container, so there might be some permission issues. I would suggest dropping the -m temporarily, and perhaps the sudo too.
In fact I wonder if you could take out all of the sudo from this config - your runtime user should have enough permissions to install things without that.
I just realized the problem: it was one of expectations. I AM a newb, after all! I was looking for the directory on the production server, but telling CircleCI to build it in the container. Well, no wonder I couldn’t find it in the server!
I believe what I need to do now is figure out how to SSH into the production server from my container during the workflow, then create the folder.
In the end, I over-complicated this and misunderstood the process.
My goal was to create a directory on my application server, which was hosted in Elastic Beanstalk. Although I wanted to create the directory on the server, the commands I was using in my config.yml file were creating the directory in the container. CircleCI behaved perfectly fine. I didn’t!
Instead, I simply needed to add the command to the config file located in my .ebextensions source folder.
Here’s the full config file from the .ebextensions folder, for anyone else who runs across this.