Jenkins CI - SSL CA error - azure

NOTE: This is .NET Core on Linux (Ubuntu)
I am setting up some CI infrastructure for .NET Core code and am running into a strange issue. Specifically, when it comes to package restore (dotnet restore).
The Jenkins instance that I am running is hosted on Azure via a Bitnami Jenkins image. In my build, I have a number of build steps. One of them (the one that actually triggers dotnet restore) is an Execute Shell.
When I run whoami from it, I get that I am the user tomcat. When dotnet restore is triggered from within the build step, however, I get the following error:
06:22:37 log : Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/system.runtime.serialization.primitives/index.json'.
06:22:37 log : An error occurred while sending the request.
06:22:37 log : Problem with the SSL CA cert (path? access rights?)
That same issue does not happen if I SSH into the box and do a sudo su - tomcat - running dotnet restore on the same folder from a SSH session works, while doesn't work in the Execute Shell step (despite the fact that both run in the same user context).
What am I missing that might be causing this?

Related

Gitlab: There has been a runner system failure

I use Gitlab for doing Continuous Integration and Development and all of a sudden I get this error message "There has been a runner system failure, please try again"
There's no real error message or error code.
I've tried restarting the gitlab runner, using gitlab-runner restart, I've done a reboot of the server its running on but I keep getting this error message on Gitlab whenever I push a code change.
After a couple of hours, I realized the issue is that the server that Gitlab Runner is running on has no space left.
I logged into the server in question. Looked at the Gitlab log file using the following command:
journalctl -u gitlab-runner
And it showed me the following logs:
May 21 08:20:41 gitlab-runner[18936]: Checking for jobs... received job=178911 repo_url=https://.......git runner=f540b942
May 21 08:20:41 gitlab-runner-01 gitlab-runner[18936]: WARNING: Failed to process runner builds=0 error=open /tmp/trace543210445: no space left on device executor=docker runner=f540b942
To fix this issue I ran docker conatiner prune which clears out stopped containers.
Alternatively you could use docker system prune which would remove all unused objects.
See https://linuxize.com/post/how-to-remove-docker-images-containers-volumes-and-networks/ for more information about those docker commands.
Afterwards, I no longer got the error on Gitlab when pushing changes.

Kentico Continuous Integration - Login failed for user

I'm trying to get Kentico Continuous Integration running as a step in my CI process. However, I'm encountering the following error when my deployment script runs:
Running Kentico Continuous Integration...
Continuous Integration Console
Kentico Software
System.Exception: Login failed for user 'MACHINE-NAME\ci-runner-user'.
at CMS.DataEngine.CMSApplication.ReportApplicationError(String message)
at CMS.DataEngine.CMSApplication.Init()
at CMS.ContinuousIntegration.ConsoleApp.Program.InitKenticoApplication(String webAppPhysicalPath)
at CMS.ContinuousIntegration.ConsoleApp.Program.Deserialize(String webAppPhysicalPath)
at CMS.ContinuousIntegration.ConsoleApp.Program.Main(String[] args)
How do I enable the local user my deployment script runs as to successfully execute ~\CMS\bin\ContintinuousIntegration.exe -r?
My initial thought is that you’re using integrated security in the web.config - make sure that the user you mention has SQL access for your Kentico DB
You need to allow PowerShell ISE to run unrestricted. To do so follow these instructions:
Install or make sure PowerShell ISE is installed
Run PS as Administrator
First time only - run this command in PS ISE, "Set-ExecutionPolicy Unrestricted". It should show LocalMachine as Unrestricted. This will allow you to execute the script for CI Restore

How to deploy my Node server to ec2 using Jenkins?

I have probably been Googling this the wrong way...
I have a Node express server.
I want to deploy it using Jenkins to ec2.
What are my options?
if I want to upload the code manually, I use ssh... but I want it to
be done from Jenkins.
Yes the server is on a git repo.
I would like a devops flow
I recommend you , to do it step by step :
Step 1 : Configure correctly a jenkins job ready to build your app in remote ec2 machine.
Install this plugin in your jenkins platform : Publish Over SSH Plugin
Using this plugin add new remote server under Publish over SSH section in Manage Jenkins >> Configure System option.
Now create some jenkins job. Then, in build section add a step called : Send files or execute commands over SSH
Just select your configured server and enter your commands in Exec command section :
For a simple node js express, this code could be enough or just copy-paste your existing code:
https://gist.github.com/jrichardsz/38b335f6a5dc8c67a386fd5fb3c6200e
That is all. Just test with "build" option and verify if your application goes well.
At this point, this job is functional. The flow could be :
push your changes to your git provider
login to jenkins and manually execute the created job (this step is replaced with webhook configuration)
Note: If and only if this step has no errors, you can start with the following step.
Step 2 : Implement a simple devops flow by configuring a webhook in your git provider, which automatically triggers the jenkins job (create in step 1) when you perform a git push.
This guide could be help you with the required configurations :
https://jrichardsz.github.io/devops/devops-with-git-and-jenkins-using-webhooks
You'll have to use AWS CodeDeploy jenkins plugin. This apply to any type of code. Node, java etc
See AWS article
Setting Up the Jenkins Plugin for AWS CodeDeploy
Jenkins Plugin
Github Link

docker build is not able to connect to http server even though it is accessible on the command line

We have a Dockerfile that contains a command of the form
RUN dotnet restore --no-cache -s http://localhost:8081/repository/nuget-hosted/
When we run
docker build .
The error encountered at this line is
Retrying 'FindPackagesByIdAsyncCore' for source 'http://localhost:8081/repository/nuget-repo-name/FindPackagesById()?id='Package.Name''.
An error occurred while sending the request.
Couldn't connect to server
/usr/share/dotnet/sdk/2.1.101/NuGet.targets(104,5): error : Failed to retrieve information about 'Package.Name' from remote source 'http://localhost:8081/repository/nuget-repo-name/FindPackagesById()?id='Package.Name''.
However, when we run this same command on the command line, the dotnet restore is successful.
The nuget server in question is running on the same machine. If we hit the same URL in the browser, it is a success.
How do we make the nuget server running at localhoat:8081 accessible within docker build so that the docker image gets created successfully?
As mentioned by https://stackoverflow.com/users/1080064/tkausl replacing http://localhost:8081/repository/nuget-hosted/ with http://1.2.3.4:8081/repository/nuget-hosted/ where 1.2.3.4 is the actual ip address solved the issue.

GitLab-CI Multi Runner can't fetch gitlab repo and returns http error

I am using Gitlab-CI-Multi-Runner on Windows (64 bit), and have configured it to run with the default shell. The connectivity with the Gitlab server is fine, but when it tries to run a build, it is cloning the repository using HTTP endpoint. My repo is quite big, and the Gitlab NGINX fails with an error. SSH endpoint works perfectly.
How do I make my GitLab-CI-Multi-Runner use the SSH endpoint when cloning the repo for executing a build?
Note: The same problem existed with the older Gitlab-CI-Runner for Windows which was written using C#.
The problem is related to the timeout of the unicorn engine workers, that is too short to allow big repositories to be cloned/pushed.
in /etc/gitlab/gitlab.rb uncomment and set
unicorn['worker_timeout'] = 1200
(hopefully enough).
then issue
# gitlab-ctl reconfigure
# gitlab-ctl restart
that works for me.

Resources