Jenkins pipeline fails with error : "docker : permission deinied" - macos

I'm trying to run my react & nodeJs project on jenkins with docker, to create CI/CD ability. at the moment I just want to make sure it works in the most simple way.
I had an error on the same location at the pipeline with message : "docker:not found"
I've solved it using "-v $(which docker):/usr/bin/docker" when starting jenkins.
Now - I understand I need permission for jenkins to use docker, and I found this terminal command line that should solve it: "usermod -G docker -a jenkins" and I get an error (on a Mac) : "zsh: command not found: usermod"
any help would be appreciated, to modify or replace this line, or another idea that might work. thanks !

Mac does not come with the passwd package that contains usermod. An alternative to managing user groups is described here. usermod equivalent in OSX

Related

_heroku:2: HEROKU_AC_ANALYTICS_DIR: parameter not set

I installed heroku cli via snap (sudo snap install heroku --classic), but the autocomplete does not work throws an error: _heroku:2: HEROKU_AC_ANALYTICS_DIR: parameter not set, never encountered this before, who knows what could be the problem?
i`m using the zsh command shell
Try this solution:
https://devcenter.heroku.com/articles/heroku-cli-autocomplete
heroku update
heroku autocomplete
Worked for me.
UPD:
Run the following after commands above (heroku asks to do this after running them anyways):
printf "$(heroku autocomplete:script zsh)" >> ~/.zshrc; source ~/.zshrc

Is there an alternative to usermod on MacOS?

I want to build a docker image natively on a shell runner:
So I've been trying to register a GitLab runner with a shell executor on my local (MacOS) to build and run a docker image using this link:
https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-the-shell-executor
I have to run this command: sudo usermod -aG docker gitLab-runner to grant permissions to gitLab-runner.
However usermod doesn’t work on mac anymore, so I tried to follow a few StackOverflow links which told me to use sudo or dscl. None of them seem to be working.
The error I’m getting on the pipeline :
mkdir: /builds/ht8y-6qs/0/webapp.tmp: Read-only file system
Does anyone know a workaround?
Ps: I know the best way to do this would be inside a layer of virtualization but I still want to figure this out

the command ./vendor/bin/sail up didn't work in a laravel project

I'm new to laravel and docker I need to use it but when I run the command " ./vendor/bin/sail up " an error displayed
/bin/bash: C:\xampp\htdocs\Laravel\management-app\vendor\bin/../laravel/sail/bin/sail: No such file or directory
I don't understand Where does the problem come from, can anyone have any idea, Thanks.
You need to run this command from WSL2 instead of Windows. You can install any Linux distro, for example, Ubuntu 20.04 and run this command from there.

Using AWS CLI with MobaXterm on Windows

I am a newbie to both AWS and MobaXterm. I am trying to use MobaXterm to manage AWS instances because it comes with bash.
I am following the commands as per https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html.
When I run the following command $ sudo ./aws/install, I get the following error:
Unable to start 'install': There is no application associated with the
given file name extension.
I did run chmod 777 to ensure that I am able to read/write/execute. Please see attached image.
I do know that I can use Windows CLI installer in command line. However, doing SSH to EC2 is a nightmare in Windows with all certificates. With MobaXterm (because of bash), it is very easy. So, my preference is to use MobaXterm instead of Windows command prompt.
Moreover, I don't want to directly install Ubuntu. Hence, I am looking for some guidance here. I'd appreciate any help.
I am hoping that I am not missing any package. Thanks for any help.
In order for AWS cli to run on MobaXterm, you will need to run the following commands in MobaXterm:
MobApt install python2-pip
pip2 install awscli
It will take some time for MobaXterm to complete steps 1 and 2. Also, AWS cli runs super slow in MobaXterm. You are better off using cmd.
This is the site that helped me ran AWS cli on MobaXterm.
https://majornetwork.net/2017/07/installing-aws-cli-on-cygwin/

Running ios-sim with Jenkins

I'm trying to start my app from the command line using ios-sim but this is what I get:
Started by user User
Building in workspace /Users/Shared/Jenkins/Home/jobs/UI Testing/workspace
[workspace] $ /bin/sh -xe /var/folders/h4/ws64t3bx2nnds4pg3345xrr000009c/T/hudson6341279754557259451.sh
+ /Users/myUser/Desktop/ios-sim launch /Users/Shared/Jenkins/Home/jobs/Project_Monkey_Build/workspace/build/Debug-iphonesimulator/ProjectMonkey.app
[DEBUG] Could not start simulator session: Error Domain=DTiPhoneSimulatorErrorDomain Code=5
"Operation failed with underlying error 4294956486." UserInfo=0x1001b1760
{NSLocalizedDescription=Operation failed with underlying error 4294956486.,
NSUnderlyingError=0x1001a3390 "The operation couldn’t be completed. (OSStatus error -10810.)"}
It looks like a permission problem as I can run the same command from terminal and it works fine. I've also tried to give full 777 permission to ios-sim and the MonkeyTalk directory,but still nothing.
Any idea?
It might be related to the Jenkins process not having a "display". Try running Jenkins as a user logged in to the desktop, then run the ios-sim again.
Unload Jenkins from launchd:
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
Then run Jenkins from a terminal:
sudo su jenkins -c "JENKINS_HOME=/Users/Shared/Jenkins/Home /Library/Application\ Support/Jenkins/jenkins-runner.sh"
If this works, you can make Jenkins always run as a logged in user by moving the launchd job config file from /Library/LaunchDaemons/org.jenkins-ci.plist to ~/Library/LaunchAgents/org.jenkins-ci.plist
I know this post was from a while ago, and not sure if anyone is checking it, but I also ran into this issue recently and it turned out that there was a duplicate app already in the iphone simulator creating an issue and not letting the new app run.
I reset the simulator and it then worked. I then added the applescript to reset the simulator each time before running ios-sim. this script can be found here...
How can I reset the iOS Simulator from the command line?
Scroll down the answer that has 13 up votes next to it, not the one that was checked marked.
Hope this helps someone in the future..
It looks like the only workaround it's to run the command as super user:
sudo /Users/myUser/Desktop/ios-sim launch /Users/Shared/Jenkins/Home/jobs/Project_Monkey_Build/workspace/build/Debug-iphonesimulator/ProjectMonkey.app
I was also facing the same problem and found that jenkins user is not correctly set up to run test case on simulator. Follow instruction given on below website:
http://pivotallabs.com/ios-ci-jenkins/
see the section "SETTING UP THE JENKINS USER".
hope it will work for you as well.

Resources