Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPSCore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
VIPS
VIPSCore
Commits
d144fae7
Commit
d144fae7
authored
1 year ago
by
Lene Wasskog
Browse files
Options
Downloads
Patches
Plain Diff
build: Gitlab CI/CD pipeline, get common ci_settings.xml, script for building pom
parent
d5739c60
No related branches found
No related tags found
1 merge request
!7
Gnuaffero
Pipeline
#2167
failed
1 year ago
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+34
-4
34 additions, 4 deletions
.gitlab-ci.yml
build_pom_with_models.py
+54
-0
54 additions, 0 deletions
build_pom_with_models.py
ci_settings.xml
+0
-16
0 additions, 16 deletions
ci_settings.xml
with
88 additions
and
20 deletions
.gitlab-ci.yml
+
34
−
4
View file @
d144fae7
image
:
maven:3.8.6-
openjdk
-
11
image
:
openjdk
:
11
-jdk
stages
:
-
build
-
test
variables
:
MAVEN_CLI_OPTS
:
"
-s
ci_settings.xml
--batch-mode"
COMMON_CONFIG_REMOTE
:
https://root:$CONFIG_ACCESS_TOKEN@$CI_SERVER_HOST/VIPS/vips-common-config.git
COMMON_CONFIG_LOCAL
:
"
vips-common-config"
SETTINGS_XML
:
"
ci_settings.xml"
POM_WITH_MODELS
:
"
pom_with_models.xml"
MAVEN_CLI_OPTS
:
"
-s
$SETTINGS_XML
--batch-mode"
MAVEN_OPTS
:
"
-Dmaven.repo.local=.m2/repository
-Dmaven.artifact.threads=10"
MAIN_BRANCH
:
"
main"
RELEASE_BRANCH
:
"
release"
cache
:
paths
:
-
.m2/repository/
before_script
:
-
git config --global user.name "${GITLAB_USER_NAME}"
-
git config --global user.email "${GITLAB_USER_EMAIL}"
-
echo "Get common settings"
-
git clone $COMMON_CONFIG_REMOTE $COMMON_CONFIG_LOCAL
-
cd $COMMON_CONFIG_LOCAL
-
cp $SETTINGS_XML ../$SETTINGS_XML
-
cd ..
-
rm -rf $COMMON_CONFIG_LOCAL
-
apt-get update -y && apt-get install -y python3
-
'
python
build_pom_with_models.py'
build
:
stage
:
build
script
:
-
'
./mvnw
$MAVEN_CLI_OPTS
compil
e'
-
'
./mvnw
-f
$POM_WITH_MODELS
$MAVEN_CLI_OPTS
$MAVEN_OPTS
packag
e'
tags
:
-
vips-java
test
:
stage
:
test
script
:
-
'
./mvnw
$MAVEN_CLI_OPTS
test'
-
'
./mvnw
-f
$POM_WITH_MODELS
$MAVEN_CLI_OPTS
$MAVEN_OPTS
test'
tags
:
-
vips-java
deploy-snapshot
:
stage
:
deploy
script
:
-
'
./mvnw
-f
$POM_WITH_MODELS
$MAVEN_CLI_OPTS
$MAVEN_OPTS
deploy'
tags
:
-
vips-java
\ No newline at end of file
This diff is collapsed.
Click to expand it.
build_pom_with_models.py
0 → 100755
+
54
−
0
View file @
d144fae7
#!/usr/bin/python3
'''
Merges pom.xml and models.xml (default) into pom_with_models.xml and
runs mvn clean install -f pom_with_models.xml
Copyright (C) 2023 NIBIO
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
@author Tor-Einar Skog <tor-einar.skog@nibio.no>
'''
import
sys
import
subprocess
from
xml.dom.minidom
import
parse
# Default
models_xml_path
=
"
models.xml
"
merged_pom_filename
=
"
pom_with_models.xml
"
# Accept alternative models.xml file
if
len
(
sys
.
argv
)
>
1
:
models_xml_path
=
sys
.
argv
[
1
]
# Read contents
pom_dom
=
parse
(
"
pom.xml
"
)
try
:
models_dom
=
parse
(
models_xml_path
)
except
FileNotFoundError
:
print
(
"
ERROR: File %s not found.
"
%
models_xml_path
)
exit
(
1
)
# Merge the dependency elements from models.xml into pom.xml
pom_deps_element
=
pom_dom
.
getElementsByTagName
(
"
dependencies
"
)[
0
]
model_dep_elements
=
models_dom
.
getElementsByTagName
(
"
dependency
"
)
for
dep
in
model_dep_elements
:
pom_deps_element
.
appendChild
(
dep
)
# Write the modified pom dom to file
pom_with_models_file
=
open
(
merged_pom_filename
,
"
w
"
)
pom_dom
.
writexml
(
pom_with_models_file
)
pom_with_models_file
.
close
()
This diff is collapsed.
Click to expand it.
ci_settings.xml
deleted
100644 → 0
+
0
−
16
View file @
d5739c60
<settings
xmlns=
"http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd"
>
<servers>
<server>
<id>
gitlab-maven
</id>
<configuration>
<httpHeaders>
<property>
<name>
Job-Token
</name>
<value>
${CI_JOB_TOKEN}
</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
</settings>
\ No newline at end of file
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