Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
4027e495
Commit
4027e495
authored
13 years ago
by
felmer
Browse files
Options
Downloads
Patches
Plain Diff
LMS-2471 script for fetching builds from Hudson added
SVN: 22614
parent
ae682428
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openbis_all/source/bash/fetch-ci-artifacts.sh
+76
-0
76 additions, 0 deletions
openbis_all/source/bash/fetch-ci-artifacts.sh
with
76 additions
and
0 deletions
openbis_all/source/bash/fetch-ci-artifacts.sh
0 → 100755
+
76
−
0
View file @
4027e495
#! /bin/bash
#
# Fetches artifacts from continuous integration server for a specified project. Works only for Hudson.
#
# Usage: fetch-ci-artifacts.sh [-d <output folder>] [-p <regular expression for filtering artifact names>] <project>
#
# If <output folder> is specified the files are stored there. If it does not exist it will be created.
# By default the current directory will contain the artifacts.
#
# If the p option is specified only artifact file names matching the regular expression will
# be loaded from Hudson.
#
CI_HOST
=
cisd-ci.ethz.ch:8090
if
[
$#
-lt
1
]
;
then
echo
"Usage: fetch-ci-artifacts.sh [-d <output folder>]
\
[-p <regular expression for filtering artifact names>] <project>"
exit
1
fi
##################################################
#
# Gather parameters
#
PROJECT
=
${
@
:
-1
}
OUTPUT_FOLDER
=
.
PATTERN
=
".*"
while
[
$#
-ge
2
]
;
do
if
[
$1
==
"-d"
]
;
then
shift
if
[
$#
-lt
2
]
;
then
echo
"Missing output folder for option -d."
exit
1
fi
OUTPUT_FOLDER
=
"
$1
"
shift
elif
[
$1
==
"-p"
]
;
then
shift
if
[
$#
-lt
2
]
;
then
echo
"Missing pattern for option -p."
exit
1
fi
PATTERN
=
"
$1
"
shift
fi
done
PROJECT_BASE_URL
=
http://
$CI_HOST
/job/
$PROJECT
##################################################
#
# Load list of available artifacts on Hudson
#
XML
=
`
curl
-s
"
$PROJECT_BASE_URL
/lastSuccessfulBuild/api/xml?xpath=//fileName&wrapper=bag"
`
if
[
${
XML
:0:4
}
!=
"<bag"
]
;
then
echo
"Couldn't get artifact information for project
$PROJECT
. Probably the project doesn't exist."
exit
1
fi
if
[
$XML
==
"<bag/>"
]
;
then
echo
"No artifacts for project
$PROJECT
"
exit
fi
XML
=
${
XML
#<bag>
}
XML
=
${
XML
%*</bag>
}
##################################################
#
# Download artifacts
#
mkdir
-p
"
$OUTPUT_FOLDER
"
for
f
in
`
echo
${
XML
}
|awk
'{gsub(/<\/fileName>/,"\n")}; 1'
|awk
'{gsub(/<fileName>/,"")}; 1'
|
\
egrep
"
$PATTERN
"
|sort
`
;
do
download_url
=
$PROJECT_BASE_URL
/lastSuccessfulBuild/artifact/_main/targets/dist/
$f
echo
"download
$download_url
"
wget
-q
-O
"
$OUTPUT_FOLDER
/
$f
"
$download_url
done
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment