Skip to content
Snippets Groups Projects
Commit 122d61d4 authored by Felix Reichenbach's avatar Felix Reichenbach
Browse files

add pipeline scripts

parent 20d930dd
No related branches found
No related tags found
1 merge request!1add pipeline scripts
Showing
with 128 additions and 0 deletions
#!/usr/bin/env bash
export IMAGE_TAG=$($SCRIPT_DIR/get_tag_version.sh)
export DOCKER_REGISTRY_IMAGE=$DOCKER_REGISTRY_IMAGE
if [[ "$CI_COMMIT_REF_NAME" == "main" ]]; then
profile="main"
elif [[ "$CI_COMMIT_REF_NAME" == "release" ]]; then
profile="release"
else
profile="dev"
fi
run_mvn.sh spring-boot:build-image -DskipTests -Dmaven.wagon.http.retryHandler.count=3 -P $profile -Ddocker.publishRegistry.username=${NEXUS_USER} -Ddocker.publishRegistry.password=${NEXUS_PASSWORD}
#!/usr/bin/env bash
release_regex='\d+.\d+.\d+'
snapshot_regex='\d+.\d+.\d+-SNAPSHOT'
rootVersion=$(run_mvn.sh help:evaluate -Dexpression=project.version -q -DforceStdout)
if [[ "$CI_COMMIT_REF_NAME" == "release" ]]; then
if ! [[ "$rootVersion" =~ $release_regex ]]; then
echo "Keine Release Version für Branch $CI_COMMIT_REF_NAME."
exit 1
fi
else
if ! [[ "$rootVersion" =~ $snapshot_regex ]]; then
echo "Keine Snapshot Version für Branch $CI_COMMIT_REF_NAME."
exit 1
fi
fi
\ No newline at end of file
#!/usr/bin/env bash
## install prerequisites
apk add --no-cache git
## configure git
git config --global user.email "ozgcloud@mgm-tp.com"
git config --global user.name "OZGCloud"
\ No newline at end of file
#!/usr/bin/env bash
## install helm
apk add --no-cache helm curl
helm plugin install https://github.com/helm-unittest/helm-unittest.git
\ No newline at end of file
#!/usr/bin/env bash
## create maven settings file
echo "${MAVEN_SETTINGS_BASE64}" | base64 -d > "${CI_PROJECT_DIR}/settings.xml"
mv $SCRIPT_DIR/run_mvn.sh /usr/bin
\ No newline at end of file
#!/usr/bin/env bash
apk add --no-cache python3 py3-pip
# install pyyaml in a virtual environment
python3 -m venv $PYTHON_VENV_PATH
. $PYTHON_VENV_PATH/bin/activate
pip3 install pyyaml
\ No newline at end of file
#!/usr/bin/env bash
jar_version=$(run_mvn.sh help:evaluate -Dexpression=project.version -q -DforceStdout | sed "s/SNAPSHOT/${CI_COMMIT_REF_NAME:0:20}-SNAPSHOT/")
run_mvn.sh versions:set -DnewVersion=$jar_version -DprocessAllModules=true
run_mvn.sh deploy -DskipTests -Dmaven.wagon.http.retryHandler.count=3
\ No newline at end of file
#!/usr/bin/env bash
image_tag=$($SCRIPT_DIR/get_tag_version.sh)
run_mvn.sh -P ci-build package -DskipTests
run_mvn.sh io.github.pmckeown:dependency-track-maven-plugin:upload-bom -Ddependency-track.apiKey=$dependency_track_api_key -Ddependency-track.projectVersion=$image_tag -Ddependency-track.dependencyTrackBaseUrl=https://dependency-track.ozg-sh.de
#!/usr/bin/env bash
printf $(run_mvn.sh help:evaluate -Dexpression=project.version -q -DforceStdout | sed "s/SNAPSHOT/${CI_COMMIT_REF_NAME:0:20}-SNAPSHOT-${CI_PIPELINE_ID}/")
\ No newline at end of file
#!/usr/bin/env bash
clone_gitops_repo() {
git clone https://$GITEA_USER:$GITEA_PASSWORD@git.ozg-sh.de/ozgcloud-devops/gitops.git
cd gitops
}
environment="$1"
service_name="$2"
service_value=$(echo $service_name | sed "s/-/_/g")
new_version=$($SCRIPT_DIR/get_tag_version.sh)
clone_gitops_repo
. $PYTHON_VENV_PATH/bin/activate
python3 $SCRIPT_DIR/set_version.py "$environment/application/values/$service_name-values.yaml" "$service_value" "$new_version" || exit 1
git add $environment/application/values/$service_name-values.yaml
git commit -m "gitlab rollout $environment $service_name version $new_version"
git push https://$GITEA_USER:$GITEA_PASSWORD@git.ozg-sh.de/ozgcloud-devops/gitops.git
\ No newline at end of file
#!/usr/bin/env bash
mvn -s "${CI_PROJECT_DIR}/settings.xml" -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn --no-transfer-progress "$@"
if [[ "$?" -ne 0 ]] ; then
echo 'Maven command failed!'; exit 1
fi
#!/usr/bin/python3
import yaml
import sys
values_file = sys.argv[1]
service_name = sys.argv[2]
new_version = sys.argv[3]
with open(values_file) as file:
ymldoc = yaml.safe_load(file)
ymldoc[service_name]['image']['tag'] = new_version
ymldoc[service_name]['helm']['version'] = new_version
with open(values_file, "w") as ostream:
yaml.dump(ymldoc, ostream, default_flow_style=False, sort_keys=False)
\ No newline at end of file
#!/usr/bin/env bash
service_name="$1"
helm_chart_version=$($SCRIPT_DIR/get_tag_version.sh)
./run_helm_test.sh
cd src/main/helm
helm package --version=$helm_chart_version .
if [[ "$CI_COMMIT_REF_NAME" == "release" ]]; then
repository=ozg-base-apps
else
repository=ozg-base-apps-snapshot
fi
curl -u $NEXUS_USER:$NEXUS_PASSWORD -F file=@$service_name-$helm_chart_version.tgz https://nexus.ozg-sh.de/service/rest/v1/components?repository=$repository
#!/usr/bin/env bash
source_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
export SCRIPT_DIR="$source_dir/pipeline-scripts"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment