I am trying to do a docker build from a Jenkins job and I am getting the below error. Any ideas what is causing this error.
11:10:32 Step 1 : FROM docker.xxxx.com/xx/pkg-ssl:7-jdk8
11:10:32 Get https://docker.xxxx.com/v2/xx/pkg-ssl/manifests/7-jdk8:
unauthorized: unable to get identity token from basic auth credentials:
invalid_grant: invalid authentication credentials given
11:10:32 Build step 'Docker Build and Publish' marked build as failure
Related
I tried connecting Jenkins with Gitlab, while using System hooks in the Gitlab repository.
It is throwing me the following error :
Hook executed successfully but returned HTTP 403 window.location.replace('/login?from=%2Fjenkins%2Fproject%2FContinious_Integration');
Authentication required Hook executed successfully but returned HTTP 403 window.location.replace('/login?from=%2Fjenkins%2Fproject%2FContinious_Integration'); Authentication required
Open Jenkins global configuration -> require authorization for /project endpoint
Copy userid and API key for a Jenkins user who has authorization to
run the job
Create a webhook on GitLab to trigger the job,
Use HTTP basic auth (Below format)
user:apikey#gitlab/project/jobname
This worked for me..!
I am unable to do code analysis from jenkins,I am getting 403 error.The Execute Analysis permission is provided for all the sonar users,sonar administrator and project creators,but still iam getting 403.
In jenkins job i have used goal sonar:sonar
Am i missing anything in the configuration?
Error :
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar (default-cli) on project core: Unable to load component class org.sonar.api.config.Settings: Unable to load component class org.sonar.scanner.repository.ProjectRepositories: You're only authorized to execute a local (preview) SonarQube analysis without pushing the results to the SonarQube server. Please contact your SonarQube administrator. -> [Help 1]
Unless you've granted permissions to Anyone to perform analysis, then you will continue to have this failure because you're not providing credentials. Instead:
mvn sonar:sonar -Dsonar.login=analysis_token_here
Where the value of the login parameter is a User Token
I am trying to build and push image to docker cloud with Jenkins using the docker-build-step plugin. Added password for docker hub with Jenkins Password Manager plugin.
I am doing this in two steps. First step uses Build/Create Image command. The command builds image and tags it with build ID.
Second step pushes image to docker hub. Here is console trace:
[Docker] INFO: Build image id:5240329f9db6
[Docker] INFO: Pushing image parthmodi/docker_demo:test_push
[Docker] INFO: PushResponseItem[stream=<null>,status=The push refers to a repository [docker.io/parthmodi/docker_demo],progressDetail=<null>,progress=<null>,id=<null>,from=<null>,time=<null>,errorDetail=<null>,error=<null>,aux=<null>]
...
[Docker] INFO: PushResponseItem[stream=<null>,status=<null>,progressDetail=<null>,progress=<null>,id=<null>,from=<null>,time=<null>,errorDetail=ResponseItem.ErrorDetail[code=<null>,message=denied: requested access to the resource is denied],error=denied: requested access to the resource is denied,aux=<null>]
ERROR: Build step failed with exception
com.github.dockerjava.api.exception.DockerClientException: Could not push image: denied: requested access to the resource is denied
at com.github.dockerjava.core.command.PushImageResultCallback.awaitSuccess(PushImageResultCallback.java:49)
at org.jenkinsci.plugins.dockerbuildstep.cmd.PushImageCommand.execute(PushImageCommand.java:81)
at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder.perform(DockerBuilder.java:74)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:736)
at hudson.model.Build$BuildExecution.build(Build.java:206)
at hudson.model.Build$BuildExecution.doRun(Build.java:163)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:496)
at hudson.model.Run.execute(Run.java:1737)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:421)
Build step 'Execute Docker command' marked build as failure
Finished: FAILURE
Here is complete trace:
https://pastebin.com/tFy399D5
Why am I getting Could not push image: denied: requested access to the resource is denied error for pushing image to Docker Registry, and what can I do to resolve it?
Had also similar issues as OP, but with the Ram Kamath's code example. The issue lied with the incorrect registryURL that I passed to the docker.withRegistry. I had it as https://index.docker.io/v2/ but the credentials were for the https://index.docker.io/v1/ API.
Try this
stage('build and publish'){
def dockerImage = docker.build('dockerImageName')
docker.withRegistry(RegistryURL, CredentialID) {
dockerImage.push('latest')
}
}
terraform plan -var-file=uservar.tfvars
[0m[1mRefreshing Terraform state in-memory prior to plan...[0m
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
[0m
[31mError refreshing state: 1 error(s) occurred:
* provider.aws: InvalidClientTokenId: The security token included in the request is invalid.
status code: 403, request id: 39888d7e-b3f1-11e7-b6d2-9b6dc0727868[0m[0m
Build step 'Execute shell' marked build as failure
Finished: FAILURE
You need to run terraform init first, then terraform plan
Go through this document first: terraform Command: init
Secondly, for error The security token included in the request is invalid., please go through aws configuration to make sure you have set the AWS security token properly.
I got resolution for this one.
Do you pull your code form Git? If yes, pull only once
Note: Code on Git does not have access_key and secret_key, so if your jenkins job contains source control for every build the values (access_key and secret_key) are overridden.
-> Pull the code only once
-> In your jenkins/workspaces, set your access_key and secret_Key (or you can also mention it in Jenkins Build)
Before executing Jenkins job, Set aws cli parameters
aws configure
Set access_key, secret_key & region
and then execute
terraform init
terraform plan -var-file=uservar.tfvars
I am getting error while trying to login dtr from my pipeline groovy scrit. it is saying that that was a credential error.
docker.withRegistry('https://dtrlb-oe3ko7eumonjw.eastus.cloudapp.azure.com/','ddcadmin')
and my error is:
enter image description here
The docker.withRegistry can find credential in Global domain, not system domain.