GitLab CI builds remains pending - gitlab

We recently started to use GitLab-CI on the gitlab.com free service.
At first everything went fine, but now, seems like we can't build our project anymore. The builds are shown as pending and doesn't do anything.
Here's what we have in our builds list:
And if we check the details of a build:
As you might notice, in the list, each build is assigned to a runner id, but in the details page, the runner section is blank.
At first, we thought it was just latency caused by gitlab.com ingrastructure, but it's really just stuck there...
EDIT
It's more than 1 year ago but I keep having notifications about this question. If I recall properly, the problem was due to GitLab itself. Follow the GitLab docs and make sure your setup is valid, and hope for the best !

If you are working with local gitlab-runner, like macOS or custom runner that you have been made, you should start running jobs manually.
Based on this topic on gitlab documentation you should start manually in user-mode or system-mode based on where you executing this command
Run in terminal
If you did not started gitlab-runner yet
gitlab-runner start
system-mode execution
sudo gitlab-runner run
user-mode execution
gitlab-runner run

I was stuck into same issue on my windows machine. I went to event viewer to get some logs of the service and found the error "listen_address not defined".
I followed below steps to fix it.
Go to gitlab repository and edit the runner settings.
You will find checkbox named "Indicates whether this runner can pick jobs without tags"
Make sure the option is checked.
It works for me now.

My problem was solved after doing the following steps:
Go to your project repository, click on CI/CD and then select pipelines. Try removing the runner cache by clicking on clear runner caches.
Verify, start and run your local runners by the doing the following steps on the server you have registered your runners:
sudo gitlab-runner verify
sudo gitlab-runner start
sudo gitlab-runner run

GitLab maxed out their shared runners but they have just finished adding more of them. Now GitLab has 12 shared runners. Take a look at this issue: https://gitlab.com/gitlab-org/gitlab-foss/issues/5543#note_3130561
Update
GitLab has moved to auto scaling Runners. If you're still hitting any issues it might be due to a different cause.

Try to clear the Runner cache if you have set it up.
Goto CI/CD>>Pipelines>>on top side >> clear Runner Caches

For me, this workaround worked: Pausing and unpausing the runner triggers the pending job to run.
Reference: https://gitlab.com/gitlab-org/gitlab/-/issues/23401

I had the same issue because there were no active runners.
Go to settings > CI CD > Enable shared runners for this project

Related

Gitlab No repository

Gitlab all of sudden showing no repository message on different repo. I am using docker-compose to run docker ce. I can see on file system on host machine as well as on docker container repository contain data in #hashed folder. I am able to see my ci/cd pipeline and images in container registry. but I am not able to see all my source code in repository. I have try clearing cache and run the gitlab reconfigure command. but not solve the issue.
can anyone know what could be the reason of this kind of behavior.

Github Codespaces - Could not detect the platform/language from repo

I'm trying to open this repository using Github Codespaces. Note that this repository is correctly configured for local devcontainer development.
However, when I try to open it in CodeSpaces, it seems to build the container correctly, but fails with:Could not detect any language/platform in the source directory (full log here)
What am I missing?
It looks like you may have run into a regression that Codespaces had during the time specified in your log file.
Given your configuration, Oryx should no longer run, which means you should no longer run into this issue.
Would you mind retrying?

Cannot install inside docker container

I'm quite new at docker, but I'm facing a problem I have no idea how to solve it.
I have a jenkins (docker) image running and everything was fine. A few days ago I created a job so I can run my nodejs tests every time a pull request is made. one of the job's build steps is to run npm install. And the job is constantly failing with this error:
tar (child): bzip2: Cannot exec: No such file or directory
So, I know that I have to install bzip2 inside the jenkins container, but how do I do that? I've already tried to run docker run jenkins bash -c "sudo apt-get bzip2" but I got: bash: sudo: command not found.
With that said, how can I do that?
Thanks in advance.
Answer to this lies inside the philosophy of dcoker containers. Docker containers are/should be immutable. So, this is what you can try to fix this issue.
Treat your base image i.e, jenkins as starting point.
login to this base image and install bzip2.
commit these changes and this should result in a new image.
Now use above image from step 3 to install any other package like npm.
Now commit above image.
Note: To execute commands in much controlled way, I always prefer to use something like this;
docker exec -it jenkins bash
In nutshell, answer to both of your current issues lie in the fact that images are immutable so to make any change that will get propagated is to commit them and use newly created image to make further changes. I hope this helps.
Lots of issues here, but the biggest one is that you need to build your images with the tools you need rather than installing inside of a running container. As techtrainer mentions, images are immutable and don't change (at least from your running container), and containers are disposable (so any changes you make inside them are lost when you restart them unless your data is stored outside the container in a volume).
I do disagree with techtrainer on making your changes in a container and committing them to an image with docker commit. This will work, but it's the hand built method that is very error prone and not easily reproduced. Instead, you should leverage a Dockerfile and use docker build. You can either modify the jenkins image you're using by directly modifying it's Dockerfile, or you can create a child image that is FROM jenkins:latest.
When modifying this image, the Jenkins image is configured to run as the user "jenkins", so you'll need to switch to root to perform your application installs. The "sudo" app is not included in most images, but external to the container, you can run docker commands as any user. From the cli, that's as easy as docker run -u root .... And inside your Dockerfile, you just need a USER root at the top and then USER jenkins at the end.
One last piece of advice is to not run your builds directly on the jenkins container, but rather run agents with your needed build tools that you can upgrade independently from the jenkins container. It's much more flexible, allows you to have multiple environments with only the tools needed for that environment, and if you scale this up, you can use a plugin to spin up agents on demand so you could have hundreds of possible agents to use and only be running a handful of them concurrently.

Jenkins tfs plug-in and checkout source on remote node

First, I'm a Jenkins neophyte. I have made a free-style software project in Jenkins to perform my Linux build. The Jenkins server is running on Windows so there are slave nodes configured for doing this Linux build. The sources are kept in a TFS server.
I updated our TFS plugin to the latest of 4.0.0. This plugin says that it is no longer necessary for slave nodes to have the Team Explorer Everywhere package installed as it uses the Java API. However, when I kick off my build, I get this:
Started by user Andy Falanga (afalanga)
[EnvInject] - Loading node environment variables.
Building remotely on dmdevlnx64-01 (PY27-64 CENTOS6-64 LOG4CPLUS PY26-64) in workspace /home/builder/jenkins/workspace/Linux Autotools Build
Deleting project workspace... done
Querying for remote changeset at '$/Sources/Branches/Andy/AutotoolsMigration' as of 'D2015-10-05T18:26:27Z'...
Query result is: Changeset #4872 by 'WINNTDOM\afalanga' on '2015-09-25T23:36:24Z'.
Listing workspaces from http://ets-tfs:8080/tfs/SoftwareCollection...
... Long list of workspaces
Workspace Created by Team Build
Getting version 'C4872' to '/home/builder/jenkins/workspace/Linux Autotools Build'...
Finished getting version 'C4872'.
[Linux Autotools Build] $ /bin/bash /tmp/hudson7081873611439714406.sh
Bootstrapping autotools
/tmp/hudson7081873611439714406.sh: line 4: ./bootstrap: No such file or directory
Build step 'Execute shell' marked build as failure
Notifying upstream projects of job completion
Finished: FAILURE
I log into that system and look in the directory /home/builder/jenkins/workspace/Linux Autotools Build and sure enough, there's nothing there. My configuration is pretty simple.
I have discard old builds checked and a simple rotation (this is just me learning how to use it).
I have it set to "Restrict where the build is done" and a label which associates to the 3 slave nodes for doing this build.
All TFS credentials are input and correct.
No build triggers
A simple shell script for Build->Execute Shell which bootstraps the autotools and calls configure and then make.
What am I doing incorrectly?
I found the answer and am posting it here in case someone runs into this. This seems better than simply deleting the question. The TFS plugin doesn't seem to like spaces in the project name. The name before Linux Autotools Build which didn't work and the name now, LinuxAutotoolsBuild which does.
The errors provided by the Jenkins system didn't provide enough information for this to be apparent. After trying a few other things the thought occurred, "Perhaps the spaces are causing grief."
Hope this helps someone.

Custom GitLab login page

I'm looking to do some minimal GitLab CE customization by using my own image assets:
brand_logo.png, favicon.ico, logo-black.png, logo-white.png
I ran into:
https://kovah.me/customize-gitlab-installation/
http://axilleas.me/en/blog/2014/custom-gitlab-login-page/
I want to avoid the approach in the former as I'd prefer not to mess with any files other than the image fails. I tried the approach on the latter, but couldn't get it to work with my omnibus install (Ubuntu 12.04). I get a flurry of errors when trying to recomplie assets.
Any tips?
Currently, gitlab-ce allows to modify the text and logos on the page see branded login for more info.
When editing, there was a discussion about allowing to change the favicon.
If you need to make more aggressive modifications, see below.
Old answer:
If you don't have any plans on upgrade the gitlab (or you don't mind on repeating this process everytime you upgrade) try the following:
Modify the desired assets, the path is:
/opt/gitlab/embedded/service/gitlab-rails/app/assets/images/
after it, clean the assets cache:
gitlab-rake assets:clean RAILS_ENV=production
and generate them (I had some permissions errors with this one, nothing that a chmod 777 couldn't fix, just try to revert them back to its original state)
gitlab-rake assets:precompile RAILS_ENV=production
and finally a restart
sudo gitlab-ctl restart
the second link is mine :)
I was gonna write a post about custom login in omnibus but if you really want to do this the right way, you'd have to build your own omnibus package. Basically, it sums up to this:
Follow my post to make any custom changes and push to a branch in github or your gitlab repo.
Clone omnibus-gitlab, edit config/software/gitlab-rails.rb to reflect your custom login commit and git repo from step 1 and follow the instructions to build the package.
You can see the what I changed here.

Resources