Pipeline with services from password protected repository - gitlab-ci

I want to create pipeline with services. Let's say using mysql service
services:
- mysql:latest
My project uses docker image from our company repo which is password protected.
When I run it manually I must fist login to repository
docker login <creadentials> <repository address>
docker pull <some private image>
Is there some way to configure gitlab pipeline to use service with credentials?
services:
- <maybe some credentials here???>#<my private host>/modifiedForProductionMysql:latest
I know I can use shell runner and call all commands in my shell script. First I wanted to investigate if it is doable with gitlab docker runner and pipeline job with services.

See Using a private container registry. You can put your credentials into DOCKER_AUTH_CONFIG variable. The format is the same as ~/.docker/config.json after you login to your registry.

Related

How to add password and port to sshEndpoint on SSH#0 task in ADO?

Code:
- task: SSH#0
displayName: 'Run shell inline on remote machine'
inputs:
**sshEndpoint: username#server.com**
runOptions: inline
inline: |
cd /
/usr/documents/mql
push context user random pass random;
print context;
I am having issues trying to figure out how to add the password and port to the sshEndpoint input.. there's no documentation on syntax that I'm able to find!If you have tips on where to find these documentations pls lmk
According to your description, you are using SSH task in YAML pipelines. For more about this task, please refer to this following document:
SSH Deployment task - Azure Pipelines | Microsoft Docs.
To use the task, you could fill a SSH service connection name in the sshEndpoint input. The task will try to access the remote machine with the service connection settings.
First, you need to create a SSH service connection. Please navigate to Project settings and then click into the Service connections tab. You could create a new service connection as below:
In the service connection, please add your host, port, username and password. Alternatively, you could also choose to use the private key file to get authentication. It's optional.
When the service connection is created, you could copy the service connection name and paste it into the sshEndpoint input. Please see the example below.
- task: SSH#0
displayName: 'Run shell inline on remote machine'
inputs:
sshEndpoint: 'my_service_connection_name'
runOptions: inline
inline: |
cd / && ls

What happens when I run "ssh git#gitlab.com

I have tried google it and check the gitlab-documentation but did not find a good answer for this.
When I setup GitLab I am advised to test my SSH-keys to my GitLab URL instance.
I use git#gitlab.com.
What actually happens when I run "ssh git#gitlab.com"
I understand how you use SSH to login to a remote device e.g. Cisco Router with SSH Admin. But in this case: who is git#gitlab.com? [username]#gitlab.com makes more sense to me.
Somehow it must find my Gitlab account (since it is there my public key is stored). How can I do that when I use a generic git#gitlab.com ?
I am after a more step-by-step answer (Client-Server)
[username]#gitlab.com makes more sense to me
It would not: that would ask to open an SSH session as 'username': that account does not exist. Only one account exists: 'git'.
Then, in ~/.ssh/authrorized_keys, your public key is found, alongside:
an ID (as shown here), matching your registered GitLab account,
a forced command, which will call a GitLab script in order to execute the Git command.
That way:
there is no interractive session possible on GitLab's server
the project gitlab-shell gets your ID and hangle your Git query
for found it, go in repository on clone, select ssh, begin start copy up to :,
now test

Jenkins integration with GitLab - port 22: Operation timed out

I was trying to create integration between Jenkins and GitLab using this tutorial: https://docs.bitnami.com/aws/how-to/create-ci-pipeline/
(without Step 3: Connect Your Project With The GitLab Repository)
So I have generated public and private keys, public was added in GitLab (Settings > SSH Keys) and private key file content was inserted into text area in Jenkins Project settings (Source Code Management > Credentials > SSH Username with private key > Private key)
After that following error appeared:
what can cause such strange issue? Thanks for help :)
If you add public key to the profile of a specific GitLab user, you must:
Grant this user access to target project in GitLab.
Use username of that specific user (instead of the git username) when creating the SSH credentials in Jenkins.

how to change cassandra docker config

I installed cassandra from cassandra hub and its running successfully.
root#localhost$ docker ps | grep cassandra
2925664e3391 cassandra:2.1.14 "/docker-entrypoin..." 5 months ago Up 23 minutes 0.0.0.0:7000-7001->7000-7001/tcp, 0.0.0.0:7199->7199/tcp, 0.0.0.0:9042->9042/tcp, 0.0.0.0:9160->9160/tcp, 0.0.0.0:32779->7000/tcp, 0.0.0.0:32778->7001/tcp, 0.0.0.0:32777->7199/tcp, 0.0.0.0:32776->9042/tcp, 0.0.0.0:32775->9160/tcp
I am connected my application with this cassandra. I need to use password authentication to connect to cassandra form my application.
I have to unable password authentication for this, I get the /etc/cassandra/cassandra.yaml file in docker image. I have to follow Authentication Config to enable this.
Is there way to override this changes with docker start or docker run command ?
It is not included into the piece generating the cassandra.yml file, so no. You can submit a PR modifying the relevant piece of the generation script to allow to specify auth via env variables.

Jenkins job on AWS server

I have a windows instance set up on AWS. I have Jmeter and Ant installed on that machine to run API test cases.So I can successfully run tests on remote server. I need to set up a job on corporate Jenkins to run those test cases on aws server. I have server's IP address and username and password to log in to aws server.
How do I set up a job on corporate Jenkins which will run my test cases on remoter aws server? (Execute windows command)
Thank you.
did you connect this AWS machine as a slave to the master ? or you can't do it ?
I think that the best is connect this machine as a slave and create a dedicated job to run on the windows machine
Setting up a new Ant task to run JMeter test in Jenkins is fairly easy, here is a simple Pipeline script which executes Ant task using build.xml file in the "extras" folder of JMeter installation and publishes resulting HTML report on the build artifacts page:
node {
ws('c:\\jmeter\\extras') {
stage 'Run JMeter Test with Apache Ant'
def antHome = tool 'ant'
bat "pushd c:\\jmeter\\extras && ${antHome}\\bin\\ant -f build.xml"
step([$class: 'ArtifactArchiver', artifacts: 'Test.html', fingerprint: true])
}
}
You will need to define ant tool so Jenkins would know what is "ant" and where it lives. See Running a JMeter Test via Jenkins Pipeline - A Tutorial article for details.
Alternative options are:
If you have Jenkins admin access or your user has "Job - Configure" role you have "Configure" button where you can see (and change) all the build steps
You can copy the whole Jenkins installation over to your corporate intranet (don't forget JENKINS_HOME folder)
Thank you both for your response. I have set it my windows AWS machine as Slave. And I was able to run the job on AWS server from corporate jenkins.