Skip to content

Commit

Permalink
Story#12674: delete ui components and update packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
Benaissa BENARBIA committed May 27, 2024
1 parent 16b3722 commit 8b99847
Show file tree
Hide file tree
Showing 414 changed files with 152 additions and 44,612 deletions.
48 changes: 28 additions & 20 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,7 @@ pipeline {
steps {
sh '''
$MVN_COMMAND clean verify -U -Pvitam \
--projects '!cots/vitamui-mongo-express' \
--projects '!ui/ui-archive-search' \
--projects '!ui/ui-collect' \
--projects '!ui/ui-commons' \
--projects '!ui/ui-frontend' \
--projects '!ui/ui-frontend-common' \
--projects '!ui/ui-identity' \
--projects '!ui/ui-ingest' \
--projects '!ui/ui-pastis' \
--projects '!ui/ui-portal' \
--projects '!ui/ui-referential'
--projects '!cots/vitamui-mongo-express'
'''
}
}
Expand All @@ -126,6 +116,32 @@ pipeline {
}
}

stage('Package and push to repository') {
when {
environment(name: 'DO_DEPLOY', value: 'true')
}
parallel {
stage('Package back packages') {
steps {
sh '''
$MVN_COMMAND deploy -Pvitam,deb,rpm -DskipTests -DskipAllFrontend=true -DskipAllFrontendTests=true -Dlicense.skip=true --projects '!cots/vitamui-mongo-express'
'''
}
}
stage('Package Frontend') {
steps {
script {
sh '''
POM_VERSION=$(xpath -e '/project/version/text()' pom.xml 2>/dev/null)
./tools/packaging/package-fronts.sh identity,archive-search,portal,pastis,collect,referential,ingest ${POM_VERSION}
'''
}
}
}
}
}


stage('Deploy to Nexus') {
when {
environment(name: 'DO_DEPLOY', value: 'true')
Expand All @@ -145,15 +161,7 @@ pipeline {
sh '''
$MVN_COMMAND install \
-D skipTests \
-P vitam \
--projects '!ui/ui-archive-search' \
--projects '!ui/ui-collect' \
--projects '!ui/ui-commons' \
--projects '!ui/ui-identity' \
--projects '!ui/ui-ingest' \
--projects '!ui/ui-pastis' \
--projects '!ui/ui-portal' \
--projects '!ui/ui-referential'
-P vitam
'''
sh '''
$MVN_COMMAND deploy \
Expand Down
40 changes: 1 addition & 39 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@
<rpm.jar-file>${project.build.finalName}.jar</rpm.jar-file>
<!-- Put this properties to false sub-module when you want to use profile -->
<rpm.skip>true</rpm.skip>
<rpm_rsc.skip>true</rpm_rsc.skip>
<rpm.publication.env>dev</rpm.publication.env>
<!-- Swagger doc generation -->
<swagger.dir>.</swagger.dir>
Expand Down Expand Up @@ -2108,27 +2107,9 @@
</arguments>
</configuration>
</execution>
<execution>
<id>rpm-package-front</id>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>make</executable>
<workingDirectory>target</workingDirectory>
<skip>${rpm_rsc.skip}</skip>
<arguments>
<argument>-f</argument>
<argument>${main.basedir}/tools/packaging/Makefile-fronts</argument>
<argument>rpm</argument>
<argument>NAME=${project.artifactId}</argument>
<argument>VERSION=${project.version}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>
</profile>
Expand Down Expand Up @@ -2166,25 +2147,6 @@
</arguments>
</configuration>
</execution>
<execution>
<id>deb-package-front</id>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>make</executable>
<workingDirectory>target</workingDirectory>
<skip>${rpm_rsc.skip}</skip>
<arguments>
<argument>-f</argument>
<argument>${main.basedir}/tools/packaging/Makefile-fronts</argument>
<argument>deb</argument>
<argument>NAME=${project.artifactId}</argument>
<argument>VERSION=${project.version}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand Down
8 changes: 4 additions & 4 deletions tools/packaging/Makefile-fronts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Staging root configuration
DESTDIR := $(abspath ./package-stage/)
STAGING_ROOT = $(abspath $(DESTDIR)/)
Expand Down Expand Up @@ -28,7 +27,7 @@ FPM_PACK_REMOVE_SCRIPTS = --after-remove "$(TEMPLATE_TMP_DIR)/after-remove-r

# variable used to copy
NAME_WITHOUT_SUFFIX := $(subst ui-,,$(NAME))
RESSOURCE_DIR_ORIGIN := $(abspath ../../ui-frontend/dist/$(NAME_WITHOUT_SUFFIX)/)
RESSOURCE_DIR_ORIGIN := $(abspath $(STAGING_ROOT)/../../../ui/ui-frontend/dist/$(NAME_WITHOUT_SUFFIX)/)
RESSOURCE_DIR_DEST := $(abspath $(STAGING_ROOT)/vitamui/data/)

clean:
Expand Down Expand Up @@ -57,8 +56,9 @@ template-files:

install: clean stage vitamui-dirs template-files
@echo "Ressources origin: $(RESSOURCE_DIR_ORIGIN)"
@echo "Ressources dest: $(RESSOURCE_DIR_DEST))"
sudo mkdir -p -m 750 $(RESSOURCE_DIR_DEST)
@echo "Ressources dest: $(RESSOURCE_DIR_DEST)"

sudo mkdir -p -m 750 $(RESSOURCE_DIR_DEST)
cp -r $(RESSOURCE_DIR_ORIGIN) $(abspath $(RESSOURCE_DIR_DEST))

rpm: install
Expand Down
35 changes: 35 additions & 0 deletions tools/packaging/package-fronts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

MODULES="$1"
VERSION="$2"

echo "$MODULES"
echo "$VERSION"


# Check if VERSION and MODULES environment variables are set
if [ -z "$VERSION" ] || [ -z "$MODULES" ]; then
echo "ERROR: VERSION or MODULES environment variables are not set."
exit 1
fi

# Split the modules list by comma into an array
IFS=',' read -r -a modules_array <<< "$MODULES"

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

cd "$DIR"
#Rpm packaging
for MODULE in "${modules_array[@]}"; do
echo "Packaging module: $MODULE"
# Call make passing module and version as parameters
make -f "Makefile-fronts" rpm NAME="$MODULE" VERSION="$VERSION"
done


#Deb Packaging
for MODULE in "${modules_array[@]}"; do
echo "Packaging module: $MODULE"
# Call make passing module and version as parameters
make -f "Makefile-fronts" deb NAME="$MODULE" VERSION="$VERSION"
done
3 changes: 3 additions & 0 deletions tools/packaging/package-templates/after-install-rsc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

chown vitamui:vitamui -R /vitamui/data/identity/

11 changes: 11 additions & 0 deletions tools/packaging/package-templates/after-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# After first install
#if [ $1 -eq 1 ] ; then
# Ensure rights for vitamui service file system
chown vitamui:vitamui -R /vitamui/*/identity/
chown vitamui:vitamui /vitamui/ /vitamui/*
chmod 0555 /vitamui/ /vitamui/*
chmod 0750 /vitamui/*/*

# Initial installation
systemctl preset vitamui-identity.service #>/dev/null 2>&1 || :
#fi
1 change: 1 addition & 0 deletions tools/packaging/package-templates/after-remove-rsc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rm -R /vitamui/data/identity/
1 change: 1 addition & 0 deletions tools/packaging/package-templates/after-remove.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
systemctl daemon-reload #>/dev/null 2>&1 || :
4 changes: 4 additions & 0 deletions tools/packaging/package-templates/before-install-rsc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

getent group vitamui >/dev/null || groupadd -g 4000 vitamui
getent passwd vitamui >/dev/null || useradd -u 4000 -g 4000 -s /bin/bash -c "vitamui user for rsc" vitamui

5 changes: 5 additions & 0 deletions tools/packaging/package-templates/before-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Init vitamui system group
getent group vitamui >/dev/null || groupadd -g 4000 vitamui

# Init vitamui system user
getent passwd vitamui >/dev/null || useradd -u 4000 -g 4000 -s /bin/bash -c "vitamui service user" vitamui
5 changes: 5 additions & 0 deletions tools/packaging/package-templates/before-remove.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
systemctl --no-reload disable vitamui-identity.service #> /dev/null 2>&1 || :
systemctl stop vitamui-identity.service #> /dev/null 2>&1 || :
#fi
1 change: 1 addition & 0 deletions tools/packaging/package-templates/sysconfig.cmd_line_args
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CMD_LINE_ARGS=-Dvitam.config.folder="/vitamui/conf/identity/" -Dvitamui.templates.folder="/vitamui/conf/identity/templates/" -jar "/vitamui/app/identity/__JAR_FILE__" --spring.config.additional-location="/vitamui/conf/identity/application.yml"
1 change: 1 addition & 0 deletions tools/packaging/package-templates/sysconfig.java_opts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
JAVA_OPTS=""
16 changes: 16 additions & 0 deletions tools/packaging/package-templates/vitamui.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=vitamui-identity service
After=network.target
After=syslog.target
After=vitam-consul.service

[Service]
Type=simple
EnvironmentFile=/vitamui/conf/identity/sysconfig/java_opts
EnvironmentFile=/vitamui/conf/identity/sysconfig/cmd_line_args
ExecStart=/usr/bin/env java $JAVA_OPTS $CMD_LINE_ARGS
User=vitamui
Group=vitamui

[Install]
WantedBy=multi-user.target
8 changes: 0 additions & 8 deletions ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@
<modules>
<module>ui-frontend-common</module>
<module>ui-frontend</module>
<module>ui-commons</module>
<module>ui-portal</module>
<module>ui-identity</module>
<module>ui-referential</module>
<module>ui-ingest</module>
<module>ui-archive-search</module>
<module>ui-pastis</module>
<module>ui-collect</module>
</modules>

</project>
6 changes: 0 additions & 6 deletions ui/ui-archive-search/package-lock.json

This file was deleted.

Loading

0 comments on commit 8b99847

Please sign in to comment.