Skip to content

Instantly share code, notes, and snippets.

@idletekz
idletekz / README.md
Last active January 12, 2018 20:22 — forked from dnozay/_Jenkins+Script+Console.md
jenkins groovy scripts collection.
# first grab all dependencies
mvn dependency:resolve
# then list them with -o to keep noise low,
# remove extra information and duplicates
mvn -o dependency:list \
| grep ":.*:.*:.*" \
| cut -d] -f2- \
| sed 's/:[a-z]*$//g' \
| sort -u
@idletekz
idletekz / reinvent-2017-youtube.md
Created December 26, 2017 20:44 — forked from stevenringo/reinvent-2017-youtube.md
Links to YouTube recordings of AWS re:Invent 2017 sessions

| Title | Description

ProcessBuilder builder = new ProcessBuilder( myCommand.split(' ') )
builder.redirectErrorStream(true)
Process process = builder.start()
InputStream stdout = process.getInputStream ()
BufferedReader reader = new BufferedReader (new InputStreamReader(stdout))
content = ""
while ((line = reader.readLine ()) != null) {
@idletekz
idletekz / git
Created November 29, 2017 05:06
git environment variables
echo "GIT environment variables"
echo "GIT Commit $GIT_COMMIT"
echo "GIT Branch $GIT_BRANCH"
echo "GIT Previous commit $GIT_PREVIOUS_COMMIT"
echo "GIT URL $GIT_URL"
Check to see if a build is running or not
I tried the Python script in the answer to this question, but couldn't get it to work. I don't know Python, and didn't want to invest any time in debugging, but was able to read enough of the script to gain inspiration from it.
All I need to do is check to see if a build is running or not. To do that I used curl and grep, like this:
curl http://myjenkins/job/myjob/lastBuild/api/json | grep --color result\":null
If a build is in progress, a grep for result\":null will return 0.
If a build is finished, a grep for result\":null will return 1.
from wants a file or path. What you're feeding it, generatePomFileForMavenJavaPublication is a task, which is most definitely not a file or path, so that's not going to work.
What you can do is make generatePomFileForMavenJavaPublication a prerequisite for jar and pick up the pom it creates in your build directory.
Something like the following should accomplish this:
jar {
dependsOn generatePomFileForMavenJavaPublication
from("$builddir/pom.xml") //Or whatever path it goes to in the generate task.
into("META-INF/maven/$project.group/$project.name")
FIX: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS
Published 17 February 10 01:39 PM | Scott Mitchell
I teach two six week courses on ASP.NET at the University of California - San Diego Extension. The first class serves as an introduction to ASP.NET and as such many of the students create their first ASP.NET websites in class. During the first meeting students create a simple ASP.NET website. At the end of the first evening, those students who did not bring their own laptop need to work on their website from home or work; they may copy the files to a thumb drive or ZIP up the files and send them via email. In either case, it's not uncommon for students to bump into the following error when opening the website to bump into the following error message:
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application
@idletekz
idletekz / register a myget feed.markdown
Created July 21, 2017 15:34 — forked from xavierdecoster/register a myget feed.markdown
Store MyGet credentials in your roaming user profile NuGet.config

Execute the following script using your MyGet [feedUrl] and MyGet [username] , [password] and [apikey]. Run this from a commandline where you have access to nuget.exe (or set the path to your nuget.exe in a system environment variable).

Store credentials in machine-level nuget.config (non-transferable)

nuget setapikey [apikey] -source [feedUrl]
nuget sources add|update -Name [name] -source [feedUrl] -User [username] -pass [password]