Commit 8e98cf79 authored by Christian Reuschling's avatar Christian Reuschling
Browse files

Update .gitlab-ci.yml file

parent 57a1dfbd
image: maven:3.6.3-openjdk-16
stages:
- mavenBuildAndDeploy
- deployFinalBundle
cache:
paths:
- .m2/repository
- target
before_script:
- echo "Generate maven settings.xml with deploy passwords."
- echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><settings xmlns=\"http://maven.apache.org/SETTINGS/1.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd\"><servers><server><id>artifactory-libs-releases-local</id><username>$ARTIFACTORY_USER</username><password>$ARTIFACTORY_PASSWORD</password></server><server><id>artifactory-libs-snapshots-local</id><username>$ARTIFACTORY_USER</username><password>$ARTIFACTORY_PASSWORD</password></server></servers></settings>" > ~/.m2/settings.xml
# - cat ~/.m2/settings.xml | sed 's/</\n</g'
mavenBuildAndDeploy:
stage: mavenBuildAndDeploy
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
script:
- echo "### Maven deploy without tests"
- mvn -Dmaven.test.skip -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository clean deploy
deployFinalBundle:
stage: deployFinalBundle
when: manual
script:
# maven
- echo "### Maven build for starter scripts+final bundle"
- mvn -Dmaven.test.skip -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository package appassembler:assemble assembly:single
- cd target;distFileName=`ls *-dist.zip`
# delete und upload zu generic packages repo https://docs.gitlab.com/ee/user/packages/generic_packages/
- echo "### Delete possible former generic package repository entry and upload the bundle"
- dirName=`echo $distFileName | sed 's/.zip//g'`
# wir müssen die id aus einem response rausparsen *würg*
- echo "### Install jq for json parsing"
- curl -L --output /usr/local/bin/jq "https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64"
- chmod +x /usr/local/bin/jq
- 'packageId=`curl --header "PRIVATE-TOKEN: $PRIVATE_ACCESS_TOKEN" "https://git.opendfki.de/api/v4/projects/19/packages" | jq -r ".[] | select(.name == \"$dirName\") | .id"`'
#löschen eines alten Files mit gleichen Daten - wir wollen immer nur ein bundle für eine Version haben
- 'curl --request DELETE --header "PRIVATE-TOKEN: $PRIVATE_ACCESS_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/$packageId"'
# upload des neuen Files :)
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file $distFileName "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/$dirName/0.0.0/$distFileName"'
# Ich erstelle jetzt KEIN dediziertes release mehr. Der hier angegebene downloadlink zum bundle ist nur zu erreichen wenn man eingeloggt ist. Beim generic package dahingegen kann jeder darauf zugreifen, so wie ich es möchte. Dann nehme ich halt die, genauso hübsch. Sch** drauf.
# # das super gitlab-release muß man noch nachinstallieren. Daumen hoch
# - echo "### Install GitLab release-cli"
# - curl -L --output /usr/local/bin/release-cli "https://release-cli-downloads.s3.amazonaws.com/latest/release-cli-linux-amd64"
# - chmod +x /usr/local/bin/release-cli
# - release-cli -v
# # ich mache das mit dem Aufruf anstatt dem release CI/CD part, da ich ansonsten nicht meine Variablen zur Verfügung habe
# # löschen und erstellen
# - echo "### Delete possible former release and create a new one"
# - version=`echo $distFileName | sed -e 's/horst-graph-\|-dist.zip//g'`
# - 'curl --request DELETE --header "PRIVATE-TOKEN: $PRIVATE_ACCESS_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/releases/$version"'
# - release-cli create --name "Horst-graph version $version" --description "" --tag-name "$version" --assets-link "{\"name\":\"$distFileName\",\"url\":\"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/$dirName/0.0.0/$distFileName\"}"
# die artifacts werden alle in einem artifacts.zip reingepackt, und darin liegt dann mein einziges bundle file - geht gar ned
#artifacts:
# public: true
# paths:
# - target/horst-graph-*-dist.zip
# #47 yrs 6 mos and 4d
# expire_in: 1 week
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment