Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openolat
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zentraler Informatikdienst
Digitale Medien und Lerntechnologien
olat
openolat
Commits
69336419
Commit
69336419
authored
6 years ago
by
User expired
Browse files
Options
Downloads
Patches
Plain Diff
openolat#1: added gitlabci code to 13.2 branch
parent
fd860348
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+48
-19
48 additions, 19 deletions
.gitlab-ci.yml
scripts/settings.xml
+74
-0
74 additions, 0 deletions
scripts/settings.xml
scripts/uibk-release.sh
+78
-0
78 additions, 0 deletions
scripts/uibk-release.sh
with
200 additions
and
19 deletions
.gitlab-ci.yml
+
48
−
19
View file @
69336419
variables
:
MAVEN_OPTS
:
"
-Dmaven.repo.local=.m2/repository
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN
-Dorg.slf4j.simpleLogger.showDateTime=true
-Djava.awt.headless=true
-Dhttps.proxyHost=proxy.uibk.ac.at
-Dhttps.proxyPort=3128
-Dhttp.proxyHost=proxy.uibk.ac.at
-Dhttp.proxyPort=3128"
MAVEN_CLI_OPTS
:
"
--batch-mode
--errors
--fail-at-end
--show-version
-DinstallAtEnd=true
-DdeployAtEnd=true"
POSTGRES_DB
:
olattest
POSTGRES_USER
:
olat
POSTGRES_PASSWORD
:
$SECRET_POSTGRES_PASSWORD
MAVEN_OPTS
:
"
-Dmaven.repo.local=.m2/repository
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN
-Dorg.slf4j.simpleLogger.showDateTime=true
-Djava.awt.headless=true
-Xms512m
-Xmx1024m"
MAVEN_CLI_OPTS
:
"
-B
--errors
--fail-at-end
--show-version
-DinstallAtEnd=true
-DdeployAtEnd=true
-s
.m2/settings.xml
-Dhttp.proxyHost=proxy.uibk.ac.at
-Dhttp.proxyPort=3128
-Dhttp.nonProxyHosts='*.uibk.ac.at'"
stages
:
-
test
-
deploy
cache
:
paths
:
-
.m2/repository
.validate
:
&validate
stage
:
build
script
:
-
'
mvn
$MAVEN_CLI_OPTS
test-compile'
.verify
:
&verify
.unittest
:
&unittest
stage
:
test
before_script
:
-
'
cp
./scripts/settings.xml
.m2/settings.xml'
script
:
-
'
mvn
$MAVEN_CLI_OPTS
verify
site
site:stage'
except
:
-
master
-
'
mvn
$MAVEN_CLI_OPTS
clean
test
javadoc:javadoc
-Dwith-postgresql
-Dtest.env.db.postgresql.host.name=postgres
-Dtest.env.db.postgresql.user=$POSTGRES_USER
-Dtest.env.db.postgresql.pass=$POSTGRES_PASSWORD
-Ptomcat'
services
:
-
postgres:9.4
tags
:
-
olat
artifacts
:
paths
:
-
target
expire_in
:
1 week
# Validate merge requests using JDK8
validate:jdk8
:
<<
:
*validate
image
:
maven:3.3.9-jdk-8
unittest:jdk8
:
<<
:
*unittest
image
:
maven:3.5.3-jdk-8
release
:
stage
:
deploy
image
:
maven:3.5.3-jdk-8
tags
:
-
olat
before_script
:
-
'
which
ssh-agent
||
(
apt-get
update
-y
&&
apt-get
install
openssh-client
-y
)'
-
eval $(ssh-agent -s)
-
echo "$SSH_RELEASE_KEY" | tr -d '\r' | ssh-add - > /dev/null
-
mkdir -p ~/.ssh
-
chmod 700 ~/.ssh
-
git config --global user.email "gitlab-runner@$(hostname -f)"
-
git config --global user.name "GitLab Release Runner"
-
git remote -v
-
git branch -v -a
-
sed "s/__MVN_PASSWORD__/$MVN_PASSWORD/" ./scripts/settings.xml > .m2/settings.xml
script
:
-
bash -x ./scripts/uibk-release.sh
artifacts
:
paths
:
-
target/*.war
expire_in
:
1 week
when
:
manual
# Verify merge requests using JDK8
verify:jdk8
:
<<
:
*verify
image
:
maven:3.3.9-jdk-8
This diff is collapsed.
Click to expand it.
scripts/settings.xml
0 → 100644
+
74
−
0
View file @
69336419
<?xml version="1.0" encoding="UTF-8"?>
<settings
xsi:schemaLocation=
"http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd"
xmlns=
"http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
>
<servers>
<server>
<id>
nmvn-lms
</id>
<username>
lmsdev
</username>
<password>
__MVN_PASSWORD__
</password>
</server>
</servers>
<mirrors>
<mirror>
<mirrorOf>
central
</mirrorOf>
<name>
remote-repos
</name>
<url>
https://nmvn.uibk.ac.at/artifactory/remote-repos
</url>
<id>
remote-repos
</id>
</mirror>
</mirrors>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>
false
</enabled>
</snapshots>
<id>
central
</id>
<name>
libs-release
</name>
<url>
https://nmvn.uibk.ac.at/artifactory/libs-release
</url>
</repository>
<repository>
<snapshots
/>
<id>
snapshots
</id>
<name>
libs-snapshot
</name>
<url>
https://nmvn.uibk.ac.at/artifactory/libs-snapshot
</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>
false
</enabled>
</snapshots>
<id>
central
</id>
<name>
plugins-release
</name>
<url>
https://nmvn.uibk.ac.at/artifactory/plugins-release
</url>
</pluginRepository>
<pluginRepository>
<snapshots
/>
<id>
snapshots
</id>
<name>
plugins-snapshot
</name>
<url>
https://nmvn.uibk.ac.at/artifactory/plugins-snapshot
</url>
</pluginRepository>
</pluginRepositories>
<id>
artifactory
</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>
artifactory
</activeProfile>
</activeProfiles>
<pluginGroups>
<pluginGroup>
com.atlassian.maven.plugins
</pluginGroup>
</pluginGroups>
<proxies>
<proxy>
<id>
uibk-proxy
</id>
<active>
true
</active>
<protocol>
http
</protocol>
<host>
proxy.uibk.ac.at
</host>
<port>
3128
</port>
<username></username>
<password></password>
<nonProxyHosts>
*.uibk.ac.at
</nonProxyHosts>
</proxy>
</proxies>
</settings>
This diff is collapsed.
Click to expand it.
scripts/uibk-release.sh
0 → 100755
+
78
−
0
View file @
69336419
#!/bin/bash
CODE_VERSION_MMP
=
$(
grep
"^build
\.
version"
src/main/resources/serviceconfig/olat.properties |
sed
"s/.*=//"
|
head
-n
1
)
CODE_VERSION_MM
=
${
CODE_VERSION_MMP
%.*
}
GIT_REF
=
$CI_COMMIT_REF_NAME
GIT_REF_VERSION_MMU
=
${
GIT_REF
#*OpenOLAT_
}
GIT_REF_VERSION_MM
=
${
GIT_REF_VERSION_MMU
%.uibk
}
echo
"The last 5 (un)merged tags:"
/usr/bin/git tag
-l
--sort
creatordate|tail
-n
5
echo
"The last 5 (un)merged uibk tags:"
/usr/bin/git tag
-l
--sort
creatordate|grep
'\.uibk-'
|tail
-n
5
echo
"The last 5 merged uibk tags:"
/usr/bin/git tag
-l
--merged
HEAD
--sort
creatordate|grep
'\.uibk-'
|tail
-n
5
LASTTAG
=
$(
/usr/bin/git tag
-l
--merged
HEAD
--sort
creatordate|grep
'\.uibk-'
|tail
-n
1
)
LASTTAG_VERSION_MMPU
=
${
LASTTAG
#*OpenOLAT_
}
LASTTAG_VERSION_MMP
=
${
LASTTAG_VERSION_MMPU
%.uibk*
}
LASTTAG_VERSION_MM
=
${
LASTTAG_VERSION_MMP
%.*
}
set
-e
echo
"Checking out the current head as the branch name we are building in:"
git checkout
-B
"
$CI_BUILD_REF_NAME
"
"
$CI_BUILD_REF
"
echo
"Testing that the major and minor version of the last tag are equal to the one in olat.properties"
test
"
${
LASTTAG_VERSION_MM
}
"
=
"
${
CODE_VERSION_MM
}
"
echo
"Testing that the major and minor version of the last tag are equal to the one in the branch name"
test
"
${
LASTTAG_VERSION_MM
}
"
=
"
${
GIT_REF_VERSION_MM
}
"
echo
"Check if the olat.properties patch release is the same as in our last tag"
if
[[
"
$LASTTAG_VERSION_MMP
"
=
"
$CODE_VERSION_MMP
"
]]
then
echo
"the olat.properties version is still the same as for our last release, count up the uibk build number"
CURRENT_BUILDNR
=
${
LASTTAG_VERSION_MMPU
#*-
}
NEW_BUILDNR
=
$(
printf
"%03d"
$((
CURRENT_BUILDNR
+
1
))
)
else
echo
"the olat.properties version has changed so we start with 001 as the new buildnr"
NEW_BUILDNR
=
"001"
fi
echo
"Test if this is a tagged build, we dont do a release in this case!"
if
[[
!
-z
"
${
CI_COMMIT_TAG
}
"
]]
then
echo
"This is a tagged build:
${
CI_COMMIT_TAG
}
, dont do a release when there is already a tag set"
exit
1
fi
echo
"Test if the detached head commit (
$CI_COMMIT_SHA
) is equal to the release branch (
$CI_COMMIT_REF_NAME
)"
if
git diff
--exit-code
$CI_COMMIT_SHA
origin/
$CI_COMMIT_REF_NAME
then
echo
"SHA and REF are equal so we can checkout the branch"
git checkout
$CI_COMMIT_REF_NAME
else
echo
"SHA and REF not equal stopping the release process!"
exit
1
fi
ORIGIN_GIT_URL
=
$(
git remote get-url origin
)
ORIGIN_GIT_SERVER_URL
=
${
ORIGIN_GIT_URL
#*@
}
ORIGIN_GIT_SERVER
=
${
ORIGIN_GIT_SERVER_URL
%%[
:/]
*
}
ssh-keyscan
$ORIGIN_GIT_SERVER
>
~/.ssh/known_hosts
NEW_VERSION
=
"
${
CODE_VERSION_MMP
}
.uibk-
${
NEW_BUILDNR
}
"
NEW_TAG
=
"OpenOLAT_
${
NEW_VERSION
}
"
if
/usr/bin/git tag
-l
|
grep
$NEW_TAG
then
echo
"New tagname already exists in the git repository:
$NEW_TAG
stopping the release process!"
exit
1
fi
mvn
-s
.m2/settings.xml
-B
release:prepare
-Darguments
=
"-s .m2/settings.xml -DskipTests=true -DskipSeleniumTests=true"
-DreleaseVersion
=
$NEW_VERSION
-DdevelopmentVersion
=
${
LASTTAG_VERSION_MM
}
-SNAPSHOT
-Dtag
=
${
NEW_TAG
}
mvn
-s
.m2/settings.xml
-B
release:perform
-Darguments
=
"-s .m2/settings.xml -DskipTests=true -DskipSeleniumTests=true"
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