TeamCity -> GitLab CE/EE connection issue - oauth

I created a connection to GitLab based on documentation (created an system OAuth application in GitLab and then copied application ID and secret to the TeamCity connection form). When I try to create a new project from GitLab, I have two buttons available: sign in to GitLab and refresh, none of GitLab repositories are visible. Refresh does actually nothing because after clicking it we're exactly where we started so the only reasonable way is to pick the Sign in to GitLab. Aaaaand here we go, when I click on it I get a new window with message "
404
The requested resource [/oauth/authorize] is not available
Check that the URL is correct."
 enter image description here
URL displayed in address bar in this window is https:///oauth/authorize?client_id=4c2bbc87ff598e1488f6f5b9799fba3c62df106d0659e7bb82a838d0136c8deb&redirect_uri=https%3A%2F%2F%2Foauth%2Fgitlab%2FaccessToken.html&response_type=code&scope=api&state=eyJjb25uZWN0aW9uSWQiOiJQUk9KRUNUX0VYVF8zIiwiYWN0aW9uIjoiY29tcGxldGVBdXRob3JpemF0aW9uIiwiY2FsbGJhY2tVcmwiOiIvb2F1dGgvZ2l0bGFiL3JlcG9zaXRvcmllcy5odG1sP3Byb2plY3RJZFx1MDAzZF9Sb290XHUwMDI2Y29ubmVjdGlvbklkXHUwMDNkUFJPSkVDVF9FWFRfM1x1MDAyNnRva2VuT2J0YWluZWRcdTAwM2R0cnVlXHUwMDI2c2hvd01vZGVcdTAwM2RjcmVhdGVQcm9qZWN0TWVudSIsInJlcXVlc3RLZXkiOiJwUml0Z2tPckdBdnA2RjFyZzlMS2kxcTNSbU1WWGZjTSIsInByb2plY3RJZCI6Il9Sb290In0=
Our TeamCity version is TeamCity Professional 2022.10 (build 116751)  
Please help me to find a solution for this problem.
I created a connection to GitLab based on documentation (created an system OAuth application in GitLab and then copied application ID and secret to the TeamCity connection form).
Tried to edit binding of TeamCity to http://IP address:8080 and create configs in GL and TC once again.
Deleted the OAuth TeamCity app in GitLab and connection to GitLab in Teamcity and created it back again.
Checked the connection between servers and it works.
I expected that above attempts would allow me to connect successfully but as you can see, that didn't happen.

Related

Jenkins integration in Gitlab, "Jenkins url can't be blank"

When I try to link a jenkins project to my gitlab project, I have the following error :
Here is the form and the error message.
The jenkins project "test" does exists and the credentials are good.
The issue is probably not about the credentials but that gitlab seem to not be able to read the fields.
I tried with both chrome and Firefox.
I also tried to use webhook, but for services hosted on the same network, doc says it may be hazardous. So I'd rather use the first method.
Some information about my environment:
Linux Centos 7
jenkins and gitlab are built by docker-compose
hosted on localhost
jenkins and gitlab use different ports (8080 and 8081)
I found only one thread on the internet about it here but no answer were given.
Any ideas?
Thanks
This is my first post, I hope I did not make any mistake.\

Cannot access Jenkins Master URL on slave machine

I'm trying to configure the Jenkins Master/Slave on our AWS windows server. I looked at other posts and researched online and followed the steps. I installed Jenkins on the server, and changed the jenkins url to the ip address of the server by command ipconfig: http://x.x.x.x:8080/. On the Jenkins xml file, I added the line to the argument: --httpListenAddress=0.0.0.0.
I followed the online tutorial step by step guide to set up master and agent. On the agent computer, when i try to access the url, it shows This site can’t be reached. I added the port 8080 to the firewall. I also tried to ping from the agent to the master and it failed, said lost 4 100%. I am not sure how can I access jenkins master url outside of the server. Any help is appreciated.
The root cause is hidden in the comments, so for clarity posting it as an answer - looks like the problem was that the agent is running on a users laptop and it's trying to connect on a private IP of the jenkins server running in AWS. Things should hopefully work after connecting the agent on a public IP of the master instead.

Jenkins in Docker Container and Google Cloud Source Repository - no Credentials visible

I read everything in this post and multiple others but nothing is working... I cannot use Google Credentials to access my git Repo in Google Cloud Platform
I have Jenkins running in a Docker Container in Google Cloud Platform. I have Source Code in a Google Cloud Repository that I want to use for a Build.
On the Google Cloud Platform side I created a Service User, gave the User the following Roles:
Project Worker
Source-Repository Admin
Storageobject creator
ComputeEngine creator
I created the JSON File and downloaded it.
On The Jenkins Side I installed the Google OAuth Credentials and the Google Container Registry Auth Plugin.
I added new Credentials "Google Service Account from private key" and added the json file.
So, if I now want to create a new Job (Freestyle or pipeline does not matter) I see the following:
I see the credentials I created but for the "Google Container Registry". As soon as I add the repository URL, "https://source.developers.google.com/p...." The Drop-down is cleared and all is gone.
I also took a look at the credentials.xml and job file, to see, if I can rewrite there something by myself. The Google Credentials do not have an credentialId like others...
<com.google.jenkins.plugins.credentials.oauth.GoogleRobotPrivateKeyCredentials plugin="google-oauth-plugin#0.6">
<module/>
<projectId>testprojekt</projectId>
<serviceAccountConfig class="com.google.jenkins.plugins.credentials.oauth.JsonServiceAccountConfig">
<jsonKeyFile>/var/jenkins_home/gauth/key8529180263669390055.json</jsonKeyFile>
</serviceAccountConfig>
</com.google.jenkins.plugins.credentials.oauth.GoogleRobotPrivateKeyCredentials>
I'm currently out of ideas... would be happy for any hint.
Thank you!

Why is Web Deploy using the wrong account?

I've verified that Web Deploy works (using NTLM authorization) when I fire it from Visual Studio on my local machine. Now I want my build server to auto-deploy (if appropriate) every night. I'm using Jenkins on the build server, and I've granted the account access in IIS on the remote machine. My parameters to MSBuild are as follows:
/p:DeployOnBuild=true
/p:Configuration=Debug
/p:Platform=x86
/p:PublishProfile=DEV
/p:AuthType=NTLM
/p:AllowUntrustedCertificate=True
/p:Username=
The DEV publish profile specifies my DEV server which uses a self-signed certificate thus necessitating an untrusted certificate. The NTLM and blank username should use the current user/account to connect.
However, the Jenkins' job's MSBuild step fails with this error
msdeploy error ERROR_USER_UNAUTHORIZED: Web deployment task failed. (Connected to the remote computer ("DEV-SERVER") using the Web Management Service, but could not authorize. Make sure that you are using the correct user name and password, that the site you are connecting to exists, and that the credentials represent a user who has permissions to access the site. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_UNAUTHORIZED.)
When I look at the IIS logs on DEV-SERVER, I see the following:
2016-01-06 23:55:10 159.212.19.186 HEAD /msdeploy.axd site=MySite 8172 - 159.212.19.123 - 401 2 5 0
2016-01-06 23:55:10 159.212.19.186 HEAD /msdeploy.axd site=MySite 8172 CO\BUILD-SERVER$ 159.212.19.123 - 401 2 64 78
I was expecting to see CO\jenkins, the account Jenkins is running under, instead of CO\BUILD-SERVER$. (And what's with the $ on the end?) Am I correct in thinking the wrong account is being used? What do I need to do to get this working?
CO\BUILD-SERVER$ is the machine account of your build server.
If you have a slave running on that machine, is it running as a windows service? If so it's probably running as "System"
Also re Selenium tests, if the tests are running on the build server then the service may need to set to run interactively so that the tests can run against a UI.

Remote Access to Secured Jenkins Server

I have a Jenkins installation on a machine running Windows Server 2008. The Jenkins installation is secured using Jenkins own user database with matrix-based security authorization. Anonymous users don't have any access, except to register an account. I have set up an account and gave this account full access.
Now I'd like to trigger a build remotely from a different machine that hosts the repository. I believe this should be possible by accessing the following URL:
https://[username]:[user_api_token]#[address.of.jenkins]:8080/job/[project]/build?token=[project_api_token]
However, this does not seem to be working for me. When I access this site in a browser, Jenkins forwards to the login-page, and does not start the build.
What am I doing wrong? It seems to be an authentication problem, as I'm not logged in after opening the URL above. Furthermore, if I give anonymous users full access, the URL works.
Try invoking the build from a command-line program like curl:
curl http://[userid]:[user_token]#localhost:8080/job/[project]/build?token=[proj_token]
or
curl --user [userid]:[user_token] http://localhost:8080/job/[project]/build?token=[proj_token]
I think your issue could be browser related, embedding credentials within the URL (Firefox pops up a warning in my case telling me I'm about to login to Jenkins)

Resources