Commit 8f57e18d authored by Mihai Nita's avatar Mihai Nita

GitLab CI for Okapi Integration Tests

parent 7b9c8e2b
Pipeline #39465329 failed with stage
in 40 seconds
<?xml version="1.0"?>
<settings>
<servers>
<server>
<id>sonatype</id>
<username>${MAVEN_REPO_USER}</username>
<password>${MAVEN_REPO_PASS}</password>
</server>
</servers>
<profiles>
<profile>
<id>sign_and_deploy</id>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.passphrase>${GPG_PASSPHRASE}</gpg.passphrase>
</properties>
<repositories>
<repository>
<id>sonatype</id>
<name>Snapshots Repository for Downloads</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
</settings>
stages:
- verification
variables:
CI_GITLAB_PATH: "ci/gitlab"
CI_SCRIPTS_PATH: "${CI_GITLAB_PATH}/scripts"
DOCKER_DRIVER: "overlay2"
GIT_DEPTH: "3"
MAVEN_CLI_OPTS: "--settings ${CI_GITLAB_PATH}/.m2/settings.xml --batch-mode --errors --show-version"
# CI_DEBUG_TRACE: "true" # WARNING: all secret variables will be exposed to a job output!
image: registry.gitlab.com/okapiframework/okapi
before_script:
- ${CI_SCRIPTS_PATH}/before-job
after_script:
- ${CI_SCRIPTS_PATH}/after-job
verification:
stage: verification
cache:
paths:
- ${HOME}/.m2/repository/
before_script:
- ${CI_SCRIPTS_PATH}/before-job
script:
- mvn verify ${MAVEN_CLI_OPTS}
- touch ${CI_GITLAB_PATH}/${CI_JOB_NAME}-passed
#!/usr/bin/env bash
if [ ! -f ${CI_GITLAB_PATH}/${CI_JOB_NAME}-passed ] ; then
BUILD_STATUS=failed ${CI_SCRIPTS_PATH}/build-status;
else
BUILD_STATUS=passed ${CI_SCRIPTS_PATH}/build-status;
fi
#!/usr/bin/env bash
rm -f ${CI_GITLAB_PATH}/${CI_JOB_NAME}-passed
BUILD_STATUS=running ${CI_SCRIPTS_PATH}/build-status
#!/usr/bin/env bash
# Push GitLab CI/CD build status to Bitbucket Cloud
if [ -z "$BITBUCKET_ACCESS_TOKEN" ]; then
echo "ERROR: BITBUCKET_ACCESS_TOKEN is not set"
exit 1
fi
if [ -z "$BITBUCKET_USERNAME" ]; then
echo "ERROR: BITBUCKET_USERNAME is not set"
exit 1
fi
if [ -z "$BITBUCKET_NAMESPACE" ]; then
echo "Setting BITBUCKET_NAMESPACE to $CI_PROJECT_NAMESPACE"
BITBUCKET_NAMESPACE=$CI_PROJECT_NAMESPACE
fi
if [ -z "$BITBUCKET_REPOSITORY" ]; then
echo "Setting BITBUCKET_REPOSITORY to $CI_PROJECT_NAME"
BITBUCKET_REPOSITORY=$CI_PROJECT_NAME
fi
BITBUCKET_API_ROOT="https://api.bitbucket.org/2.0"
BITBUCKET_STATUS_API="$BITBUCKET_API_ROOT/repositories/$BITBUCKET_NAMESPACE/$BITBUCKET_REPOSITORY/commit/$CI_COMMIT_SHA/statuses/build"
BITBUCKET_KEY="$CI_GITLAB_PATH/$CI_JOB_NAME"
BITBUCKET_NAME="$CI_JOB_STAGE:$CI_JOB_NAME:$BUILD_STATUS"
BITBUCKET_DESCRIPTION="Pipeline #$CI_PIPELINE_ID"
case "$BUILD_STATUS" in
running)
BITBUCKET_STATE="INPROGRESS"
;;
passed)
BITBUCKET_STATE="SUCCESSFUL"
;;
failed)
BITBUCKET_STATE="FAILED"
;;
esac
echo "Pushing status to $BITBUCKET_STATUS_API..."
curl --request POST $BITBUCKET_STATUS_API \
--user $BITBUCKET_USERNAME:$BITBUCKET_ACCESS_TOKEN \
--header "Content-Type:application/json" \
--silent \
--data "{ \"state\": \"$BITBUCKET_STATE\",
\"key\": \"$BITBUCKET_KEY\",
\"name\": \"$BITBUCKET_NAME\",
\"description\": \"$BITBUCKET_DESCRIPTION\",
\"url\": \"$CI_JOB_URL\" }"
Markdown is supported
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