sudo apt install in github action - continuous-integration

In one of the project I work on, I use graphviz for visualization and have test code for this functionality.
But to test the code graphviz must be installed. I setup CI as the github action.
But I couldn't manage to install graphviz as the github action.
We have the following yml
name: test
on: push
jobs:
test_coverage:
name: Test Software
runs-on: ubuntu-latest
steps:
# See: https://github.com/actions/checkout
- uses: actions/checkout#v3
- name: Setup Graphviz
run: |
sudo apt-get -y install graphviz
But it fails with
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
I am using Github Enterprise, if this means anything.
How can I fix such an issue?
Thanks.

Check first which users is executing that command:
run: |
id -a
sudo apt-get -y install graphviz
Said user is probably not added to the sudoers.
Yet, the GitHub Actions documentation mentions:
The Linux and macOS virtual machines both run using passwordless sudo. When you need to execute commands or install tools that require more privileges than the current user, you can use sudo without needing to provide a password.
For more information, see the "Sudo Manual."
Check if this works better with:
runs-on: ubuntu-20.04
# or
runs-on: ubuntu-22.04
For the OP dragon-and-dracula, in the comments:
I ended up using my own container that got the graphviz preinstalled.
I think the main reason for the error was because something about GitHub Enterprise.

Related

Travis CI runs only on Pull Requests and in Expected for Branch

I have two builds at the same time when doing PR.
According to docs, that could be turned off via web interface
I turned that off (want to have only PR build) and also added only to .travis.yml, but still have two builds, but now branch builds just in expecting stage. In web UI Travis - no more builds for branch created.
branches:
only:
- master
language: python
os: linux
dist: xenial
jobs:
include:
- name: pytest
python:
- 3.7
install:
- pip install -U pip
- pip install -U pytest
- pip install -U PyYAML
- pip install -U Cerberus
script:
- pytest -vvs
It seems like this was the issue
https://travis-ci.community/t/known-issue-travis-ci-reports-expected-waiting-for-status-to-be-reported-on-the-github-status-api-but-the-status-never-arrives/1154
You can filter your jobs using conditional checks like:
- stage: build
name: "build pull request"
if: type IN (pull_request)
install:
echo 'Building pull request';
...
Each step inside this stage will only execute on PR builds.

Disable GitLab Letsencrypt as option when installing for first time

When I install GitLab Omnibus on Ubuntu-18.04 I am hitting a LetsEncrypt problem. The certs won't be issued.
This results in GitLab using a self-singed cert. I want to install my own certs so don't need Let's Encrypt at all.
I can disable it once GitLab is installed by adding this to /etc/gitlab/gitlab.rb
letsencrypt['enable'] = false
and then adding my certs in the correct place and then reconfigure.
Is it possible to pass a gitlab.rb file into the initial installation process with the above line so it doesn't even bother with LetsEncrypt on installation?
I am installing by:
sudo EXTERNAL_URL=<my url> apt-get install gitlab-ee
so I am looking for something like:
sudo EXTERNAL_URL=<my url> CONFIG=<path to local gitlab.rb> apt-get install gitlab-ee
EDIT: I believe the initial Lets Encrypt error issue is this one:
https://gitlab.com/gitlab-org/omnibus-gitlab/issues/4900
I took a cue from the docker installation instructions and passed the GITLAB_OMNIBUS_CONFIG variable like this:
sudo GITLAB_OMNIBUS_CONFIG="letsencrypt['enable'] = false" apt-get install gitlab-ce
Hope it helps.
Using the GITLAB_OMNIBUS_CONFIG did not work for me, at least not with yum on rhel 7. For a workaround, I specified an http instead of https url:
sudo EXTERNAL_URL=http://<my-url> yum install -y gitlab-ee #or apt-get
Then change to https, disable letsencrypt, and add the certs in the configuration after the installation and reconfigure.

Ansible pass value to installation commandline gui

How do I pass value to the commandline-gui prompt?
Like I typically install LAMP on a fresh Ubuntu using the following command.
sudo apt-get install lamp-server^ phpmyadmin
And during install I am asked for a few inputs as below
So how do I pass/input values from a playbook?
When using Ansible, you would generally install the packages non-interactively, like this [1]:
- command: apt-get -y install lamp-server^ phpmyadmin
environment:
DEBIAN_FRONTEND: noninteractive
This will suppress any interactive configuration prompts during the
install. You can then perform configuration tasks after the fact using
Ansible, either by directly manipulating files etc. or by using the
debconf module.
If you're not familiar with debconf, this question has some information about interacting with the package configuration system.
[1] Actually, you would more often use the package module, but that doesn't support package groups like lamp-server^.

Synapse Home server(Matrix) not running

I have installed synapse using the following commands:
link: https://github.com/matrix-org/synapse
Installing prerequisites on Mac OS X:
xcode-select --install
sudo easy_install pip
sudo pip install virtualenv
brew install pkg-config libffi
To install the synapse homeserver run:
virtualenv -p python2.7 ~/.synapse
source ~/.synapse/bin/activate
pip install --upgrade setuptools
pip install https://github.com/matrix-org/synapse/tarball/master
Generate a configuration file
cd ~/.synapse
python -m synapse.app.homeserver \
--server-name my.domain.name \
--config-path homeserver.yaml \
--generate-config \
--report-stats=yes
To get started, it is easiest to use the command line to register new users:
$ source ~/.synapse/bin/activate
$ synctl start # if not already running
$ register_new_matrix_user -c homeserver.yaml https://localhost:8448
New user localpart: user123
Password:
Confirm password:
Server started successfully, but user registration failed and
i opened "https://localhost:8448" in the browser and i got the following:
Can anybody help to solve this?
Your homeserver is probably not starting correctly. Try to get the JSON response about supported versions by executing following in you shell:
curl https://localhost:8448/_matrix/client/versions -k
This should result in a JSON response listing protocol versions:
{
"versions": [
"r0.0.1",
"r0.1.0",
"r0.2.0"
]
}
If that's not working - to find out the real issue you can try:
Check if it's running at all with sudo service matrix-synapse status
Check the log file at /var/log/matrix-synapse/homeserver.log
I will update the answer, in case you can provide more details.
The web client should be accessible at the following URL:
https://localhost:8448/_matrix/client/
However the documentation states:
(The homeserver runs a web client by default at
https://localhost:8448/, though as of the time of writing it is
somewhat outdated and not really recommended -
https://github.com/matrix-org/synapse/issues/1527).
You should use a client such as the one at https://riot.im/app/

The git user is unable to execute bundle during GitLab installation

I am trying to install GitLab on a Debian Wheezy and experiencing an issue I don't understand.
Following the install guide for version 5.0:
step 1: was run as explained
step 2: I used rvm (multi-user install) instead (ruby-1.9.3-p392)
steps 3 to 5: were run as explained (MySQL chosen)
step 6: everything works fine until the "Install Gems" section, where I get the following error:
/home/git/gitlab$ sudo -u git -H bundle install --deployment --without development test postgres
sudo: unable to execute /usr/local/bin/bundle: No such file or directory
I run this as my normal user (in the sudo and rvm groups), and the git user is not a sudoer.
I think that the line sudo gem install bundler, in step 2, does not grant the git user to execute bundle properly, but I don't know how to fix this.
I probably did something wrong but cannot figure out what it is, as I tried to respect the standard instructions as close as possible.
Any clue about this? Thanks, I am losing hope...
For information, I have written to the GitLab mailing-list about this problem but did not get any answer. Moreover, last time I asked something similar on ServerFault, I have been advised to post on StackOverflow instead... hence this question :)
When I do $ which bundle, I get /usr/local/rvm/gems/ruby-1.9.3-p392/bin/bundle.
The git user has been created with the --disabled-login flag and thus I cannot login as git to run bundle.
When I do $ sudo -u git bundle, I get
sudo: unable to execute /usr/local/bin/bundle: No such file or directory
That means git user has not /usr/local/rvm/gems/ruby-1.9.3-p392/bin in its PATH, and you cannot modify its .profile or .bashrc because of the --disabled-login flag.
It seems that running sudo -i -u git bundle instead of sudo -u git bundle does the trick
That is the safest route, and will execute the command as git, but will simulate first an initial login, using the PATH defined in .profile and .bashrc of user root.
See "How does sudo search the path for executable?" for more.
On my local machine after upgrade from 6.4 to 7.7 I had such issue.
The compilation of ruby was made under root account.
So need permissions to read compiled ruby and installed bundle.
chmod ugo+rx /usr/local/bin/bundle
chmod -R ugo+rX /usr/local/lib/ruby/
In production mode You could be more strict.

Resources