Skip to content

mvn-build-pipeline - #24

Open
LongusBongus wants to merge 15 commits into
mainfrom
mvn-build-pipeline
Open

mvn-build-pipeline#24
LongusBongus wants to merge 15 commits into
mainfrom
mvn-build-pipeline

Conversation

@LongusBongus

Copy link
Copy Markdown
Contributor

Shell build pipeline for building and serving a AKTIN data warehouse. Builds project modules local and resolves module dependencies by searching project commits. The pipeline assembler uses a commit-id based system, making module targeting precise and pipeline configuration flexible.

Still some todos inside script but tests were good. I tested on a ubuntu 22 system and build the default configuration inside the repository, that receives only the latest release tag "v1.6rc1". Target was a VM with debian instance of AKTIN data warehouse.

@LongusBongus
LongusBongus requested a review from akomii February 11, 2026 12:55
@LongusBongus LongusBongus self-assigned this Feb 11, 2026
@LongusBongus LongusBongus added the enhancement New feature or request label Feb 11, 2026

@akomii akomii left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments

Comment thread general/build_dwh_modules.sh Outdated
Comment thread general/build_dwh_modules.sh Outdated
Comment thread general/build_dwh_modules.sh Outdated
return 1
}

generate_project_whitelist() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function stores the specified project names in the configuration (eager loading). The whitelist acts as a filter to prevent including POM files from different subdirectories that happen to share the same name.

For example, in my setup I created a test project called complete_dwh that aggregates all DWH modules. When the script runs, those modules would also be detected and could interfere with the pipeline. The whitelist ensures that only the intended projects are considered.

Comment thread general/build_dwh_modules.sh Outdated
Comment thread general/build_dwh_modules.sh Outdated
Comment thread general/build_dwh_modules.sh Outdated
Comment thread general/build_dwh_modules.sh
Comment thread general/projects.conf Outdated

@akomii akomii left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments attached. Do we have somewhere the intended purpose of this script written down?

Comment thread general/build_dwh_modules.sh
Comment thread general/build_dwh_modules.sh Outdated
Comment thread general/build_dwh_modules.sh
Comment thread general/build_dwh_modules.sh Outdated
Comment thread general/build_dwh_modules.sh Outdated
Comment thread general/build_dwh_modules.sh Outdated
Comment on lines +729 to +734
# start a new ssh session
ssh -o ControlMaster=auto -o ControlPersist=5m -o ControlPath="$ctl" -Nf "$host"
# copy ear to target host
scp -o ControlPath="$ctl" "$ear_path" "$host:/tmp/$ear_name"
ssh -o ControlPath="$ctl" "$host" "$remote_cmd"
ssh -O exit -o ControlPath="$ctl" "$host"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise for docker, to avoid repeated authentication input from user

Comment on lines +722 to +723
# Currently Wildfly seems to automatically deploy the ear when copied to this directory.
remote_cmd+="sudo docker cp /tmp/$ear_name $wildfly_container:/opt/wildfly/standalone/deployments/ ; "

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could just stop the Wildfly, clean the deployments, put in the new ones and restart wildfly

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not find a wildfly service inside the docker container to use:

$ service wildfly restart
wildfly: unrecognized service

Systemctl is not available as well so JBoss-CLI was the next option to try

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

systemd is not available on docker. What I meant was on a container basis. The DEV_MODE opens up the wildfly deployments folder on the host. You could stop the container, switch out the deployments and restart the container afterwards

Comment thread general/build_dwh_modules.sh Outdated
Comment on lines +697 to +700
ssh -o ControlMaster=auto -o ControlPersist=5m -o ControlPath="$ctl" -Nf "$host"
scp -o ControlPath="$ctl" "$ear_path" "$host:/tmp/$ear_name"
ssh -o ControlPath="$ctl" "$host" "$remote_cmd"
ssh -O exit -o ControlPath="$ctl" "$host"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This starts a ssh session to the target system. If each command would be executed on its own, each time it would require a new password authentication because each command would start a new terminal

Comment thread general/build_dwh_modules.sh Outdated
Comment on lines +417 to +443
git_resolve_module_to_commit() {
# This function returns the last commit containing the artifact-version pair
local artifact="$1"
local version="$2"

local target_path
target_path="$(resolve_artifact_to_pom "$artifact")"

if [[ -z "$target_path" ]]; then
log_error "No artifact '$artifact' found inside project pom-files"
return 1
fi
log_info "Found artifact '$artifact' inside '$target_path'"

local target_dir relative_path
target_dir="$(dirname "$target_path")"
relative_path="$(git -C "$target_dir" rev-parse --show-prefix)pom.xml"

# Search commit containing the requested artifact version
local commit
commit="$(resolve_to_commit "$target_dir" "$version" "$relative_path")"

if [[ -z "$commit" ]]; then
log_error "Did not find '$artifact:$version'"
fi

printf '%s:%s\n' "$target_path" "$commit"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if Git is here just overkill. Maybe just focus the scope on local builds? Let the users decide themselves, which branches to use for the build. The script should only align the current local branch versions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users can already use branches as identifiers for builds.

I think it would be a good idea to assess the requirements on this script. At this complexity it could make more sense to use the script in a CICD pipeline as a test stage, for analyzing the dependency structure of the project.

The reason for this script to be created was that the production branch of the project had misaligning dependencies. Restricting this scripts' scope to local builds like i understand it, would be just a minor improvement of already existing scripts and would also not fix the core issue coming from the dependencies.

Comment on lines +212 to +220
if [[ "$rm_packages" == "true" ]]; then
echo "[WARN] Removing all packages from local Maven installations"
if [[ -d "$HOME/.m2/repository/org/aktin" ]]; then
rm -rf ~/.m2/repository/org/aktin
echo "[INFO] Removed artifacts from local maven store"
else
echo "[INFO] No Local maven store found, skipping."
fi
fi

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont really get it. mvn install builds the artifact and copies into the local maven repository.

How can it happen that a dependency is not being build?

Therefore dependencies are still being loaded from the local repository and will not be build.

I dont understand this sentence

Comment on lines +722 to +723
# Currently Wildfly seems to automatically deploy the ear when copied to this directory.
remote_cmd+="sudo docker cp /tmp/$ear_name $wildfly_container:/opt/wildfly/standalone/deployments/ ; "

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

systemd is not available on docker. What I meant was on a container basis. The DEV_MODE opens up the wildfly deployments folder on the host. You could stop the container, switch out the deployments and restart the container afterwards

Comment on lines +51 to +53
-p, --server-ip <IP> Target server IP / host.
--set-java-8 <PATH> Path to installed Java SDK 8.
--set-java-11 <PATH> Path to installed Java SDK 11.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switch server ip with the set-java (better styling)

Comment on lines +55 to +70
-b, --build-from <NAME> Start building from the given project name.
Default: build all configured projects.

-d, --project-dir <DIR> Root directory that contains the project folders.
-d, --project-dir <DIR> Root directory containing project folders.
Default: current working directory.

-c, --config <FILE> Path to config file to load projects array from.
Default: ./projects.conf (will be copied to ./script-config.conf)

-r, --remove-packages Remove local Maven artifacts under ~/.m2/repository/org/aktin
before building.
Default: false
-c, --config <FILE> Config file containing project list.
Default: ./projects.conf (copied to ./script-config.conf)

-i, --instance <NAME> Instance/environment selector.
Default: debian, Options: debian, docker
-r, --remove-packages Remove local Maven artifacts under
~/.m2/repository/org/aktin before build.

-w, --wildfly <NAME> Name of Wildfly container. Required if instance is set to "docker".
-i, --instance <NAME> Environment selector.
Options: debian, docker (default: debian)

-h, --help Show this help and exit.
-w, --wildfly <NAME> Wildfly container name (required for docker).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add also in the desc, which of these arguments are optional, i.e.

  -c, --config <FILE>          (optional) Path to config file to load projects array from.
                               Default: ./projects.conf (will be copied to ./script-config.conf)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants