question
stringlengths
11
28.2k
answer
stringlengths
26
27.7k
tag
stringclasses
130 values
question_id
int64
935
78.4M
score
int64
10
5.49k
My project size is 1,63 GB (Magento Project) I had followed this tutorial when I do this command : git push -u origin master , it is starting to write objects and after that I getting this error in git console: error: RPC failed, result=22, HTTP code = 502 fatal: The remote end hung up unexpectedly fatal: The remote e...
The remote end hangs up because the pack size you are trying to transmit exceeds the maximum HTTP post size. Try to limit this pack size with git config --local http.postBuffer 157286400 to 150MB.
GitLab
24,322,896
33
tl;dr How do I pass data, e.g. the $BUILD_VERSION variable, between jobs in different pipelines in Gitlab CI? So (in my case) this: Pipeline 1 on push ect. Pipeline 2 after merge `building` job ... `deploying` job │ ▲ └─────── $BUILD_VERS...
Going by the Gitlab docs, it should be possible to download any job's artifact by URL, if it hasn't expired yet. In addition, you can use the Gitlab API to download (unexpired) artifacts from other projects, too; and you can use the Gitlab API to mark a job's artifacts for keeping-regardless-of-expiry-policy, or to del...
GitLab
68,179,565
32
GitLab's running in kubernetes cluster. Runner can't build docker image with build artifacts. I've already tried several approaches to fix this, but no luck. Here are some configs snippets: .gitlab-ci.yml image: docker:latest services: - docker:dind variables: DOCKER_DRIVER: overlay stages: - build - package ...
Don't need to use this: DOCKER_DRIVER: overlay cause it seems like OVERLAY isn't supported, so svc-0 container is unable to start with it: $ kubectl logs -f `kubectl get pod |awk '/^runner/{print $1}'` -c svc-0 time="2017-03-20T11:19:01.954769661Z" level=warning msg="[!] DON'T BIND ON ANY IP ADDRESS WITHOUT setting -...
GitLab
42,867,039
32
I'm currently working on a deployment script to run as part of my GitLab CI setup. What I want is to copy a file from one location to another and rename it. Now I want to be able to find what commit that file was generated with, so I'd like to add the hash of the commit to it. For that to work I'd like to use something...
In your example you used the short git hash that you would get with the predefined variable CI_COMMIT_SHA by building a substring like this: ${CI_COMMIT_SHA:0:8} or by using the short sha directly $CI_COMMIT_SHORT_SHA
GitLab
35,064,320
32
How does one retrieve an arbritrary user's ssh public keys from GitLab? GitHub provides this feature. For example: https://github.com/winny-.keys The GitLab API exposes public keys, however it looks like it requires: Separate authentication Query a given user name for its UID Finally get the public keys
GitHub style ssh public key access was added in GitLab 6.6.0 using the following scheme: http://__HOST__/__USERNAME__.keys (thanks @bastelflp). Currently we are running 6.2.3, and we will upgrade.
GitLab
24,839,301
32
I have a gitlab pipeline where there are two stages, one is build and the other one is deploy. The build stage is run when a commit is made. I want a way to run the deploy job when the merge request is merged to master. I tried several things but no luck. Can anyone help? stages: - build - deploy dotnet: script: "...
Try using the gitlab-ci.yml "rules" feature to check for the merge request event. Your current gitlab-ci.yml will run your "dotnet" job every commit, merge request, schedule, and manually triggered pipeline. https://docs.gitlab.com/ee/ci/yaml/#workflowrules dotnet: script: "echo This builds!" stage: build rules: ...
GitLab
63,893,431
31
So I have 2 similar deployments on k8s that pulls the same image from GitLab. Apparently this resulted in my second deployment to go on a CrashLoopBackOff error and I can't seem to connect to the port to check on the /healthz of my pod. Logging the pod shows that the pod received an interrupt signal while describing th...
To those having this problem, I've discovered the problem and solution to my question. Apparently the problem lies with my service.yml where my targetPort was aimed to a port different than the one I opened in my docker image. Make sure the port that's opened in the docker image connects to the right port. Hope this he...
GitLab
53,535,540
31
Using Team City to check out from a Git Repo. (Gitlabs if it matters) Start with Empty build directory. Get this error: fatal: could not set 'core.filemode' to 'false' (Running on a Windows machine, if that matters) The user that Team City is running on was changed to an Admin just in case. The .Git directory is not a...
In my case using "sudo" worked for me. For example: asif@asif-vm:/mnt/prog/protobuf_tut$ git clone https://github.com/protocolbuffers/protobuf.git Cloning into 'protobuf'... error: chmod on /mnt/prog/protobuf_tut/protobuf/.git/config.lock failed: Operation not permitted fatal: could not set 'core.filemode' to 'false' ...
GitLab
50,108,363
31
Most of our work occurs on GitLab.com (i.e. not a local GitLab installation). If the upstream repo resides on GitHub, is there a way to submit a pull request to upstream? (If forking the upstream repo in a particular way is part of solution, that's ok.)
No. The correct workflow would be forking the upstream project on GitHub to your own namespace. Then use your fork as upstream in your GitLab repository not the origin of your fork. From your GitLab repository you are then pushing changes to your fork (upstream). Then on GitHub you can submit a pull request from your G...
GitLab
37,672,694
31
I am interested in building a wiki for my scientific computing code on gitlab which needs me to write equations and render them in the wiki in gitlab. How to do this. I tried to paste the mathjax rendering script but it doesn't work. Can KaTeX be used anyhow ? $$ \partial_t \int_{\Omega} \mathbf{q} d \Omega = \int...
GitLab supports KaTex from GitLab CE 8.15 using code backticks. Documentation is here and the Relevant discussion are on merge request 8003. Here is the current way to use equations in GitLab
GitLab
35,259,660
31
I try to install gitlab on debian with this turotial: https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md I'm at step "Install Gems" and try to run: sudo -u git -H bundle install --deployment --without development test postgres aws i get this echo: Fetching source index from https://rubygem...
I ran into this same problem a few minutes ago. Looks like the classy folks behind Modernizr's Rubygem yanked the most recent versions. You can download the latest gem (Modernizr-2.5.2 as required in the docs there) running the following command inside your /home/git/gitlab directory: wget http://rubygems.org/downloads...
GitLab
22,825,497
31
By default gitlab has the next configuration in gitlab.yml : email: from: notify@gitlabhq.com host: gitlabhq.com but, I need to specify other variables (host, port, user, password, etc) to use another mail server. How I do that?
Now it is totally different in Gitlab 5.2+. It is in "/home/git/gitlab/config/initializers/smtp_settings.rb.sample" and we just need to follow the instructions in that.
GitLab
10,690,255
31
Trying to login from docker to gitlab using the command: sudo docker login registry.gitlab.com?private_token=XXX But I still have the following error message: Error response from daemon: Get https://registry.gitlab.com/v2/: unauthorized: HTTP Basic: Access denied\nYou must use a personal access token with 'api' scope ...
The correct command line (that works in my case at least) was: docker login registry.example.com -u <your_username> -p <your_personal_access_token>
GitLab
65,072,379
30
The title says it all. I took a look into GitLab docs but couldn't find clear-cut solution to this. How do I add image to readme on GitLab ? Image that's within the repo.
You can use ![image info](images/image.png) where images could be a directory in your project structure.
GitLab
59,738,918
30
How to change the gitlab multi runner build path. in my server it have /home/gitlab-runner/builds. I want to change this path to my secondary HDD that is mounted in the same server.
You can change your runners build path by adjusting the config.toml. In the [[runners]] section add or change the builds_dir directory. For further reference on runner configuration you can check out the documentation here.
GitLab
41,853,100
30
I cloned a project and ran git checkout -b develop. When I run git flow feature start feature_name it gives me the following error: Fatal: Not a gitflow-enabled repo yet. Please run 'git flow init' first. can any one help me?
I got it working by doing the steps mentioned by jpfl @ answers.atlassian.com: Although this is an old post, just wanted to add to this since I've gotten stuck on this same error. Was able to resolve by doing the following: Open the .git\config file OR Repository -> Repository Settings -> Remotes -> Edit Config F...
GitLab
36,843,062
30
There is an on-premise instance of gitlab installed. There are Visual Studio projects in this instance. What is the easiest way of connecting Visual Studio 2015 to one of the projects? With GitHub, you can do it by selecting "Connect to GitHub" as on the following picture: and then pasting the repository url. There is...
First, get the clone using command line: git clone <repository url> Then in Visual Studio, in the Team Explorer pane, select the connect button and look for Local Git Repositories "tab": Press Add, as indicated on the picture, and select the folder you cloned your repository too. When the process finishes, you can d...
GitLab
35,167,121
30
I'm trying to use 'cache' in .gitlab-ci.yml (http://doc.gitlab.com/ce/ci/yaml/README.html#cache). My gitlab version is 8.2.1 and my Runner is: $ docker exec -it gitlab-runner gitlab-runner -v gitlab-runner version 0.7.2 (998cf5d) So according to the doc, everything is up to date, but I'm unable to use the cache ;-(....
https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/issues/327 image: java:openjdk-8-jdk before_script: - export GRADLE_USER_HOME=`pwd`/.gradle cache: paths: - .gradle/wrapper - .gradle/caches build: stage: build script: - ./gradlew assemble test: stage: test script: - ./gradlew che...
GitLab
33,940,384
30
I am trying to make use of the variables: keyword documented in the Gitlab CI Documentation here: FROM: https://docs.gitlab.com/ce/ci/yaml/README.html variables This feature requires gitlab-runner with version equal or greater than 0.5.0. GitLab CI allows you to add to .gitlab-ci.yml variables that are set in buil...
The original answer is no longer correct. The original documentation now stands, Now there are more ways as well. Variables can be created from the GUI, API, or by being defined in the .gitlab-ci.yml as well. https://docs.gitlab.com/ce/ci/variables/README.html
GitLab
31,844,861
30
I am a bit confused between Gitlab CI pipeline workflow:rules and job:rules workflow: rules: - if: '$CI_PIPELINE_SOURCE == "push"' - if: '$CI_PIPELINE_SOURCE != "schedule"' and test: stage: test image: image script: - echo "Hello world!" rules: - if: $CI_PIPELINE_SOURCE == "schedule" What h...
With workflow you configure when a pipeline is created while with rules you configure when a job is created. So in your example pipelines are created for pushes but cannot be scheduled while your test job will only run when scheduled. But as workflow rules take precedence over job rules, no pipeline will be created in ...
GitLab
67,314,497
29
I have a jhipster project which deploy on heroku with gitlab since several months Since yesterday, I can not deploy new version because I have this error FAILURE: Build failed with an exception. 32 * What went wrong: 33 A problem occurred configuring root project 'yvidya'. 34 > Could not resolve all artifacts for confi...
Open your build.gradle file and replace the spring maven repository URL from http with https
GitLab
59,767,726
29
GitLab CI allows adding custom variables to a project. It allows to use a secret variable of type file where I specify a Key that is the variable name and Value that is the content of a file(e.g. content of certificate) Then during execution of the pipeline the content will be saved as a temporary file and calling the...
Had to use .yml file docker build argument --build-arg VARIABLE_NAME=variable_value and in Dockerfile use ARG VARIABLE_NAME so the Dockerfile knows it needs to use variable from environment.
GitLab
58,939,500
29
git merge --no-ff account-creation Auto-merging package-lock.json CONFLICT (content): Merge conflict in package-lock.json Automatic merge failed; fix conflicts and then commit the result. Any idea regarding this issue ?
As per the docs: Resolving lockfile conflicts Occasionally, two separate npm install will create package locks that cause merge conflicts in source control systems. As of npm@5.7.0, these conflicts can be resolved by manually fixing any package.json conflicts, and then running npm install [--package-lock-only] again. ...
GitLab
50,160,311
29
I did commit successfully in my local repository. When I try to do: git push https://gitlab.com/priceinsight/jmt4manager/compare/develop...2-retrieve-list-userrecord# 2-retrieve-list-userrecord -v I got this error: Pushing to https://gitlab.com/priceinsight/jmt4manager/compare/develop...2-retrieve-list-userrecord# fat...
The URL you try to push to is not correct. You are trying to push to the URL https://gitlab.com/priceinsight/jmt4manager/compare/develop...2-retrieve-list-userrecord# which is a webpage that compares two branches and not the URL of a repository. The repository would be https://gitlab.com/priceinsight/jmt4manager.
GitLab
43,835,309
29
When using GitLab CI, as well as the gitlab-ci-multi-runner, I'm unable to get internally-started Docker containers to expose their ports to the "host", which is the Docker image in which the build is running. My .gitlab-ci.yml file: test: image: docker stage: test services: - docker:dind script: - APP_...
When using docker:dind a container is created and your docker-compose containers get setup within it. It exposes the ports to localhost within the docker:dind container. You cannot access this as localhost from the environment that your code is executing in. A hostname of docker is setup for you to reference this docke...
GitLab
41,559,660
29
We have a gitlab setup at our office, and we have somewhat around 100-150 project each week to create over there, while Admin wants to keep the control of creating repos and assigning teams to it, it seems quite a bit of task for anyone to create that many repos every week. Is there a way to create repo on Gitlab using...
gitlab-cli is no longer maintained, the author references the Gitlab module to be used instead - it also includes a CLI tool. For your specific request - namely creating a project on the command line, use the following command: gitlab create_project "YOUR_PROJECT_NAME" "{namespace_id: 'YOUR_NUMERIC_GROUP_ID'}" Be sure ...
GitLab
19,585,211
29
I know it is possible to fetch then use checkout with the path/to/file to download that specific file. My issue is that I have a 1 MB data cap per day and git fetch will download all the data anyway even if it does not save them to disc until I use git checkout. I still used my data Is my understanding of how git fetch...
Gitlab has a rest API for that. You can GET a file from repository with curl: curl https://gitlab.com/api/v4/projects/:id/repository/files/:filename\?ref\=:ref For example: curl https://gitlab.com/api/v4/projects/12949323/repository/files/.gitignore\?ref\=master If your repository isn't public you also need to provid...
GitLab
56,943,327
28
Consider the following gilab-ci.yml script: stages: - build_for_ui_automation - independent_job variables: LC_ALL: "en_US.UTF-8" LANG: "en_US.UTF-8" before_script: - gem install bundler - bundle install build_for_ui_automation: dependencies: [] stage: build_for_ui_automation artifacts: paths: ...
Note - This answer used, only-except of GitLab CI to manipulate what job gets added to the schedule. However, as of today, GitLab has stopped active maintenance of the same commands and suggests we use rules instead. Here's the link. I have modified the original answer to use rules and tested the working. To build off ...
GitLab
56,686,864
28
Is it possible to run a pipeline on a specific runner? (not using tags) Is it feasible to use environments, or even gitlab runner exec maybe? Scenario: Have an existing project with multiple runners already attached to it (specific project token used to register the runner) and has it's own associated tags (so can't c...
You have two mechanisms by which you can attempt to isolate a new runner for testing: use tags and private runner attachment (already called out) use the gitlab-runner exec verb directly on the runner canary the runner for a single build only Option 1 use tags and private runner attachment (already called out). To fu...
GitLab
47,059,975
28
The goal is to have everyone get a notification for every failed pipeline (at their discretion). Currently, any of us can run a pipeline on this project branch, and the creator of the pipeline gets an email, no one else does. I have tried setting the notification level to watch and custom (with failed pipelines checked...
Have a look at following Integration: Project -> Settings -> Integrations -> Pipelines emails
GitLab
46,472,631
28
I am trying to migrate an GitLab setup from 7.8.2 to 7.12.2. I am not really sure how to go about this. I have installed a new box, on Ubuntu 14.04.2. Now I would really like to just export the old user/group database and import it on the new server, then copy all the repositories from the old server to the new one. An...
I would take the following steps Find out if gitlab is installed by hand or with gitlab-omnibus. This you need to know for the exact backup and update steps. Do a backup of the old version just to be safe Update the current 7.8.2 instance to 7.12.2 instance by following the update guideline Back up the newly updated g...
GitLab
31,534,293
28
I was able to ignore directory, file changes using the following syntax. build: script: npm run build except: changes: - "*.md" - "src/**/*.ts" With this configuration build job is going to run except git changes include only *.md extension file or *.ts files in src directory. They're ignored. But ...
Based on documents of rules: changes, it seems when: never must be used with rules: changes syntax. Like the following: build: script: npm run build rules: - changes: - "*.md" - "src/**/*.ts" when: never - when: always If changed paths in the repository match above regular expressions th...
GitLab
62,689,235
27
I'm running my Gitlab with Docker and I forgot my Gitlab root password. How to change it ?
I found a way to make it work. First connect to your Gitlab with command line search for your Docker CONTAINER_ID docker ps -all eg docker exec -it d0bbe0e1e3db bash <-- with your CONTAINER_ID $ gitlab-rails console -e production user = User.where(id: 1).first user.password = 'your secret' user.password_confirmation ...
GitLab
55,747,402
27
I'm using the following command to remove a local branch with force delete option: $ git branch -D <branch_name> My question is, If I delete a local branch that had an upstream set and then do a normal push, it won't delete the remote branch right? What should I do in this situation? [NOTE]: "-D" is force delete opt...
git will only delete your local branch, please keep in mind that local and remote branches actually have nothing to do with each other. They are completely separate objects in Git. Even if you've established a tracking connection (which you should for most scenarios), this still does not mean that deleting one would de...
GitLab
51,295,388
27
I have a solution with several .NET projects in it. I use GitLab, not self-hosted, for version control and would like to start using their CI tools as well. I have added the following .gitlab-ci.yml file to my root: stages: - build - test build_job: stage: build script: - 'echo building...' - 'msbuild.exe ...
You should be able to setup your own shared runner on a machine with the Framework 4 build tools on it (either using a Docker image, like microsoft/dotnet-framework-build, or just your native machine). The simplest case to get going is using your own desktop, where you know your solution already builds. (Since using Do...
GitLab
49,268,560
27
What's the meaning of "Allowed to push" and "Allowed to merge" in Gitlab protected branches
Allowed to push means just that - the user is allowed to git push to the branch. Allowed to merge means that the user is allowed to accept merge requests into that branch.
GitLab
41,782,553
27
When I run : git push, there is exist error like this : remote: Access denied fatal: unable to access 'https://gitlab.com/myname/mysystem.git/': The requested URL returned error: 403 Is there any people who can help me?
For Windows users, check this unbelievable easy solution, which works for me: Go to Windows Credential Manager (press Windows Key and type 'credential') to edit the git entry under Windows Credentials. Replace old password with the new one.
GitLab
41,263,662
27
I have GitLab CE (v8.5 at least) installed on my server. I would like to integrate it with sonarqube so that merge requests shows any issues in the comment section. Has anyone integrated these 2 systems successfully? At the moment, only sonarqube plugin I found is the following but I'm not able to successfully integrat...
I had the same problem than yours. Comments were not showing in the GitLab MR. I made it work with two fixes: make sure the preview mode is used. If it is not, the issues are not reported to GitLab for issues to appear as GitLab comments, they have to be "new" issues. If you launched an analysis of your project before...
GitLab
37,929,055
27
I'd like to get a list of the issues for the project YYYYYY and a username XXXXXX. curl --header "PRIVATE-TOKEN: myownprivatetoken" "https://gitlab.com/api/v3/projects/YYYYYY/issues" curl --header "PRIVATE-TOKEN: myownprivatetoken" --header "SUDO: XXXXXX" "https://gitlab.com/api/v3/projects/YYYYYY/issues" curl --head...
The documentation tell you this about how to retrieve issues from a project: GET /projects/:id/issues And you tried: curl --header "PRIVATE-TOKEN: xxx" "https://gitlab.com/api/v3/projects/YYYYYY/issues" This is correct, but the parameter you give YYYYYY has to be the project id, so it has to be an integer, not text...
GitLab
31,805,041
27
Is it dangerous to keep code in gitlab and github? I heard it is quite safe to commit our code to gitlab and github. The reason is every code is hashed and it is nearly impossible for everyone to alter the code without using git tool. Is this true?
As I mentioned in "Why does Git use a cryptographic hash function?", it is "safe" in term of data integrity (Linus Torvalds, 2007): We check checksums that is considered cryptographically secure. Nobody has been able to break SHA-1, but the point is, SHA-1 as far as git is concerned, isn't even a security feature. It'...
GitLab
30,296,072
27
How can I make Side-by-side be the default diff for my GitLab installation or project or profile?
Update February 2016 The issue is now at issue CE 3071 and... was resolved by commit 9fdd605! A cookie now retain your diff view choice, with GitLab 8.5.0+. Original answer (February 2015) That doesn't seem to be possible right now, and can be voted up at the suggestion 7082397 Remember side-by-side diff choice Righ...
GitLab
28,180,650
27
I've got root access to our production server and I want to deploy the latest version in git to the server but I'm running into the error below when I "git pull" on the folder I want to update. I've browsed around a bit, but can't find a clear answer on what to do.. The staging server runs on the same machine, but jus...
In the log you see the following text: (...) Please contact your system administrator. Add correct host key in /root/.ssh/known_hosts to get rid of this message. Offending ECDSA key in /root/.ssh/known_hosts:1 remove with: ssh-keygen -f "/root/.ssh/known_hosts" -R gitlab.site.org ECDSA host key for gitlab.site.org ha...
GitLab
21,087,695
27
I've just setup gitlab, but I'm completely lost with regards to admin user. The wiki seems silent about this topic, and google hasn't been of help either. So, how do I setup admin users with gitlab on LDAP authentication?
You can also set admin permissions to a user by doing something like this in the rails console: User.find_by_email("user@example.org") do |i| i.admin = true i.save end
GitLab
11,761,396
27
I have a problem... My code in Gitlab, Pipeline in Azure DevOps. I use classic editor. When i start pipeline i have error "fatal: unable to access 'fatal: unable to access 'https://my.repos.example:***.git/': SSL certificate problem: unable to get local issuer certificate" Please help me!
For me this issue came up when attempting to clone a repository through Visual Studio 2019. Upon selecting the Azure option in the repository menu I then picked the codebase I wanted to clone. After this step I was prompted with an error of: "SSL certificate problem: unable to get local issuer certificate" I ran th...
GitLab
67,976,050
26
How do I prevent a gitlab ci pipeline being triggered when I add a git tag? I'm running this command locally (as opposed to within a gitlab-ci job) git tag -a "xyz" and then pushing the tag; and this triggers various pipelines. I want to exclude some of those pipelines from running. I'm trying variations on ideas fr...
It looks like GitLab recommends using rules instead of except as per the documentation only and except are not being actively developed. rules is the preferred keyword to control when to add jobs to pipelines. So it'd be your_job: stage: your_stage script: - echo "Hello" rules: - if: $CI_COMMIT_TAG ...
GitLab
60,351,496
26
I am currently using GitLab API to return all projects within a group. The question I have is, how do I return all projects if there are over 100 projects in the group? The curl command I'm using is curl --header "PRIVATE-TOKEN: **********" http://gitlab.example.com/api/v4/groups/myGroup/projects?per_page=100&page=1 I ...
Check the response for the X-Total-Pages header. As long as page is smaller than total pages, you have to call the api again and increment the page variable. https://docs.gitlab.com/ee/api/rest/index.html#pagination-link-header
GitLab
47,414,024
26
I am a big fan of the __TOC__ that creates a table of content on a Wikimedia page. Whenever you write things like this on a Wikimedia page: This is a page for my project ## Credits ## bla bla ## License ## bla bla __TOC_ automagically creates a table of content that allows you to navigate through inner links of th...
So this exists! I finally found a Merge Request in in the GitLab Community Edition: Replace Gollum [[_TOC_]] tag with result of TableOfContentsFilter As its name describes, to have a table of contents you need to write the following: [[_TOC_]] All together, you can write something like: This is a page for my project ...
GitLab
47,154,661
26
I am trying to Google it for few hours, but can't find it. I have Java/Spring application (+MySQL if it matters) and I am looking to create CI for that. I know what to do and how: I know that I have to move my Git repo to Gitlab. Push to repo will trigger CI script. Gitlab will build my docker image into Gitlab Docker...
What do I have to do to force docker compose on my VPS to pull the new image from Gitlab and restart the server? @m-uu, you don't need restart the server at all, just do docker-compose up to pull new image and restart service I know (correct me if I am wrong) that on my VPS I should run docker-compose pull && docke...
GitLab
44,545,635
26
I've set up my own Gitlab server with one project and a Gitlab runner configured for it. I'm new to continuous integration server and therefore don't know how to accomplish the following. Every time I commit to the master branch of my project I would like to deploy the repository to another server and run two shell-com...
You could use gitlab-ci and gitlab-runner [runners.ssh] to deploy to single or mutiple servers. the flow: (git_project with yml file) --> (gitlab && gitlab-ci) --> (gitlabrunner) ---runners.ssh---> (deployed_server,[deploye_server2]) you need register gitlab-runner to gitlab-ci and set the tag to delpoyServer on gi...
GitLab
33,768,537
26
I set up a fresh CentOS 6.6 install and used the Omniubus installer for the CE of Gitlab. When running gitlab-ctl reconfigure I get the following errors: ================================================================================ Recipe Compile Error in /opt/gitlab/embedded/cookbooks/gitlab/recipes/default.rb ====...
EDIT: This is now fixed with adding http:// or https:// to the domain in the .rb file. Tested on Debian 9 with Gitlab EE. Add a = sign to the gitlab.rb. It should be: external_url = 'gitlab.thefallenphoenix.net' gitlab_rails['gitlab_email_from'] = 'gitlab@thefallenphoenix.net' After that it should install fine. At le...
GitLab
26,660,084
26
See this huge identations is painful (for me). Is there a way to set tab size to 4 spaces. This picture is taken from local Gitlab CE server with minimal customization. I think tabsize 8 spaces is default.
Go to Settings → Preferences → Behavior and set Tab width.
GitLab
49,402,976
25
I have the following step in my declarative jenkins pipeline: I create script which comes from my resources/ folder using libraryResource. This script contains credentials for my autobuild user and for some admintest user. stage('Build1') { steps { node{ def s...
Sure, you can use one withCredentials block to assign multiple credentials to different variables. withCredentials([ usernamePassword(credentialsId: credsId1, usernameVariable: 'USER1', passwordVariable: 'PASS1'), usernamePassword(credentialsId: credsId2, usernameVariable: 'USER2', passwordVariable: 'PASS2') ])...
Jenkins
47,475,160
88
I have a Jenkinsfile with some global variables and some stages. can I update the global variable out from a stage? An example: pipeline { agent any environment { PASSWD = "${sh(returnStdout: true, script: 'python -u do_some_something.py')}" ACC = "HI" } stage('stage1') { when {...
You can't override the environment variable defined in the environment {} block. However, there is one trick you might want to use. You can refer to ACC environment variable in two ways: explicitly by env.ACC implicitly by ACC The value of env.ACC cannot be changed once set inside environment {} block, but ACC behave...
Jenkins
53,541,489
87
I have added an SSH credential to Jenkins. Unfortunately, I have forgotten the SSH passphrase and would now like to obtain it from Jenkins' credential archive, which is located at ${JENKINS_HOME}/credentials.xml. That XML document seems to have credentials encrypted in XML tags <passphrase> or <password>. How can I ret...
Open your Jenkins' installation's script console by visiting http(s)://${JENKINS_ADDRESS}/script. There, execute the following Groovy script: println( hudson.util.Secret.decrypt("${ENCRYPTED_PASSPHRASE_OR_PASSWORD}") ) where ${ENCRYPTED_PASSPHRASE_OR_PASSWORD} is the encrypted content of the <password> or <passphrase>...
Jenkins
37,683,143
87
I am having issues with sonar picking up the jacoco analysis report. Jenkins however is able to pick up the report and display the results. My project is a maven build, built by Jenkins. The jacoco report is generated by maven (configured in the pom). Sonar is executed by using the Jenkins plugin. This is what I see on...
You were missing a few important sonar properties, Here is a sample from one of my builds: sonar.jdbc.dialect=mssql sonar.projectKey=projectname sonar.projectName=Project Name sonar.projectVersion=1.0 sonar.sources=src sonar.language=java sonar.binaries=build/classes sonar.tests=junit sonar.dynamicAnalysis=reuseReports...
Jenkins
22,174,501
86
I am trying to execute a shell script if either the build pass or fails after post-build in Jenkins. I cannot see this option in post build to execute some shell script except for running a target.
Very easily done with Post build task plugin.
Jenkins
11,160,363
86
You have a project which has got some SW requirements to run (e.g.: a specific version of Apache, a version of PHP, an instance of a MySQL database and a couple of other pieces of software). You have already discovered Vagrant, so your virtual environment is all setup. You can create boxes out of your configuration fil...
it is a good solution for build system, my suggestion: Your current jenkins works as master CI (probably started by user jenkins) Create another user in same machine or another machine to work as jenkins slave mode jenkins slave can be invoked from jenkins master, and it can use different user like vagrant who had p...
Jenkins
6,941,547
86
I've been dealing with the problem of scaling CI at my company and at the same time trying to figure out which approach to take when it comes to CI and multiple branches. There is a similar question at stackoverflow, Multiple feature branches and continuous integration. I've started a new one because I'd like to get mo...
When you talk about scaling CI you're really talking about scaling the use of your CI server to handle all your feature branches along with your mainline. Initially this looks like a good approach as the developers in a branch get all the advantages of the automated testing that the CI jobs include. However, you run in...
Jenkins
5,611,365
86
I am building a workflow with Gitlab, Jenkins and - probably - Nexus (I need an artifact storage). I would like to have GitLab to store releases/binaries - is it possible in a convenient way? I would not like to have another service from which a release (and documentation) could be downloaded but to have it somehow int...
Update Oct. 2020: GitLab 13.5 now offers: Attach binary assets to Releases If you aren’t currently using GitLab for your releases because you can’t attach binaries to releases, your workflow just got a lot simpler. You now have the ability to attach binaries to a release tag from the gitlab.ci-yml. This extends suppor...
Jenkins
29,013,457
85
I need to launch a dynamic set of tests in a declarative pipeline. For better visualization purposes, I'd like to create a stage for each test. Is there a way to do so? The only way to create a stage I know is: stage('foo') { ... } I've seen this example, but I it does not use declarative syntax.
Use the scripted syntax that allows more flexibility than the declarative syntax, even though the declarative is more documented and recommended. For example stages can be created in a loop: def tests = params.Tests.split(',') for (int i = 0; i < tests.length; i++) { stage("Test ${tests[i]}") { sh '....' ...
Jenkins
42,837,066
85
I don't know Jenkins at all. I want to install Jenkins on Windows 10. I downloaded the installer and ran it, but I have a problem. I don't know what to enter in the "Account" and "Password" fields on the "Service Logon Credentials" stage. if I use the username and password of my Windows account(with administrator priv...
When installing a service to run under a domain user account, the account must have the right to logon as a service. This logon permission applies strictly to the local computer and must be granted in the Local Security Policy. Perform the following to edit the Local Security Policy of the computer you want to define ...
Jenkins
63,410,442
84
I'm following guideline how to sign Android apk with Jenkins. I have parametrized Jenkins job with KSTOREPWD and KEYPWD. A part of Jenkins' job configuration (Build->Execute shell) is to take those parameters and store them as environment variables: export KSTOREPWD=${KSTOREPWD} export KEYPWD=${KEYPWD} ... ./gradlew as...
By default, Jenkins launches Execute Shell script with set -x. This causes all commands to be echoed You can type set +x before any command to temporary override that behavior. Of course you will need set -x to start showing them again. You can override this behaviour for the whole script by putting the following at th...
Jenkins
26,797,219
84
A windows slave node connected to Jenkins server through "Java web start". The system information of the node doesn't have it's IP address. I had to run through all the slaves node we had, and find which machine (ip address) corresponds to the slave node in Jenkins. Is there a way to find the IP address of a slave ...
Through the Script Console (Manage Jenkins -> Nodes -> Select a node -> Script Console) of the node we can execute groovy script. Run the following command to get the IP address. println InetAddress.localHost.canonicalHostName
Jenkins
14,930,329
84
With the release of Xcode 8, Apple introduced a new way of managing the signing configuration. Now you have two options Manual and Automatic. According to the WWDC 2016 Session about Code signing (WWDC 2016 - 401 - What's new in Xcode app signing), when you select Automatic signing, Xcode is going to: Create signing c...
I basically run into the same issue using Jenkins CI and the Xcode Plugin. I ended up doing the build and codesigning stuff myself using xcodebuild. 0. Prerequisites In order to get the following steps done successfully, you need to have installed the necessary provisioning profiles and certificates. That means your co...
Jenkins
39,500,634
83
I have a job called "development" and another project called "code analysis". At the moment we have two different jobs and different workspaces, but same code; is there any way we could use the same workspace for multiple jobs?I checked the plugins available in Jenkins but I haven't found any suitable one.
Suppose your "development" Jenkins job workspace is /var/workspace/job1. In the "code analysis" job configuration page, under the tab General click on Advanced... and select the option Use custom workspace and give the same workspace /var/workspace/job1 as of your "development" job.
Jenkins
21,520,475
81
A step in my pipeline uploads a .tar to an artifactory server. I am getting a Bad substitution error when passing in env.BUILD_NUMBER, but the same commands works when the number is hard coded. The script is written in groovy through jenkins and is running in the jenkins workspace. sh 'curl -v --user user:password --da...
This turned out to be a syntax issue. Wrapping the command in ''s caused ${env.BUILD_NUMBER to be passed instead of its value. I wrapped the whole command in "s and escaped the nested. Works fine now. sh "curl -v --user user:password --data-binary ${buildDir}package${env.BUILD_NUMBER}.tar -X PUT \"http://artifactory.my...
Jenkins
37,219,348
80
What plugins and plugin features do I need to set in order to get my Jenkins job to trigger a build any time code is committed to an SVN project? I have installed both the standard SVN plugin as well as the SVN tagging plugin, but I do not see any new features that allow trigger configuration.
There are two ways to go about this: I recommend the first option initially, due to its ease of implementation. Once you mature in your build processes, switch over to the second. Poll the repository to see if changes occurred. This might "skip" a commit if two commits come in within the same polling interval. Desc...
Jenkins
10,014,252
80
How do I schedule a Jenkins build such that it would be able to build only at specific hours every day? For example to start at 4 PM 0 16 1-7 * * I understand that as, "at 0 minutes, at 4 o'clock PM, from Monday to Sunday, every month", however it builds every minute :( I would be grateful for any advice. Thanks!
Update: please read the other answers and comments as they contain more info (e.g., hash functions) that I did not know when I first answered this question. According to Jenkins' own help (the "?" button) for the schedule task, 5 fields are specified: This field follows the syntax of cron (with minor differences). Spe...
Jenkins
7,000,251
80
How can I specify something like the following in my Jenkinsfile? when branch not x I know how to specify branch specific tasks like: stage('Master Branch Tasks') { when { branch "master" } steps { sh '''#!/bin/bash -l Do some stuff here ''' } } ...
With this issue resolved, you can now do this: stage('Example (Not master)') { when { not { branch 'master' } } steps { sh 'do-non-master.sh' } }
Jenkins
43,578,528
79
I'm trying to use Jenkins (Global) environment variables in my xcopy script. ${WORKSPACE} doesn't work "${WORKSPACE}" doesn't work '${WORKSPACE}' doesn't work
I know nothing about Jenkins, but it looks like you are trying to access environment variables using some form of unix syntax - that won't work. If the name of the variable is WORKSPACE, then the value is expanded in Windows batch using %WORKSPACE%. That form of expansion is performed at parse time. For example, this w...
Jenkins
8,606,664
78
I'm currently using jenkins/hudson for continuous integration a large mostly C++ project. We have separate projects for trunk and every branch. Also, there are some related projects for the Java code, but the setup for those are fairly basic right now (we may do more later though). The C++ projects do the following:...
Both are open source projects, but you do not need to change buildbot code to "extend" it, it is actually quite easy to import your own packages in its configuration in which you can sub-class most of the features with your own additions. Examples: your own compilation or test code, some parsing of outputs/errors to be...
Jenkins
5,653,372
78
What is the maximum number of jobs I can run concurrently in Jenkins?
The maximum number of Jenkins jobs is dependent upon what you set as the limits in the master and slaves. Usually, we limit by the number of cores, but your mileage may vary depending upon available memory, disk speed, availability of SSD, and overlap of source code. For the master, this is set in Manage Jenkins > Co...
Jenkins
9,626,899
77
I'm using a EC2 server instance. Used the following to install Jenkins: wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add - sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list' sudo apt-get update sudo apt-get install jenkins but I need...
Here is how you can fix it: Stop Jenkins Go go edit /var/lib/jenkins/config.xml Change <useSecurity>true</useSecurity> to false Restart Jenkins: sudo service jenkins restart Navigate to the Jenkins dashboard to the "Configure Security" option you likely used before. This time, setup security the same as before, BUT s...
Jenkins
15,227,305
76
I am looking at limiting the number of concurrent builds to a specific number in Jenkins, leveraging the multibranch pipeline workflow but haven't found any good way to do this in the docs or google. Some docs say this can be accomplished using concurrency in the stage step of a Jenkinsfile but I've also read elsewhere...
Found what I was looking for. You can limit the concurrent builds using the following block in your Jenkinsfile. node { // This limits build concurrency to 1 per branch properties([disableConcurrentBuilds()]) //do stuff ... } The same can be achieved with a declarative syntax: pipeline { options { ...
Jenkins
41,492,688
76
For Jenkins using a Groovy System Script, is there a way to easily search the build queue and list of executing builds for some criteria (specifically a parameter that matches some condition) and then kill/cancel them? I cannot seem to find any way to do this, but it seems like it should be possible.
I haven't tested it myself, but looking at the API it should be possible in the following way: import hudson.model.* import jenkins.model.Jenkins def q = Jenkins.instance.queue q.items.findAll { it.task.name.startsWith('my') }.each { q.cancel(it.task) } Relevant API links: http://javadoc.jenkins-ci.org/jenkins/mode...
Jenkins
12,305,244
76
With Jenkins 2 Pipeline plugin, there's a useful feature allowing a quick overview of the pipeline stages and status of steps, including logging output. However, if you use the "Shell script" (sh) step, there doesn't seem to be a way to label that script with a useful name, so the display merely shows a long list of "S...
Update Feb 2019: According to gertvdijk's answer below, it is now possible to assign an optional label to the sh step, starting from v2.28, and for those who can't upgrade yet, there's also a workaround. Please check his answer for details and comments! Previous version (hover to see it): As far as I know, that's cu...
Jenkins
39,414,921
75
Recently, in our company, we decided to use Ansible for deployment and continuous integration. But when I started using Ansible I didn't find modules for building Java projects with Maven, or modules for running JUnit tests, or JMeter tests. So, I'm in a doubtful state: it may be I'm using Ansible in a wrong way. Whe...
First, Jenkins and Hudson are basically the same project. I'll refer to it as Jenkins below. See How to choose between Hudson and Jenkins?, Hudson vs Jenkins in 2012, and What is the most notable difference between Jenkins and Hudson from a user perpective? for more. Second, Ansible isn't meant to be a continuous integ...
Jenkins
25,842,718
75
What shell is used in Jenkins when calling the shell command? I'm running Jenkins on a Linux machine.
From the help/question mark icon of the "Execute shell" section: Runs a shell script (defaults to sh, but this is configurable) for building the project. If you go to Manage Jenkins --> Configure System you will find an option (called "Shell executable") to set the name or absolute path to the shell that you want ...
Jenkins
12,455,932
75
I have a parameterized Jenkins job which requires the input of a specific Git branch in a specific Git repo. Currently this parameter is a string parameter. Is there any way to make this parameter a choice parameter and dynamically fill the drop down list with the Git branches? I don't want to require someone to main...
I tried a couple of answers mentioned in this link, but couldn't figure out how to tell Jenkins about the user-selected branch. As mentioned in my previous comment in above thread, I had left the branch selector field empty. But, during further investigations, I found another way to do the same thing - https://wiki.je...
Jenkins
10,433,105
74
I have been trying to follow the instructions on how to change the default view in Jenkins here. I've created another view that I would like to be the default, but when I go looking for the Default View setting in Manage Jenkins -> Configure System it doesn't seem to be there. Is there something I have to do to make i...
from comment> When I go to Manage Jenkins -> Configure System and Default View, all our "public" views are listed there in the drop down. Make sure the view you created isn't just in "My Views" for your user, and is open to everyone.
Jenkins
8,822,200
74
In Jenkins, is there a way to restrict certain jobs so that only specific users can view them? Jenkins allows the restriction of user-abilities-per-project via the "Project-based Matrix Authorization Strategy". The problem is that a user can not access anything without the 'Overall' 'Read' setting. This seems to allo...
Think this is, what you are searching for: Allow access to specific projects for Users Short description without screenshots: Use Jenkins "Project-based Matrix Authorization Strategy" under "Manage Jenkins" => "Configure System". On the configuration page of each project, you now have "Enable project-based security". N...
Jenkins
8,323,129
74
Is there a one-command way to get an up-to-date mirror of a remote repo? That is if local repo not there yet: clone if it's there: pull I know I could script this around (e.g if [ -d repo ]; then (cd repo && git pull); else git clone $repourl;fi ) , but I need the simplest possible cross-platform way (actually used ...
There is not, given that the commands which operate on existing repos all assume that they're being run inside a given repo. That said, if you're running in a shell, you could simply make use of the shell built-ins. For instance, here's bash: if cd repo; then git pull; else git clone https://server/repo repo; fi This ...
Jenkins
15,602,059
73
I have a large repository in Git. How do I create a job in Jenkins that checks out just one sub-folder from the project?
Jenkins Git Plugin support sparse checkouts since git-plugin 2.1.0 (April, 2014). You will need git >= 1.7.0 for this feature. It is under "Additional Behaviors" -> "Sparse Checkout paths." See: Jira issue JENKINS-21809
Jenkins
10,791,472
73
I can find the current git branch name by doing either of these: git branch | awk '/^\*/ { print $2 }' git describe --contains --all HEAD But when in a detached HEAD state, such as in the post build phase in a Jenkins maven build (or in a Travis git fetch), these commands doesn't work. My current working solution is t...
A more porcelain way: git log -n 1 --pretty=%d HEAD # or equivalently: git show -s --pretty=%d HEAD The refs will be listed in the format (HEAD, master) - you'll have to parse it a little bit if you intend to use this in scripts rather than for human consumption. You could also implement it yourself a little more cle...
Jenkins
6,059,336
73
I have windows 10 and I want to execute the sh command in the Jenkinsfile from Jenkins pipeline using bash for Ubuntu for windows, but it doesn't work I have the following stage in my Jenkins pipeline : stage('sh how to') { steps { sh 'ls -l' } } The error message is : [C:\Program File...
From a very quick search, it looks like your error is related to the following issue : JENKINS-33708 The main cause looks like the sh step is not supported on the Windows. You may use bat or install Cygwin for instance. Nevertheless two solutions were proposed in the previous link, suggesting you to do the following s...
Jenkins
45,140,614
72
I am new in using maven and jenkins. I am trying to inherit the dependencies from parent pom to child pom it shows the following errors: [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /D:/jenkins/workspace/CBAW/testP/WSW_Investment/src/main/java/com/td/inv/wss/...
You should declare dependencies you want to inherit under a <dependencies> section to achieve this. <dependencyManagement> is used for definitions that must be referenced later, whenever needed, within the <dependencies> of a particular child to become effective. UPDATE: Be careful when declaring dependencies that ever...
Jenkins
38,882,221
72
What is the major difference between Job DSL Plugin and Pipeline Plugin both provide way to programmatic job creation which is the best to use as moving ahead and why? if both have similar functionality, do they have different use cases? Since Jenkins 2.0 is focusing on Pipelines as code, does this mean that job-dsl ...
I have extensive experience with both. A concise reply is that Job DSL has existed for much longer and was Netflix's open source solution for "coding" Jenkins. It allowed you to introduce logic and variables into scripting your Jenkins jobs and typically one would use these jobs to form some sort of "pipeline" for a pa...
Jenkins
37,657,810
72
In order to get the fastest feedback possible, we occasionally want Jenkins jobs to run in Parallel. Jenkins has the ability to start multiple downstream jobs (or 'fork' the pipeline) when a job finishes. However, Jenkins doesn't seem to have any way of making a downstream job only start of all branches of that fork su...
Pipeline plugin You can use the Pipeline Plugin (formerly workflow-plugin). It comes with many examples, and you can follow this tutorial. e.g. // build stage 'build' ... // deploy stage 'deploy' ... // run tests in parallel stage 'test' parallel 'functional': { ... }, 'performance': { ... } // promote artifacts...
Jenkins
9,012,310
72
I think the title sums it up. I just want to know why one or the other is better for continous integration builds of Java projects from Svn.
I agree with this answer, but wanted to add a few points. In short, Hudson (update: Jenkins) is likely the better choice now. First and foremost because creating and configuring jobs ("projects" in CC vocabulary) is just so much faster through Hudson's web UI, compared to editing CruiseControl's XML configuration file ...
Jenkins
604,385
72
I have a couple of jobs that use a shared resource (database), which sometimes can cause builds to fail in the (rare) event that the jobs happen to get triggered simultaneously. Given jobs A through E, for example, is there any way to specify that A and C should never be run concurrently? Other than the aforementioned...
There are currently 2 ways of doing this: Use the Throttle Concurrent Builds plugin. Set up those jobs to run on a slave having only 1 executor.
Jenkins
6,276,272
71
I'm using Jenkins v2.1 with the integrated delivery pipeline feature (https://jenkins.io/solutions/pipeline/) to orchestrate two existing builds (build and deploy). In my parameterized build I have 3 user parameters setup, which also needs to be selectable in the pipeline. The pipeline script is as follows: node: { ...
In addition to Jesse Glick answer, if you want to pass string parameter then use: build job: 'your-job-name', parameters: [ string(name: 'passed_build_number_param', value: String.valueOf(BUILD_NUMBER)), string(name: 'complex_param', value: 'prefix-' + String.valueOf(BUILD_NUMBER)) ]
Jenkins
37,025,175
70
I choose to use "Jenkins's own user database" security realm for user login as I couldn't use LDAP in my company. And Google's OpenID has issue when you decided to change the hostname or port number to something else. And I use "Project-based Matrix Authorization Strategy" schema for my security. But I don't seem to a...
According to this posting by the lead Jenkins developer, Kohsuke Kawaguchi, in 2009, there is no group support for the built-in Jenkins user database. Group support is only usable when integrating Jenkins with LDAP or Active Directory. This appears to be the same in 2012. However, as Vadim wrote in his answer, you don'...
Jenkins
11,855,944
70
Is there a way to get the jobname for the current build in jenkins and pass it as a parameter to an ant build script?
Jenkins sets some environment variables such as JOB_NAME (see here) for more details on the variables set. You can then access these in ant via ${env.JOB_NAME}. Edit: There's also a little howto for environment variables on the same page here.
Jenkins
8,309,383
70
I want to configure jenkins so that it starts building if a new tag is released in any branch of an git repository. How do I configure this behaviour? Triggering:
Set refspec to: +refs/tags/*:refs/remotes/origin/tags/* branch specifier: ** Under build triggers check Build when a change is pushed to GitHub
Jenkins
29,742,847
69
I'm new to Jenkins and git too. I created a remote repository at github.com and made a local copy of it. Then I want to link it through Jenkins. I installed needed plugins for git integration, but I don't know what my local Repository URL is to set it when configuring the new project. Could someone help me where to fin...
In this case, the URL should start with the file protocol followed by the path to the repository. E.g., file:///home/rbkcbeqc/dev/git/gitsandbox.
Jenkins
10,498,554
69
I'm trying to replace our current build pipeline, currently hacked together using old-school Jenkins jobs, with a new job that uses the Jenkins pipeline plugin, and loads a Jenkinsfile from the project repository. One thing that the legacy job did was set the build description to include the Mercurial hash, username an...
Just figured it out. The pipeline job exposes a currentBuild global variable with writable properties. Setting the description can be done with: currentBuild.description = "my new description" anywhere in the pipeline script. More information in this DZone tutorial.
Jenkins
36,501,203
68
I have a jenkins job that clones the repository from github, then runs the powershell script that increments the version number in the file. I'm now trying to publish that update file back to the original repository on github, so when developer pulls the changes he gets the latest version number. I tried using Git Publ...
The git checkout master of the answer by Woland isn't needed. Instead use the "Checkout to specific local branch" in the "Additional Behaviors" section to set the "Branch name" to master. The git commit -am "blah" is still needed. Now you can use the "Git Publisher" under "Post-build Actions" to push the changes. Be s...
Jenkins
19,922,435
68
I am struggling with an error with a multi-modules project, the struture is simple, it looks like this : root module a module b module c pom.xml After using the maven command line : clean sonar:sonar deploy I have this error : Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0...
You're running your Maven steps in the wrong order: clean - delete all previous build output sonar:sonar - run analysis (which requires build output) deploy - build &etc... Try this instead: mvn clean deploy sonar:sonar Now if you're about to object that you don't want to actually "deploy" the jar until/unless the c...
Jenkins
46,976,567
67
I'm new to Jenkins pipeline; I'm defining a declarative syntax pipeline and I don't know if I can solve my problem, because I didn't find a solution. In this example, I need to pass a variable to ansible plugin (in old version I use an ENV_VAR or injecting it from file with inject plugin) that variable comes from a scr...
You can create variables before the pipeline block starts. You can have sh return stdout to assign to these variables. You don't have the same flexibility to assign to environment variables in the environment stanza. So substitute in python3.5 get_version.py where I have echo 0.0.1 in the script here (and make sure you...
Jenkins
43,879,733
67
Using the Pipeline plugin in Jenkins 2.x, how can I access a Groovy variable that is defined somewhere at stage- or node-level from within a sh step? Simple example: node { stage('Test Stage') { some_var = 'Hello World' // this is Groovy echo some_var // printing via Groovy works sh 'echo $s...
To use a templatable string, where variables are substituted into a string, use double quotes. sh "echo $some_var"
Jenkins
39,982,414
67