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
I am looking for a way to get all of the letters in a string before a : but I have no idea on where to start. Would I use regex? If so how? string = "Username: How are you today?" Can someone show me a example on what I could do?
Just use the split function. It returns a list, so you can keep the first element: >>> s1.split(':') ['Username', ' How are you today?'] >>> s1.split(':')[0] 'Username'
Split
27,387,415
212
I want to split a string by '=' charecter. But I want it to split on first instance only. How can I do that ? Here is a JavaScript example for '_' char but it doesn't work for me split string only on first instance of specified character Example : apple=fruit table price=5 When I try String.split('='); it gives [appl...
string.split("=", limit=2); As String.split(java.lang.String regex, int limit) explains: The array returned by this method contains each substring of this string that is terminated by another substring that matches the given expression or is terminated by the end of the string. The substrings in the array are in the ...
Split
18,462,826
204
How do I write a function to split and return an array for a string with delimiters in the C programming language? char* str = "JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC"; str_split(str,',');
You can use the strtok() function to split a string (and specify the delimiter to use). Note that strtok() will modify the string passed into it. If the original string is required elsewhere make a copy of it and pass the copy to strtok(). EDIT: Example (note it does not handle consecutive delimiters, "JAN,,,FEB,MAR" f...
Split
9,210,528
201
I am using split('\n') to get lines in one string, and found that ''.split() returns an empty list, [], while ''.split('\n') returns ['']. Is there any specific reason for such a difference? And is there any more convenient way to count lines in a string?
Question: I am using split('\n') to get lines in one string, and found that ''.split() returns an empty list, [], while ''.split('\n') returns ['']. The str.split() method has two algorithms. If no arguments are given, it splits on repeated runs of whitespace. However, if an argument is given, it is treated as a s...
Split
16,645,083
197
i am having trouble splitting a string in c# with a delimiter of "][". For example the string "abc][rfd][5][,][." Should yield an array containing; abc rfd 5 , . But I cannot seem to get it to work, even if I try RegEx I cannot get a split on the delimiter. EDIT: Essentially I wanted to resolve this issue without the...
To show both string.Split and Regex usage: string input = "abc][rfd][5][,][."; string[] parts1 = input.Split(new string[] { "][" }, StringSplitOptions.None); string[] parts2 = Regex.Split(input, @"\]\[");
Split
1,254,577
197
I have a SQL Server 2008 R2 column containing a string which I need to split by a comma. I have seen many answers on StackOverflow but none of them works in R2. I have made sure I have select permissions on any split function examples. Any help greatly appreciated.
I've used this SQL before which may work for you:- CREATE FUNCTION dbo.splitstring ( @stringToSplit VARCHAR(MAX) ) RETURNS @returnList TABLE ([Name] [nvarchar] (500)) AS BEGIN DECLARE @name NVARCHAR(255) DECLARE @pos INT WHILE CHARINDEX(',', @stringToSplit) > 0 BEGIN SELECT @pos = CHARINDEX(',', @stringToSpli...
Split
10,914,576
191
I have emacs split horizontally - on top I'm editing Perl code, the bottom is the shell. By default emacs makes the two windows equal in size, but I'd like the shell buffer smaller (maybe half the size?). I was wondering how I could do that.
With the mouse, you can drag the window sizes around. Click anywhere on the mode line that is not otherwise 'active' (the buffer name is safe, or any unused area to the right hand side), and you can drag up or down. Side-to-side dragging requires a very precise click on the spot where the two mode lines join. C-x - (sh...
Split
4,987,760
190
I have a text file. I need to get a list of sentences. How can this be implemented? There are a lot of subtleties, such as a dot being used in abbreviations. My old regular expression works badly: re.compile('(\. |^|!|\?)([A-Z][^;↑\.<>@\^&/\[\]]*(\.|!|\?) )',re.M)
The Natural Language Toolkit (nltk.org) has what you need. This group posting indicates this does it: import nltk.data tokenizer = nltk.data.load('tokenizers/punkt/english.pickle') fp = open("test.txt") data = fp.read() print '\n-----\n'.join(tokenizer.tokenize(data)) (I haven't tried it!)
Split
4,576,077
187
I have two tmux windows, with a single pane in each, and I would like to join these two panes together into a single window as a horizontal split panes. How could I do that?
Actually I found the way to do that. Suppose the two windows are number 1 and 2. Use join-pane -s 2 -t 1 This will move the 2nd window as a pane to the 1st window. The opposite command is break-pane
Split
9,592,969
183
I am using the String split method and I want to have the last element. The size of the Array can change. Example: String one = "Düsseldorf - Zentrum - Günnewig Uebachs" String two = "Düsseldorf - Madison" I want to split the above Strings and get the last item: lastone = one.split("-")[here the last item] // <- how? ...
You could use lastIndexOf() method on String String last = string.substring(string.lastIndexOf('-') + 1);
Split
1,181,969
178
I have the output of a command in tabular form. I'm parsing this output from a result file and storing it in a string. Each element in one row is separated by one or more whitespace characters, thus I'm using regular expressions to match 1 or more spaces and split it. However, a space is being inserted between every el...
By using (,), you are capturing the group, if you simply remove them you will not have this problem. >>> str1 = "a b c d" >>> re.split(" +", str1) ['a', 'b', 'c', 'd'] However there is no need for regex, str.split without any delimiter specified will split this by whitespace for you. This would be the best...
Split
10,974,932
176
What is the point of '/segment/segment/'.split('/') returning ['', 'segment', 'segment', '']? Notice the empty elements. If you're splitting on a delimiter that happens to be at position one and at the very end of a string, what extra value does it give you to have the empty string returned from each end?
str.split complements str.join, so "/".join(['', 'segment', 'segment', '']) gets you back the original string. If the empty strings were not there, the first and last '/' would be missing after the join().
Split
2,197,451
175
I am trying to use train_test_split from package scikit Learn, but I am having trouble with parameter stratify. Hereafter is the code: from sklearn import cross_validation, datasets X = iris.data[:,:2] y = iris.target cross_validation.train_test_split(X,y,stratify=y) However, I keep getting the following problem: r...
This stratify parameter makes a split so that the proportion of values in the sample produced will be the same as the proportion of values provided by parameter stratify. For example: a binary categorical classification problem, if y is the dependent variable or target\label column within dataframe following values: 0...
Split
34,842,405
172
I want to format this date: <div id="date">23/05/2013</div>. First I want to split the string at the first / and have the rest in the next line. Next, I’d like to surround the first part in a <span> tag, as follows: <div id="date"> <span>23</span> 05/2013</div> 23 05/2013 What I did: <script src="https://cdnjs.cl...
Using split() Snippet : var data =$('#date').text(); var arr = data.split('/'); $("#date").html("<span>"+arr[0] + "</span></br>" + arr[1]+"/"+arr[2]); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="date">23/05/2013</div> Fiddle When you split this string ---...
Split
16,711,504
169
In Python it is possible to split a string and assign it to variables: ip, port = '127.0.0.1:5432'.split(':') but in Go it does not seem to work: ip, port := strings.Split("127.0.0.1:5432", ":") // assignment count mismatch: 2 = 1 Question: How to split a string and assign values in one step?
Two steps, for example, package main import ( "fmt" "strings" ) func main() { s := strings.Split("127.0.0.1:5432", ":") ip, port := s[0], s[1] fmt.Println(ip, port) } Output: 127.0.0.1 5432 One step, for example, package main import ( "fmt" "net" ) func main() { host, port, err := ...
Split
16,551,354
168
I want to split this line: string line = "First Name ; string ; firstName"; into an array of their trimmed versions: "First Name" "string" "firstName" How can I do this all on one line? The following gives me an error "cannot convert type void": List<string> parts = line.Split(';').ToList().ForEach(p => p.Trim());
Try List<string> parts = line.Split(';').Select(p => p.Trim()).ToList(); FYI, the Foreach method takes an Action (takes T and returns void) for parameter, and your lambda return a string as string.Trim return a string Foreach extension method is meant to modify the state of objects within the collection. As string are...
Split
1,728,303
168
I just learned about Java's Scanner class and now I'm wondering how it compares/competes with the StringTokenizer and String.Split. I know that the StringTokenizer and String.Split only work on Strings, so why would I want to use the Scanner for a String? Is Scanner just intended to be one-stop-shopping for spliting?
They're essentially horses for courses. Scanner is designed for cases where you need to parse a string, pulling out data of different types. It's very flexible, but arguably doesn't give you the simplest API for simply getting an array of strings delimited by a particular expression. String.split() and Pattern.split()...
Split
691,184
168
Why am I getting... Uncaught TypeError: string.split is not a function ...when I run... var string = document.location; var split = string.split('/');
Change this... var string = document.location; to this... var string = document.location + ''; This is because document.location is a Location object. The default .toString() returns the location in string form, so the concatenation will trigger that. You could also use document.URL to get a string.
Split
10,145,946
158
How to split the string "Thequickbrownfoxjumps" to substrings of equal size in Java. Eg. "Thequickbrownfoxjumps" of 4 equal size should give the output. ["Theq","uick","brow","nfox","jump","s"] Similar Question: Split string into equal-length substrings in Scala
Here's the regex one-liner version: System.out.println(Arrays.toString( "Thequickbrownfoxjumps".split("(?<=\\G.{4})") )); \G is a zero-width assertion that matches the position where the previous match ended. If there was no previous match, it matches the beginning of the input, the same as \A. The enclosing loo...
Split
3,760,152
157
I have a data frame, like so: data.frame(director = c("Aaron Blaise,Bob Walker", "Akira Kurosawa", "Alan J. Pakula", "Alan Parker", "Alejandro Amenabar", "Alejandro Gonzalez Inarritu", "Alejandro Gonzalez Inarritu,Benicio Del Toro", "Alejandro González Iñárritu", ...
Several alternatives: 1) two ways with data.table: library(data.table) # method 1 (preferred) setDT(v)[, lapply(.SD, function(x) unlist(tstrsplit(x, ",", fixed=TRUE))), by = AB ][!is.na(director)] # method 2 setDT(v)[, strsplit(as.character(director), ",", fixed=TRUE), by = .(AB, director) ][,.(direct...
Split
13,773,770
157
I have a log file with size of 2.5 GB. Is there any way to split this file into smaller files using windows command prompt?
If you have installed Git for Windows, you should have Git Bash installed, since that comes with Git. Use the split command in Git Bash to split a file: into files of size 500MB each: split myLargeFile.txt -b 500m into files with 10000 lines each: split myLargeFile.txt -l 10000 Tips: If you don't have Git/Git Bash...
Split
31,786,287
155
Input: "tableapplechairtablecupboard..." many words What would be an efficient algorithm to split such text to the list of words and get: Output: ["table", "apple", "chair", "table", ["cupboard", ["cup", "board"]], ...] First thing that cames to mind is to go through all possible words (starting with first letter) ...
A naive algorithm won't give good results when applied to real-world data. Here is a 20-line algorithm that exploits relative word frequency to give accurate results for real-word text. (If you want an answer to your original question which does not use word frequency, you need to refine what exactly is meant by "longe...
Split
8,870,261
154
I have DataFrame with column Sales. How can I split it into 2 based on Sales value? First DataFrame will have data with 'Sales' < s and second with 'Sales' >= s
You can use boolean indexing: df = pd.DataFrame({'Sales':[10,20,30,40,50], 'A':[3,4,7,6,1]}) print (df) A Sales 0 3 10 1 4 20 2 7 30 3 6 40 4 1 50 s = 30 df1 = df[df['Sales'] >= s] print (df1) A Sales 2 7 30 3 6 40 4 1 50 df2 = df[df['Sales'] < s] print (df2) A Sal...
Split
33,742,588
153
I'm using jQuery, and I have a textarea. When I submit by my button I will alert each text separated by newline. How to split my text when there is a newline? var ks = $('#keywords').val().split("\n"); (function($){ $(document).ready(function(){ $('#data').submit(function(e){ e.preventDefaul...
You should parse newlines regardless of the platform (operation system) This split is universal with regular expressions. You may consider using this: var ks = $('#keywords').val().split(/\r?\n/); E.g. "a\nb\r\nc\r\nlala".split(/\r?\n/) // ["a", "b", "c", "lala"]
Split
8,125,709
153
I need to split a String into an array of single character Strings. Eg, splitting "cat" would give the array "c", "a", "t"
"cat".split("(?!^)") This will produce array ["c", "a", "t"]
Split
5,235,401
152
What is the best way to split a string like "HELLO there HOW are YOU" by upper-case words? So I'd end up with an array like such: results = ['HELLO there', 'HOW are', 'YOU'] I have tried: p = re.compile("\b[A-Z]{2,}\b") print p.split(page_text) It doesn't seem to work, though.
I suggest l = re.compile("(?<!^)\s+(?=[A-Z])(?!.\s)").split(s) Check this demo.
Split
13,209,288
150
hello I am trying what I thought would be a rather easy regex in Javascript but is giving me lots of trouble. I want the ability to split a date via javascript splitting either by a '-','.','/' and ' '. var date = "02-25-2010"; var myregexp2 = new RegExp("-."); dateArray = date.split(myregexp2); What is the correct ...
You need the put the characters you wish to split on in a character class, which tells the regular expression engine "any of these characters is a match". For your purposes, this would look like: date.split(/[.,\/ -]/) Although dashes have special meaning in character classes as a range specifier (ie [a-z] means the s...
Split
3,559,883
149
I have a very large dataframe (around 1 million rows) with data from an experiment (60 respondents). I would like to split the dataframe into 60 dataframes (a dataframe for each participant). In the dataframe, data, there is a variable called 'name', which is the unique code for each participant. I have tried the follo...
Can I ask why not just do it by slicing the data frame. Something like #create some data with Names column data = pd.DataFrame({'Names': ['Joe', 'John', 'Jasper', 'Jez'] *4, 'Ob1' : np.random.rand(16), 'Ob2' : np.random.rand(16)}) #create unique list of names UniqueNames = data.Names.unique() #create a data frame dic...
Split
19,790,790
147
Invoking :help in Vim, I got the help manual page with split window. I want to maximize the help manual window and close the other window. How can I do this? What is the Vim command to do this?
You can employ Ctrl+WT (that's a capital T) to move any open window to its own tab. As mentioned by others Ctrl+W_ / Ctrl+W| to maximize within the current tab/window layout (while respecting min height/width settings for various other windows). (Ctrl+W= resizes all windows to equal size, respecting the minimum height/...
Split
7,830,817
142
I have a string = "name"; I want to convert into a string array. How do I do it? Is there any java built in function? Manually I can do it but I'm searching for a java built in function. I want an array where each character of the string will be a string. like char 'n' will be now string "n" stored in an array.
To start you off on your assignment, String.split splits strings on a regular expression and this expression may be an empty string: String[] ary = "abc".split(""); Yields the array: (java.lang.String[]) [, a, b, c] Getting rid of the empty 1st entry is left as an exercise for the reader :-) Note: In Java 8, the empt...
Split
3,413,586
142
I've got a table field membername which contains both the last name and the first name of users. Is it possible to split those into 2 fields memberfirst, memberlast? All the records have this format "Firstname Lastname" (without quotes and a space in between).
Unfortunately MySQL does not feature a split string function. However you can create a user defined function for this, such as the one described in the following article: MySQL Split String Function by Federico Cargnelutti With that function: DELIMITER $$ CREATE FUNCTION SPLIT_STR( x VARCHAR(255), delim VARCHAR...
Split
2,696,884
139
How to split a List of elements into lists with at most N items? ex: Given a list with 7 elements, create groups of 4, leaving the last group possibly with less elements. split(List(1,2,3,4,5,6,"seven"),4) => List(List(1,2,3,4), List(5,6,"seven"))
I think you're looking for grouped. It returns an iterator, but you can convert the result to a list, scala> List(1,2,3,4,5,6,"seven").grouped(4).toList res0: List[List[Any]] = List(List(1, 2, 3, 4), List(5, 6, seven))
Split
7,459,174
137
Please explain to me the working of strtok() function. The manual says it breaks the string into tokens. I am unable to understand from the manual what it actually does. I added watches on str and *pch to check its working when the first while loop occurred, the contents of str were only "this". How did the output show...
the strtok runtime function works like this the first time you call strtok you provide a string that you want to tokenize char s[] = "this is a string"; in the above string space seems to be a good delimiter between words so lets use that: char* p = strtok(s, " "); what happens now is that 's' is searched until the s...
Split
3,889,992
136
I'm new to regular expressions and would appreciate your help. I'm trying to put together an expression that will split the example string using all spaces that are not surrounded by single or double quotes. My last attempt looks like this: (?!") and isn't quite working. It's splitting on the space before the quote. E...
I don't understand why all the others are proposing such complex regular expressions or such long code. Essentially, you want to grab two kinds of things from your string: sequences of characters that aren't spaces or quotes, and sequences of characters that begin and end with a quote, with no quotes in between, for t...
Split
366,202
135
This code almost does what I need it to.. for line in all_lines: s = line.split('>') Except it removes all the '>' delimiters. So, <html><head> Turns into ['<html','<head'] Is there a way to use the split() method but keep the delimiter, instead of removing it? With these results.. ['<html>','<head>']
d = ">" for line in all_lines: s = [e+d for e in line.split(d) if e]
Split
7,866,128
134
I am trying to split this string in python: 2.7.0_bf4fda703454 I want to split that string on the underscore _ so that I can use the value on the left side.
"2.7.0_bf4fda703454".split("_") gives a list of strings: In [1]: "2.7.0_bf4fda703454".split("_") Out[1]: ['2.7.0', 'bf4fda703454'] This splits the string at every underscore. If you want it to stop after the first split, use "2.7.0_bf4fda703454".split("_", 1). If you know for a fact that the string contains an undersc...
Split
5,749,195
133
I was wondering if it was possible to split a file into equal parts (edit: = all equal except for the last), without breaking the line? Using the split command in Unix, lines may be broken in half. Is there a way to, say, split up a file in 5 equal parts, but have it still only consist of whole lines (it's no problem i...
If you mean an equal number of lines, split has an option for this: split --lines=75 If you need to know what that 75 should really be for N equal parts, its: lines_per_part = int(total_lines + N - 1) / N where total lines can be obtained with wc -l. See the following script for an example: #!/usr/bin/bash # Configu...
Split
7,764,755
130
I have the following type of string var string = "'string, duppi, du', 23, lala" I want to split the string into an array on each comma, but only the commas outside the single quotation marks. I can't figure out the right regular expression for the split... string.split(/,/) will give me ["'string", " duppi", " du'",...
Disclaimer 2014-12-01 Update: The answer below works only for one very specific format of CSV. As correctly pointed out by DG in the comments, this solution does NOT fit the RFC 4180 definition of CSV and it also does NOT fit MS Excel format. This solution simply demonstrates how one can parse one (non-standard) CSV li...
Split
8,493,195
128
According to the Hadoop - The Definitive Guide The logical records that FileInputFormats define do not usually fit neatly into HDFS blocks. For example, a TextInputFormat’s logical records are lines, which will cross HDFS boundaries more often than not. This has no bearing on the functioning of your program—lines are ...
Interesting question, I spent some time looking at the code for the details and here are my thoughts. The splits are handled by the client by InputFormat.getSplits, so a look at FileInputFormat gives the following info: For each input file, get the file length, the block size and calculate the split size as max(minSiz...
Split
14,291,170
125
I am wondering if I am going about splitting a string on a . the right way? My code is: String[] fn = filename.split("."); return fn[0]; I only need the first part of the string, that's why I return the first item. I ask because I noticed in the API that . means any character, so now I'm stuck.
split() accepts a regular expression, so you need to escape . to not consider it as a regex meta character. Here's an example : String[] fn = filename.split("\\."); return fn[0];
Split
3,387,622
125
I have a column in a pandas DataFrame that I would like to split on a single space. The splitting is simple enough with DataFrame.str.split(' '), but I can't make a new column from the last entry. When I .str.split() the column I get a list of arrays and I don't know how to manipulate this to get a new column for my Da...
Do this: In [43]: temp2.str[-1] Out[43]: 0 p500 1 p600 2 p700 Name: ticker So all together it would be: >>> temp = pd.DataFrame({'ticker' : ['spx 5/25/2001 p500', 'spx 5/25/2001 p600', 'spx 5/25/2001 p700']}) >>> temp['ticker'].str.split(' ').str[-1] 0 p500 1 p600 2 p700 Name: ticker, dtype: object ...
Split
12,504,976
122
I would like to count the number of lines in a string. I tried to use this stackoverflow answer, lines = str.split("\r\n|\r|\n"); return lines.length; on this string (which was originally a buffer): GET / HTTP/1.1 Host: localhost:8888 Connection: keep-alive Cache-Control: max-age=0 User-Agent: Mozilla/5.0 (Maci...
Using a regular expression you can count the number of lines as str.split(/\r\n|\r|\n/).length Alternately you can try split method as below. var lines = $("#ptest").val().split("\n"); alert(lines.length); working solution: http://jsfiddle.net/C8CaX/
Split
8,488,729
121
Is there a function in python to split a word into a list of single letters? e.g: s = "Word to Split" to get wordlist = ['W', 'o', 'r', 'd', ' ', 't', 'o', ' ', 'S', 'p', 'l', 'i', 't']
>>> list("Word to Split") ['W', 'o', 'r', 'd', ' ', 't', 'o', ' ', 'S', 'p', 'l', 'i', 't']
Split
113,655
120
I've CSV file (around 10,000 rows ; each row having 300 columns) stored on LINUX server. I want to break this CSV file into 500 CSV files of 20 records each. (Each having same CSV header as present in original CSV) Is there any linux command to help this conversion?
Use the Linux split command: split -l 20 file.txt new Split the file "file.txt" into files beginning with the name "new" each containing 20 lines of text each. Type man split at the Unix prompt for more information. However you will have to first remove the header from file.txt (using the tail command, for example...
Split
20,721,120
118
Is there any way to split strings in objective c into arrays? I mean like this - input string Yes:0:42:value into an array of (Yes,0,42,value)?
NSArray *arrayOfComponents = [yourString componentsSeparatedByString:@":"]; where yourString contains @"one:two:three" and arrayOfComponents will contain @[@"one", @"two", @"three"] and you can access each with NSString *comp1 = arrayOfComponents[0]; (https://developer.apple.com/documentation/foundation/nsstring/1413...
Split
3,558,888
118
Before Java 8 when we split on empty string like String[] tokens = "abc".split(""); split mechanism would split in places marked with | |a|b|c| because empty space "" exists before and after each character. So as result it would generate at first this array ["", "a", "b", "c", ""] and later will remove trailing empt...
The behavior of String.split (which calls Pattern.split) changes between Java 7 and Java 8. Documentation Comparing between the documentation of Pattern.split in Java 7 and Java 8, we observe the following clause being added: When there is a positive-width match at the beginning of the input sequence then an empty lea...
Split
22,718,744
116
I am currently trying to split a string 1128-2 so that I can have two separate values. For example, value1: 1128 and value2: 2, so that I can then use each value separately. I have tried split() but with no success. Is there a specific way Grails handles this, or a better way of doing it?
Try: def (value1, value2) = '1128-2'.tokenize( '-' )
Split
16,450,680
116
I have a list: my_list = ['element1\t0238.94', 'element2\t2.3904', 'element3\t0139847'] How can I delete the \t and everything after to get this result: ['element1', 'element2', 'element3']
Something like: >>> l = ['element1\t0238.94', 'element2\t2.3904', 'element3\t0139847'] >>> [i.split('\t', 1)[0] for i in l] ['element1', 'element2', 'element3']
Split
6,696,027
110
I need to break apart a string that always looks like this: something -- something_else. I need to put "something_else" in another input field. Currently, this string example is being added to an HTML table row on the fly like this: tRow.append($('<td>').text($('[id$=txtEntry2]').val())); I figure "split" is the wa...
Documentation can be found e.g. at MDN. Note that .split() is not a jQuery method, but a native string method. If you use .split() on a string, then you get an array back with the substrings: var str = 'something -- something_else'; var substr = str.split(' -- '); // substr[0] contains "something" // substr[1] contain...
Split
2,555,794
110
I'm using the pipeline plugin for jenkins and I'd like to generate code coverage report for each run and display it along with the pipeline ui. Is there a plugin I can use to do that(e.g. Cobertura but it doesn't seem to be supported by pipeline)?
There is a way to add a pipeline step to publish your coverage report but it doesn't show under the BlueOcean interface. It will show fine in the normal UI. pipeline { agent any stages { ... } post { always { junit '**/nosetests.xml' step([$class: 'CoberturaPubli...
Jenkins
36,918,370
55
I'm aware that if we use a iFrame in HTML we've to sandbox it & add the 'allow-scripts' permission to be true. But my problem is I don't have a iFrame at all in my pure Angular JS application. When I run it on my local machine it works fine. The moment I deploy it to my server, Chrome displays this error message along ...
We were using this content HTML in a Jenkins userContent directory. We recently upgraded to the latest Jenkins 1.625 LTS version & it seems they've introduced new Content security policy which adds the below header to the response headers & the browsers simply decline to execute anything like stylesheets / Javascripts....
Jenkins
34,315,723
55
I am running Jenkins version 1.411 and use Maven for building. Even though the application builds successfully, Jenkins treats it as an unstable build. I have disabled all tests to isolate the problem. [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ----------...
It's some time ago that I used hudson/jenkins but you should have a look at the Jenkins Glossary Unstable build: A build is unstable if it was built successfully and one or more publishers report it unstable. For example if the JUnit publisher is configured and a test fails then the build will be marked unstable. Publi...
Jenkins
5,958,592
55
I know I can call localhost/job/RSpec/lastBuild/api/json to get the status of the lastest Jenkins build. However, since our build runs very long (a couple hours), I'm really more interested in the last complete build status than the run that is running at this exact moment. Is there an API end point for the last fully ...
Try http://$host/job/$jobname/lastSuccessfulBuild/api/json Jenkins (and Hudson) expose multiple different builds, such as lastBuild, lastStableBuild, lastSuccessfulBuild, lastFailedBuild, lastUnstableBuild, lastUnsuccessfulBuild, lastCompletedBuild.
Jenkins
18,238,616
54
I would like to set the build name and description from a Jenkins Declarative Pipeline, but can't find the proper way of doing it. I tried using an environment bracket after the pipeline, using a node bracket in an agent bracket, etc. I always get syntax error. The last version of my Jenkinsfile goes like so: pipeline...
I think this will do what you want. I was able to do it inside a script block: pipeline { stages { stage("Build"){ steps { script { currentBuild.displayName = "The name." currentBuild.description = "The best description." }...
Jenkins
43,639,099
54
I want to access and grep Jenkins Console Output as a post build step in the same job that creates this output. Redirecting logs with >> log.txt is not a solution since this is not supported by my build steps. Build: echo "This is log" Post build step: grep "is" path/to/console_output Where is the specific log file c...
@Bruno Lavit has a great answer, but if you want you can just access the log and download it as txt file to your workspace from the job's URL: ${BUILD_URL}/consoleText Then it's only a matter of downloading this page to your ${Workspace} You can use "Invoke ANT" and use the GET target On Linux you can use wget to do...
Jenkins
37,386,581
54
Pretty new to Jenkins and I have simple yet annoying problem. When I run job (Build) on Jenkins I am triggering ruby command to execute my test script. Problem is Jenkins is not displaying output in real time from console. Here is trigger log. Building in workspace /var/lib/jenkins/workspace/foo_bar No emails were trig...
To clarify some of the answers. ruby or python or any sensible scripting language will buffer the output; this is in order to minimize the IO; writing to disk is slow, writing to a console is slow... usually the data gets flush()'ed automatically after you have enough data in the buffer with special handling for newli...
Jenkins
11,631,951
54
I am trying to setup jenkins, but I cant get the authentication to work. I am running jenkins on Tomcat6 on CentOS 6.2. I enable logging in, and everything goes fine until I try to log in. After giving my credential and pressing login, tomcat gives me a error: "HTTP Status 404 - The requested resource () is not availab...
Spent ages wrestling with this one, make sure a Security Realm is set when you are choosing your Authorization method in Jenkins. That is, in Manage Jenkins → Configure Global Security select an option in the Security Realm list. For example:
Jenkins
9,684,320
54
I trigger a shell script from Jenkins, This scripts get date and export it as a environment(Linux) variable $DATE. I need to use this $DATE inside same Jenkins job. I made job as parameter build. Created a string parameter as DATE value as DATE=$DATE. But it is not working. Please suggest !!
You mention that you are exporting a DATE environment variable in an shell script, which is presumably being started via an "Execute shell" step. The problem is, once the shell step has completed, that environment is gone — the variables will not be carried over to subsequent build steps. So when you later try to use t...
Jenkins
30,110,876
53
We are having the same issue found here, here, here and here Basically we upgraded to xcode 6.1 and our build are getting the "ResourceRules.plist: cannot read resources" error. We have a Jenkins server that does our ios builds for us. We are using the Xcode plugin on Jenkins to do the actual build and signing. Any t...
If you're using Jenkins with the XCode plugin, you can modify the 'Code Signing Resource Rules Path' variable by adding: "CODE_SIGN_RESOURCE_RULES_PATH=$(SDKROOT)/ResourceRules.plist" to the 'Custom xcodebuild arguments' setting for the XCode plugin. This fix does not require the XCode GUI.
Jenkins
26,516,442
53
How can I run a cron job every 15 mins on Jenkins? This is what I've tried : On Jenkins I have a job set to run every 15 mins using this cron syntax : 14 * * * * But the job executes every hour instead of 15 mins. I'm receiving a warning about the format of the cron syntax : Spread load evenly by using ‘H * * * *’ ...
Your syntax is slightly wrong. Say: */15 * * * * command | |--> `*/15` would imply every 15 minutes. * indicates that the cron expression matches for all values of the field. / describes increments of ranges.
Jenkins
19,443,732
53
I'm running Ubuntu 11.10 and have run sudo apt-get install jenkins to install Jenkins on this system. I've seen some tutorials on how to setup a reverse proxy (Apache, Nginx, etc), however this is a VM dedicated for just jenkins and I'd like keep it as lean as possible while having jenkins running on port 80. I've foun...
Another solution is to simply use iptables to reroute incoming traffic from 80 to 8080. The rules would look like: -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT -A INPUT -i eth0 -p tcp --dport 8080 -j ACCEPT -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080 Reformatted as an iptables.rules file:...
Jenkins
9,330,367
53
I'm hoping to add a conditional stage to my Jenkinsfile that runs depending on how the build was triggered. Currently we are set up such that builds are either triggered by: changes to our git repo that are picked up on branch indexing a user manually triggering the build using the 'build now' button in the UI. Is...
In Jenkins Pipeline without currentBuild.rawBuild access the build causes could be retrieved in the following way: // started by commit currentBuild.getBuildCauses('jenkins.branch.BranchEventCause') // started by timer currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause') // started by user curr...
Jenkins
43,597,803
52
I am using pipeline jobs with Jenkins 2.0, but I don't see option 'disable job' as I was used to in older Jenkins versions. Am I missing something? Is it still possible to disable (pipeline) job?
You can simply use the "Disable Project" option from Jenkins 2.89.4 onward in order to disable the pipeline Jobs.
Jenkins
38,785,926
52
I'm setting up Jenkins to automate the build process. In particular, for my needs, I'd like to be able to set different bundle identifiers. I'm using the Xcode Jenkins plugin to set the bundle identifier: The problem is that this will change the bundle identifier in the Info.plist file and in MyTarget > General > Bun...
Faced the same problem. The PRODUCT_BUNDLE_IDENTIFIER is a variable in your project.pbxproj file. Change that to whatever you want and it will reflect both in your Info.plist as well as the project settings.
Jenkins
32,862,253
52
I don't know why "logged in users can do anything" means Jenkins will happily allow non-authenticated users to view project details and access artifacts... Regardless, I need to know how to get Jenkins to allow logged in users to to anything AND hide EVERYTHING for users who AREN'T logged in. Help please?
This can be done with the Role-Strategy plugin. Install the plugin, add a new group called "Anonymous" and uncheck everything. Then you want to add another group called "authenticated" and check everything. Add your existing users to this group. Jenkins will immediately prompt you for a login this way.
Jenkins
14,226,681
52
I delete old jenkins builds with rm where job is hosted: my_job/builds/$ rm -rf [1-9]* These old builds are still visible in job page. How to remove them with command line? (without the delete button in each build user interface)
Here is another option: delete the builds remotely with cURL. (Replace the beginning of the URLs with whatever you use to access Jenkins with your browser.) $ curl -X POST http://jenkins-host.tld:8080/jenkins/job/myJob/[1-56]/doDeleteAll The above deletes build #1 to #56 for job myJob. If authentication is enabled on ...
Jenkins
13,052,390
52
I've installed Jenkins on my mac (osx lion). But I couldn't get it work. This is the stacktrace I've got: Started by user anonymous Checkout:workspace / /Users/Shared/Jenkins/Home/jobs/test/workspace - hudson.remoting.LocalChannel@1c0a0847 Using strategy: Default Checkout:workspace / /Users/Shared/Jenkins/Home/jobs/te...
The solution for me was to set the git path in the Manage Jenkins > Global Tool Configuration settings. In the Git section, I changed the Path to Git executable to /usr/local/bin/git.
Jenkins
8,639,501
52
Here's my Jenkins 2.x pipeline: node ('master'){ stage 'Checkout' checkout scm stage "Build Pex" sh('build.sh') } When I run this pipeline the checkout puts the code into to the workspace as expected, however instead of expecting to find the script in workspace/ (it's really there!), it looks in an unr...
You can enclose your actions in dir block. checkout scm stage "Build Pex" dir ('<your new directory>') { sh('./build.sh') } ... or .. checkout scm stage "Build Pex" sh(""" <path to your new directory>/build.sh""") ... <your new directory> is place holder your actual directory. By default it is a relative path t...
Jenkins
38,143,485
51
Can anyone suggest if there is a way to execute Jacoco in a Jenkins Pipeline? I have downloaded the plugin but I do not get the option for Jacoco in the 'Pipeline Syntax', which is the Pipeline script help . Referred this URL: https://wiki.jenkins-ci.org/display/JENKINS/JaCoCo+Plugin which has no information for a jenk...
The jacoco pipeline step configuration uses this format: step([$class: 'JacocoPublisher', execPattern: 'target/*.exec', classPattern: 'target/classes', sourcePattern: 'src/main/java', exclusionPattern: 'src/test*' ]) Or with a simpler syntax for declarative pipeline: jacoco( execPattern...
Jenkins
41,893,846
51
I have installed the Docker build step plugin for Jenkins. The documentation is telling me: Name : Choose a name for this Docker cloud provider Docker URL: The URL to use to access your Docker server API (e.g: http://172.16.42.43:4243) How can I find my URL to the REST API (I have Docker installed on my host)?
If you are on Linux and need to connect to Docker API on the local machine, its URL is probably unix:///var/run/docker.sock, like it is mentioned in documentation: Develop with Docker Engine SDKs and API By default the Docker daemon listens on unix:///var/run/docker.sock and the client must have root access to intera...
Jenkins
37,178,824
51
I updated some plugins and restarted the jenkins but now it says: Please wait while Jenkins is restarting Your browser will reload automatically when Jenkins is ready. It is taking too much time (waiting from last 40 minutes). I have only 1 project with around 20 builds. I have restarted jenkins many times and worked...
I had a very similar issue when using jenkins build-in restart function. To fix it I killed the service (with crossed fingers), but somehow it kept serving the "Please wait" page. I guess it is served by a separate thread, but since i could not see any running java or jenkins processes i restarted the server to stop it...
Jenkins
17,344,061
51
I am currently seeing a set of errors across my builds. Is this expected behaviour if you loose Jenkins (say to a box crash, or a kill -9)? Or is there something worse going on (like a bad network connection)? The stack and error is: hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:158) ...
You'll see that error if the Jenkins master loses connectivity with the slave. It could be due to any of the three issues you listed above: Manually killing the slave process The slave server becoming unavailable A network problem between the master and the slave
Jenkins
9,998,298
51
In relation to Jenkins DSL, what is the difference between: def cwd = pwd() and cwd = pwd() ?
It's a difference of scope. When you assign a value to a variable without a "def" or other type, in a Groovy script, it's added to the "binding", the global variables for the script. That means it can be accessed from all functions within the script. It's a lot like if you had the variable defined at the top of the scr...
Jenkins
39,514,795
50
I am doing a simple pipeline: Build -> Staging -> Production I need different environment variables for staging and production, so i am trying to source variables. sh 'source $JENKINS_HOME/.envvars/stacktest-staging.sh' But it returns Not found [Stack Test] Running shell script + source /var/jenkins_home/.envvars/sta...
One way you could load environment variables from a file is to load a Groovy file. For example: Let's say you have a groovy file in '$JENKINS_HOME/.envvars' called 'stacktest-staging.groovy'. Inside this file, you define 2 environment variables you want to load env.DB_URL="hello" env.DB_URL2="hello2" You can then lo...
Jenkins
39,171,341
50
I have installed Jenkins plugins in two ways i.e. manually keeping the .hpi file in Jenkins home directory, and installing from Jenkins front-end (Manage Jenkins > Manage Plugins). What I notice here is when I install the plugin manually (downloaded as .hpi file) it installed with extension .hpi and while installing t...
Both are supposed to be identical to that extend that Jenkins is renaming hpi to jpi when you install it manually as you said. The reason why you see both in your JENKINS_HOME is the order in which plugins are loaded when Jenkins boots up: plugin.jpi gets precedence over plugin.hpi in case both are present. This is the...
Jenkins
30,658,375
50
We've recently set up a Jenkins CI server on Windows. Now in order to use Active Directory authentication I'd like to require https (SSL/TLS) for access. Given this setup, what is the recommended way to do this?
Go to your %JENKINS_HOME% and modify the jenkins.xml. Where you see --httpPort=8080 change it to --httpPort=-1 --httpsPort=8080 you can make the ports anything you want of course, but in my testing (a while ago, it may have changed) if you don't keep --httpPort=<something> then Jenkins will always use 8080. So if you s...
Jenkins
5,313,703
50
We have a .net full framework WPF application that we've moved from .net 4.6.2 to 4.7.1 along with changing to PackageReference in the csproj file instead of packages.config. Building on the development machines appears to be fine and packages are downloaded and restored, but when we build on our Windows Server 2012 bu...
After many hours of searching and sifting through NuGet issue posts and filtering out the .net core noise, I have a fix! According to some NuGet and msbuild msbuild issues raised, when restoring with NuGet (or msbuild /restore) under the local system account in Windows Server 2012, the folder NuGet uses isn't accessib...
Jenkins
48,896,486
49
We have a project in a Github repository with multiple Jenkinsfiles: my-project app Jenkinsfile lib1 Jenkinsfile lib2 Jenkinsfile We have created 3 Jenkins pipelines each referring to a Jenkinsfile. Question: How to avoid triggering "app" and "lib1" pipelines when there is a new commit in "lib2"? We...
RECENT UPDATE: I later fixed this issue using following code snippet: If you see the command dir('servicelayer'), using this to move into the directory, executing git command to find the difference between the commits and raising a flag. This way i have managed 3 Jenkins files in a single repository. stage('Validation'...
Jenkins
49,448,029
49
Is there a way to set the agent label dynamically and not as plain string? The job has 2 stages: First stage - Runs on a "master" agent, always. At the end of this stage I will know on which agent should the 2nd stage run. Second stage - should run on the agent decided in the first stage. My (not working) attempt loo...
Here is how I made it: mix scripted and declarative pipeline. First I've used scripted syntax to find, for example, the branch I'm on. Then define AGENT_LABEL variable. This var can be used anywhere along the declarative pipeline def AGENT_LABEL = null node('master') { stage('Checkout and set agent'){ checkout ...
Jenkins
46,630,168
49
Dear Stackoverflow Community, I am trying to setup a Jenkins CI pipeline using docker images as containers for my build processes. I am defining a Jenkinsfile to have a build pipeline as code. I am doing something like this: node { docker.withRegistry('http://my.registry.com', 'docker-credentials') { def b...
I found you can actually change user by adding args like following. Although -u 1000:1000 will still be there in the docker run, you will an additional -u [your user] after 1000:1000. Docker will acutally use latest -u parameter agent { docker { image 'your image' args '-u root --privileged' } }
Jenkins
42,630,894
49
I am using Jenkinsfile for scripting of a pipeline. Is there any way to disable printing of executed shell commands in build logs? Here is just a simple example of a jenkins pipeline: node{ stage ("Example") { sh('echo shellscript.sh arg1 arg2') sh('echo shellscript.sh arg3 arg4') } } which produce...
By default Jenkins starts shell scripts with flags -xe. -x enables additional logging. -e makes the script exit if any command inside returns non-zero exit status. To reset a flag I'd suggest two options: Call set +x in the body of your script. sh 'set +x' Pass custom shebang line without -x: sh('#!/bin/sh -e\n' + '...
Jenkins
39,891,926
49
I am getting the error "Test reports were found but none of them are new. Did tests run?" when trying to send unit test results by email. The reason is that I have a dedicated Jenkins job that imports the artifacts from a test job to itself, and sends the test results by email. The reason why I am doing this is because...
You could try updating the timestamps of the test reports as a build step ("Execute shell script"). E.g. cd path/to/test/reports touch *.xml
Jenkins
13,879,667
49
I have been using PHP_CodeSniffer with jenkins, my build.xml was configured for phpcs as below <target name="phpcs"> <exec executable="phpcs"> <arg line="--report=checkstyle --report-file=${basedir}/build/logs/checkstyle.xml --standard=Zend ${source}"/> </exec> </target> And I would like to ignore th...
You could create your own standard. The Zend one is quite simple (this is at /usr/share/php/PHP/CodeSniffer/Standards/Zend/ruleset.xml in my Debian install after installing it with PEAR). Create another one based on it, but ignore the line-length bit: <?xml version="1.0"?> <ruleset name="Custom"> <description>Zend, bu...
Jenkins
9,280,716
49
How can I get build time stamp of the latest build from Jenkins? I want to insert this value in the Email subject in post build actions.
Build Timestamp Plugin will be the Best Answer to get the TIMESTAMPS in the Build process. Follow the below Simple steps to get the "BUILD_TIMESTAMP" variable enabled. STEP 1: Manage Jenkins > Plugin Manager > Available plugins (or Installed plugins)... Search for "Build Timestamp". Install with or without Restart. ST...
Jenkins
24,226,862
48
I have tried all sort of ways but nothing seems to be working. Here is my jenkinsfile. def ZIP_NODE def CODE_VERSION pipeline{ /*A declarative pipeline*/ agent { /*Agent section*/ // where would you like to run the code label 'ubuntu' } options{ timestamps() ...
sh ''' ''' should be sh """ """ with single quotes the variables don't get processed.
Jenkins
52,063,864
48
I'm trying to create my first Groovy script for Jenkins: After looking here https://jenkins.io/doc/book/pipeline/, I created this: node { stages { stage('HelloWorld') { echo 'Hello World' } stage('git clone') { git clone "ssh://git@mywebsite.example/myrepo.git" } } } However, I'm get...
You are confusing and mixing Scripted Pipeline with Declarative Pipeline, for complete difference see here. But the short story: declarative pipelines is a new extension of the pipeline DSL (it is basically a pipeline script with only one step, a pipeline step with arguments (called directives), these directives shoul...
Jenkins
42,113,655
48
I'd like to access git variables such as GIT_COMMIT and GIT_BRANCH when I have checked out a repository from git further down in the build stream. Currently I find no available variable to access these two parameters. node { git git+ssh://git.com/myproject.git echo "$GIT_COMMIT - $BRANCH_NAME" } Is such variab...
Depending on the SCM plugin you are using, the checkout step may return additional information about the revision. This was resolved in JENKINS-26100. It was released in the 2.6 version of the workflow-scm-step plugin. For example, using the Git plugin, you can do something like: final scmVars = checkout(scm) echo "scm...
Jenkins
35,554,983
48
Recently I'm looking at Ansible and want to use it in projects. And also there's another tool Rundeck can be used to do all kinds of Operations works. I have experience with neither tool and this is my current understanding about them: Similar points Both tools are agent-less and use SSH to execute commands on remote ...
TL;DR - given your environment of Jenkins for CI/CD I'd recommend using just Ansible. You've spotted that there is sizeable cross-over between Ansible & Rundeck, so it's probably best to concentrate on where each product focuses, it's style and use. Focus I believe Rundeck's focus is in enabling sysadmins to build a (w...
Jenkins
31,152,102
48
I'm trying to improve Hudson CI for iOS and start Hudson as soon as system starts up. To do this I'm using the following launchd script: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Lab...
I have found a solution giving me access to the regular keychains for my Jenkins user. Find this plist: /Library/LaunchDaemons/org.jenkins-ci.plist then: Add the UserName element with a value of jenkins. Add a SessionCreate element with a value true to the plist file. This gives access to the normal keychains for the ...
Jenkins
6,827,874
48
As far as declarative pipelines go in Jenkins, I'm having trouble with the when keyword. I keep getting the error No such DSL method 'when' found among steps. I'm sort of new to Jenkins 2 declarative pipelines and don't think I am mixing up scripted pipelines with declarative ones. The goal of this pipeline is to run ...
In the documentation of declarative pipelines, it's mentioned that you can't use when in the post block. when is allowed only inside a stage directive. So what you can do is test the conditions using an if in a script: post { success { script { if (env.BRANCH_NAME == 'master') currentBuild.result = 'SUCCE...
Jenkins
49,798,549
47
I've been creating a few Multibranch Pipeline projects in Jenkins and now I've "upgraded" to use a GitHub Organization project. How do I disable the old Multibranch Pipeline projects? I don't see any Disable button anywhere. Here is a screenshot of what I mean: Since I can't add a screenshot to a reply, I'm editing m...
If you are using a recent version of the Pipeline Job plugin (I am using version 2.25 from Sep 5, 2018) and you do not see the disable option, then you can still disable the job by appending /disable to the URL of the job. Source: You would need to be logged in as a user who has access to write/configure builds. And...
Jenkins
47,840,096
47
Is it possible to Scan a Multibranch Pipeline to detect the branches with a Jenkinsfile, but without the pipeline execution? My projects have different branches and I don't want that all the children pipelines branches with a Jenkinsfile to start to execute when I launch a build scan from the parent pipeline multibranc...
In your Branch Sources section you can add a Property named Suppress automatic SCM triggering. This prevents Jenkins from building everything with an Jenkinsfile.
Jenkins
44,004,636
47
I installed jenkins by downloading jenkins-2.2.pkg. After the installation is complete, Chrome auto-connected to http://localhost:8080/login?from=%2F and I see the following message: Unlock Jenkins To ensure Jenkins is securely set up by the administrator, a password has been written to the log (not sure where to find...
Navigate to this folder /Users/Shared/Jenkins/Home Right click on secrets/ folder and select "Get Info" Scroll down to the right bottom corner of the pop up window and click on the lock image > enter your password > ok Click on the "+" at the left bottom corner of the pop up window and add the user 4.5 Click on Settin...
Jenkins
37,146,063
47
I want to add a Build step with the Groovy plugin to read a file and trigger a build fail depending on the content of the file. How can I inject the workspace file path in the groovy plugin ? myFileDirectory = // Get workspace filepath here ??? myFileName = "output.log" myFile = new File(myFileDirectory + myFileName) ...
I realize this question was about creating a plugin, but since the new Jenkins 2 Pipeline builds use Groovy, I found myself here while trying to figure out how to read a file from a workspace in a Pipeline build. So maybe I can help someone like me out in the future. Turns out it's very easy, there is a readfile step, ...
Jenkins
22,917,491
47
I have been trying to follow tutorials and this one: Deploy as Jenkins User or Allow Jenkins To Run As Different User? but I still can't for the love of the computing gods, run as a different user. Here are the steps of what I did: download the macosx pkg for jenkins(LTS) setup plugins etc and git try to build it I k...
The "Issue 2" answer given by @Sagar works for the majority of git servers such as gitorious. However, there will be a name clash in a system like gitolite where the public ssh keys are checked in as files named with the username, ie keydir/jenkins.pub. What if there are multiple jenkins servers that need to access the...
Jenkins
6,692,330
47
I am trying to run a simple pipeline-script in Jenkins with 2 stages. The script itself creates a textFile and checks if this one exists. But when i try to run the job I get an "Expected a step" error. I have read somewhere that you cant have an if inside a step so that might be the problem but if so how can I check wi...
You are missing a script{} -step which is required in a declarative pipeline. Quote: The script step takes a block of Scripted Pipeline and executes that in the Declarative Pipeline. stage('Check') { steps { script { Boolean bool = fileExists 'NewFile.txt' if (bool) { ...
Jenkins
55,508,871
46
Anybody knows how to remove the users from the Credentials drop down in Jenkins for a project under Source Code Management -> Git Repositories Referring to the section highlighted in yellow in attached screen shot: I seem to have added a few users in error and want to remove them from the drop down. I dont see any opt...
Ok i found it, just had to look around. It was under the Jenkins Home page -> Credentials. It is not present under the Credentials section of the Configuration page. I thought since it was GIT based, it was storing users under that configuration.
Jenkins
34,721,686
46
I am trying to install jenkins in ubuntu. I have followed the commands below: wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | apt-key add - echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list then apt-get update and apt-get install jenkins but It shows St...
First open the /etc/default/jenkins file. Then under JENKINS_ARGS section, you can change the port like this HTTP_PORT=9999. Then you should restart Jenkins with sudo service jenkins restart. Then to check the status use this command sudo systemctl status jenkins
Jenkins
28,340,877
46
I am working with Jenkins CI and am trying to properly configure my jobs to use git. I have the git plugin installed and configured for one of my jobs. When I build the job, I expect it to pull the latest changes for the branch I specify and then continue with the rest of the build process (e.g., unit tests, etc.). Whe...
Relates me to scenario where workspace wasn't getting cleaned-up, used: Source Code Management--> Additional Behaviours --> Clean after checkout Other option is to use Workspace Cleanup Plugin
Jenkins
25,774,895
46
It would be nice for our Jenkins CI server to automatically detect, deploy and build tags as they are created in our Github repository. Is this possible?
With the following configuration, you can make a job build all tags: Make the job fetch tags as if they were branches: Click on the Advanced button below the repository URL and enter the Refspec +refs/tags/*:refs/remotes/origin/tags/* Have it build all tag "branches" with the Branch Specifier */tags/* Enable SCM polli...
Jenkins
7,805,603
46