Skip to content

Commit

Permalink
gitlab-ci: build special version on branch
Browse files Browse the repository at this point in the history
  • Loading branch information
rp- committed Jan 18, 2024
1 parent 5c92387 commit fe07ea4
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ stages:
- build
- test
- deploy
- deploy_tests

before_script:
# setup ssh access to clone python-linstor dep
Expand Down Expand Up @@ -105,16 +106,28 @@ test:3.10:
reports:
junit: test-reports/TEST-*.xml

build:
deploy_client:
stage: deploy
image: $LINBIT_DOCKER_REGISTRY/build-helpers:latest
rules:
- if: '$CI_COMMIT_BRANCH == "jenkins"'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: $CI_COMMIT_BRANCH == 'master'
before_script:
- curl -sSL $LINBIT_REGISTRY_URL/repository/lbbuild/lbbuildctl-latest -o /usr/local/bin/lbbuildctl
- chmod +x /usr/local/bin/lbbuildctl
script:
- LINSTOR_CLIENT_VERSION=1.99.0
- |
case "$CI_COMMIT_REF_NAME" in
"master") VERSION_SUFFIX="" ;;
*) VERSION_SUFFIX=.dev$(echo -n $CI_COMMIT_REF_NAME | md5sum| sed -e 's/[^0-9]//g' | cut -c -9) ;;
esac
- LINSTOR_CLIENT_VERSION=1.99.0$VERSION_SUFFIX
- PYTHON_LINSTOR_VERSION=1.99.0
- |
if curl --head -f $LINBIT_REGISTRY_URL/repository/lbbuild-upstream/python-linstor-$PYTHON_LINSTOR_VERSION$VERSION_SUFFIX.tar.gz ; then
PYTHON_LINSTOR_VERSION=$LINSTOR_CLIENT_VERSION
echo "USING PYTHON_LINSTOR: $PYTHON_LINSTOR_VERSION"
fi
- awk -f "/usr/local/bin/dch.awk" -v PROJECT_VERSION="$LINSTOR_CLIENT_VERSION" -v PROJECT_NAME="linstor-client" debian/changelog > debian/changelog.tmp
- mv debian/changelog{.tmp,}
- sed -i "s/LINSTOR_CLI_VERSION [0-9.]*/LINSTOR_CLI_VERSION $LINSTOR_CLIENT_VERSION/g" Dockerfile
Expand All @@ -126,10 +139,13 @@ build:
- NO_DOC="-no-doc" make debrelease
- curl -isSf -u $LINBIT_REGISTRY_USER:$LINBIT_REGISTRY_PASSWORD --upload-file dist/linstor-client-$LINSTOR_CLIENT_VERSION.tar.gz $LINBIT_REGISTRY_URL/repository/lbbuild-upstream/
- curl -X DELETE -u $LINBIT_REGISTRY_USER:$LINBIT_REGISTRY_PASSWORD $LINBIT_REGISTRY_URL/repository/rhel8/x86_64/linstor-client-$LINSTOR_CLIENT_VERSION-1.noarch.rpm
- lbbuildctl build linstor-client --arch amd64 --ci -v "$LINSTOR_CLIENT_VERSION" -p "$LINSTOR_CLIENT_VERSION" -l -e LINBIT_REGISTRY_USER=$LINBIT_REGISTRY_USER -e LINBIT_REGISTRY_PASSWORD=$LINBIT_REGISTRY_PASSWORD -e LINBIT_REGISTRY_URL=$LINBIT_REGISTRY_URL -d ubuntu-bionic,ubuntu-focal,rhel7.0,rhel8.0
- lbbuildctl build linstor-client --arch amd64 --ci -v "$LINSTOR_CLIENT_VERSION" -p "$PYTHON_LINSTOR_VERSION" -l -e LINBIT_REGISTRY_USER=$LINBIT_REGISTRY_USER -e LINBIT_REGISTRY_PASSWORD=$LINBIT_REGISTRY_PASSWORD -e LINBIT_REGISTRY_URL=$LINBIT_REGISTRY_URL -d ubuntu-bionic,ubuntu-focal,rhel7.0,rhel8.0

staging:
stage: deploy
stage: deploy_tests
variables:
ARG_COMMIT_BRANCH: $CI_COMMIT_REF_NAME
rules:
- if: '$CI_COMMIT_BRANCH == "jenkins"'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: $CI_COMMIT_BRANCH == 'master'
trigger: linstor/linstor-tests

0 comments on commit fe07ea4

Please sign in to comment.