Your build failed to run: Couldn't read commit xxxxxxxx - docker

I'm trying to build and deploy an image on GCP with cloud build.
I have a rails api repo on bitbucket running on docker, the repo is synced with google cloud repository
I configured a trigger on cloud build when a commit is made on my master branch.
Trigger Configuration:
Service account permissions:
But when the master branch gets a commit, the triggers returns the following error:
our build failed to run: <br>Couldn't read commit xxxxxxxx
Build Error:
I tried checked the GCP doc and I can't find anything. I think the issue might be on the IAM level, maybe the service account needs more credentials.

For me the Cloud Build API needed to be enabled. Once I did this my build ran, I didn't need to do anything special for permissions.

I actually edited the IAM setting for this service account to add:
Project > Editor
Source Repository > Reader
Now it works

Related

Jenkins freestyle project using Gitlab API Token never clone the repository, no error, build always succeed

I've followed this gitlab tutorial link, to connect my jenkins server to Gitlab.
Everyting went fine, and I've :
created a personnal access token in my GitLab profile
created a GitLab API Token using the my GitLab access token in jenkins system configuration as stated in the tutorial
create a freestyle jenkins job and Choose my GitLab connection from the dropdown
checked the Build when a change is pushed to GitLab checkbox.
checked the Accepted Merge Request Events and Closed Merge Request Events checkboxes
generated a secret token from the above freestyle project
use the freestyle jenkins project secret token to create a webhook in the GitLab project repository integration settings
Till there everything went fine.
Then I added and push code including a jenkinsFile to my GitLab repository, and get to the Jenkins WebUI to view the build status, but the pipeline shown green saying build success, while nothing happened, no code has been retrieved from GitLab (as shown in the attached console output screenshot), thus no jenkinsFile executed nor error message shown.
I tried to run the buils manually from WebUI but same result, no way to trigger my pipeline on git push events from GitLab
I thought may be I should select Git in Source Code Management section (I left it to None as the tutorial doesn't mention it) but if I choose Git as SCM I cannot select my GitLab API Token credentials, seeming like we cannot use GitLab plugin (API Token) and Git plugin for the same build project.
SO how should I proceed to be able build my jenkins project from GitLab with a jenkinsFile, using GitLab API Token?
Does the GitLab tutorial miss some useful steps?
OK, I think I understand the issue now.
There are two sets of credentials: GitLab API token for access to GitLab Webhooks and a separate one for cloning the git repo during builds.
So we can't use the GitLab API token for cloning the repository. For this you have to use either a SSH key or a Username/Password combination. Furthermore this dropdown is part of the git plugin not the gitlab plugin.
So the gitlab plugin can't tell which credentials are available as credentials for this dropdown.

CI/CD integration problem when using google-cloud-build with github push as trigger for Cloud Run

I am trying to set up a CI/CD pipeline using one of my public GitHub repositories as the source for Cloud Run (fully-managed) service using Cloud Build. I am using a Dockerfile initialized in root folder of the repository with source configuration parameter initialized as /Dockerfile when setting up the cloud build trigger. (to continuously deploy new revisions from source repository)
When, I initialize the cloud run instance, I face the following error:
Moreover, when I try to run my cloud build trigger manually, it shows the following error:
I also tried editing continuous deployment settings by setting it to automatically detect Dockerfile/cloudbuild.yaml. After that, build process becomes successful but the revision are not getting updated. I've also tried deploying a new revision and then triggering cloud build trigger but it isn't still able to pick the latest build from container registry.
I am positive that my Dockerfile and application code are working properly since I've previously submitted the build on Container registry using Google Cloud Shell and have tested it manually after deploying it to cloud run.
Need help to fix the issue.
UPPERCASE letters in the image path aren't allowed. Chnage Toxicity-Detector to toxicity-detector

SSL_ERROR_SYSCALL in Azure Pipeline to access our internal TFS 2018 server

I am trying since awhile to setup an Azure Pipeline to access our internal TFS 2018 server.
I created an "Other Git" Service Connection named: TFS_PRJ, I used this intranet URL: https://tfs.mycie.com/DefaultCollection/myProject/.
For the authentication, I tried, my Windows domain account credentials as well as a PAT Token created in TFS with all access rights.
When I created the pipeline, I specified my self-hosted agent located on the same intranet and the master branch. Does this branch have an impact when accessing TFS? I can see in the logs: "Starting: Checkout TFS_PRJ#master to s". I don't see branches in TFS, should I create something in TFS to make it work?
When running the pipeline, I first have a timeout
Then it runs and after 6-7 minutes, logs shows this error: fatal: unable to access 'https://tfs.myCie.com/DefaultCollection/myProject/': OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to tfs.myCie.com:443
I understood that to access this server, the agent should not use the proxy that is currently used in pipelines accessing GitHub. This bypass is usually done by using a proxy.pac file but I don't see how to use this file in agent configuration. To enable the proxy bypass with agent files, the .proxy file contains: http://abs-proxy.myCie.com:443 and the .proxybypass file contains: myCie.com
To test that the TFS server is accessible, I logged onto the agent server as the service account and in the IE Internet options, I added *.myCie.com to the trusted sites and then I was able to access https://tfs.mycie.com/DefaultCollection/myProject/. I am also able to ping the tfs.mycie.com server
So, I have several questions:
The branch part, is it normal to use the master branch while there is no branch in TFS or does it need something more?
When I run the pipeline, it gives a timeout as it can't connect to TFS but what account and what proxy does it try to use at this point? The one defined in the service connection?
About the SSL_ERROR_SYSCALL error, is it my syntax of the .proxybypass file that is wrong? "myCie.com", do you see anything thing else that could be done ?
Can there be some settings or access rights on the TFS server that I need to have or set ?
Update 1:
Thank you for this.
I created a YAML file in a Azure Repos with this content:
trigger:
- none
pool:
name: 'myAgent'
steps:
- checkout: none
- task: CmdLine#2
inputs:
script: 'git clone -b master https://tfs.myCie.com/DefaultCollection/myProject'
Which returned:
Cloning into 'myProject'...
fatal: could not read Username for 'https://tfs.myCie.com': terminal prompts disabled
I should probably try with the PATToken in the URL...
On the agent, I added the Git folder of the agent to the path and ran:
git clone https://anything:PATTokenToMyLogin#tfs.myCie.com/defaultcollection/myProject
Which returned:
Cloning into 'myProject'...
fatal: Authentication failed for 'https://tfs.myCie.com/defaultcollection/myProject/'
Then I tried to clone it from the Team Explorer in VS2019.
I have found two lists of projects, tfs.myCie.com and "local Git repositories", I couldn't clone projects from tfs.myCie.com so I tried to clone in the local Git but it didn't worked, not sure it was the thing to do either...
I took this screenshot, could it be my TFS project that is not suited for this ?
If you do not have other branch in TFS, it is normal to use the master branch, also we can specify branch name in the Get sources tab, please check the pic below.
You could check the service connection in the project settings->Service connections. It accesses the TFS repo via service account, such as below.
According to the error message OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to : It seems to be an issue in your network settings, maybe a proxy or a firewall blocking access to the remote repository.
You should check if your TFS server is behind the firewall or a proxy. If so, please turn it off and try again. Please also try running the clone command in a local machine directly to clone the affected repository to check if that works. If the server is behind a proxy, please try to set git configs for proxy something like this : git config --global http.proxy myproxy.com:8080
You need configure the service account permission in the TFS Version Control.
Update1
Please check the sample, I disable the checkout step and add cmd to clone TFS 2018 repo, then publish it to Artifacts to check the content.
Note: The repo will save in the self-hosted agent folder, we could add task Power shell at the end and call script to delete the repo folder.
trigger:
- none
pool:
name: Default
steps:
- checkout: none
- task: CmdLine#2
inputs:
script: 'git clone -b {branch name} {TFS repo URL}'
- task: CopyFiles#2
inputs:
SourceFolder: '$(Agent.BuildDirectory)'
Contents: '**'
TargetFolder: '$(build.artifactstagingdirectory)'
- task: PublishBuildArtifacts#1
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
Result:
Update2
It’s mainly caused by the credentials have been remembered by Credential Manager. You should remove the credentials for https://tfs.myCie.com which have been stored in Credential Manager.
you can open Credential Manager -> Windows Credentials -> under Generic Credentials -> remove the credentials like git:https://tfs.myCie.com
In addition, please also delete the Visual Studio cache.
Note: You could also try to clone repo on a new machine.

##[error]Git fetch failed with exit code: 128

We have a Git repo on TFS and I am trying to create a pipeline using azure pipelines to connect to the TFS repos.
I get the following error:
fatal: unable to access 'http://tfs.****************': Could not resolve host: tfs.******
##[error]Git fetch failed with exit code: 128
I would suggest you first use "git clone" command line to clone remote repo.
Kindly check when you run it manually from the build agent, it work for that repo or not.
This will narrow down if the issue related to your environment or pipeline.
If you are able to use git command to connect and clone that repo.
This means there is something wrong with your build service
account. You should make sure build service account has access to that
repo. You could also directly change the service account to the one
you used to run git command.
If you are not able to do it. Then this may related to network
environment. Make sure your build agent are able to access TFS
on-premise server. Temporarily turn off firewall and any proxy. Also
try to directly use browser to login TFS web portal.
It seems that it is a self-deployment of TFS server then you need to make sure that the Server can be reached from Azure DevOps.
Based on URL in your post, I assume server is not reachable from public internet. So TFS server should be either on-prem or on a VM in Azure. So reach out to your infrastructure team to see where the server is, and how the connection could be established from build agent being used by Azure DevOps to the TFS server.

Jenkins: Git Failed to connect to repository, returned status code 128

I'm attempting to clone a remote GitHub enterprise repository and am running into the following error after adding my remote repo's URL to the Git Plugin in my Jenkins configuration:
Failed to connect to repository : Command "git.exe ls-remote -h https://<<server>>/M/AS.git HEAD" returned status code 128:
stdout:
stderr: fatal: unable to access 'https://<<server>>/M/AS.git/': Received HTTP code 502 from proxy after CONNECT
Firs of all You Need to setup github with jenkins in below section also
Go to Github --> click on profile dropdown --> settings --> devloper settings --> personal access token -->
generate new token --> select all scopes --> copy the token
Then go to Jenkins --> manage Jenkins --> github settings --> add user --> Select secret text--> paste the token
Then Test the git-hub connection by clicking test button If its Successful the Jenkins will ready to clone the GitHub repository
And also add Webhooks, Integrations & Services in GitHub
Make sure you have generated Git API Token in Git repository and added the same in the Jenkins Credentials.
If the is done, I don't think there will be any issue in connecting Git to Jenkins.
Also you can test if your Git server is able to ping your Jenkins server. (If you are running your own Git and Jenkins).
All the best.
Check your failed job environment variables.
If there is no environment variable named NO_PROXY, set one in the configuration of your JENKINS job:
NO_PROXY=.mycompany.com
Here, I assume your GitHub Enterprise has an URL like myserver.mycompany.com (replace (mycompany.com by your own)
That will avoid Jenkins trying to access the remote server through the proxy.
If you are running from a VM, make sure you install the package 'git-core'.
You must have git installed in the machine where jenkins is running
I had the same issue and for me it helped a restart for the machine where it was installed Jenkins.

Resources