Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drupal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitLab CI/CD
Drupal
Commits
a68e1717
Commit
a68e1717
authored
4 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
#1
Optimize code for DB rebuild logic
parent
55b3ed37
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test-and-deploy.yml
+52
-28
52 additions, 28 deletions
test-and-deploy.yml
with
52 additions
and
28 deletions
test-and-deploy.yml
+
52
−
28
View file @
a68e1717
stages
:
-
validation
-
build
-
prepare
-
test
-
deploy
variables
:
DBREQUIRED
:
"
no"
.wait
:
script
:
-
while [ ! -f /tmp/foo.txt ]; do echo "waiting..."; sleep 1; done
...
...
@@ -47,6 +51,33 @@ stages:
key
:
build-${COMPOSE_PROJECT_NAME}
<<
:
*cache_paths
.prerequisites
:
stage
:
validation
tags
:
-
default
variables
:
GIT_STRATEGY
:
none
script
:
|
if [[ "$CI_COMMIT_REF_NAME" == "master" ]]; then
DBREQUIRED="yes"
elif [[ "$CI_COMMIT_REF_NAME" == *"[re-build-db]"* ]]; then
DBREQUIRED="yes"
elif [[ "$FORCE_DB_UPDATE" == "yes" ]]; then
DBREQUIRED="yes"
else
ID=$(docker container ls --all -q -f name=^${COMPOSE_PROJECT_NAME}_mariadb_1$)
if [[ ! -n ${ID} ]]; then
DBREQUIRED="yes"
else
# TODO: check if DB in container is empty.
echo "DB check not yet implemented"
fi
fi
except
:
variables
:
-
$CAE
-
$DISABLE_CI_TESTS
.build
:
stage
:
build
tags
:
...
...
@@ -91,19 +122,16 @@ stages:
-
ansible
variables
:
GIT_STRATEGY
:
none
script
:
-
ascr drupal-dump-db ${CI_PROJECT_PATH} ${PWD}/${CI_PROJECT_NAME}.sql master
script
:
|
if [[ "$DBREQUIRED" == "yes" ]]; then
ascr drupal-dump-db ${CI_PROJECT_PATH} ${PWD}/${CI_PROJECT_NAME}.sql master
fi
cache
:
{}
artifacts
:
name
:
dbdump
when
:
always
paths
:
-
${CI_PROJECT_NAME}.sql
only
:
variables
:
-
$CI_COMMIT_REF_NAME == "master"
-
$CI_COMMIT_MESSAGE =~ /\[re-build-db\]/i
-
$FORCE_DB_UPDATE == "yes"
except
:
refs
:
-
tags
...
...
@@ -118,19 +146,16 @@ stages:
-
default
variables
:
GIT_STRATEGY
:
none
script
:
-
docker cp ${CI_PROJECT_NAME}.sql ${COMPOSE_PROJECT_NAME}_php_1:/var/www/html
-
drush sql:drop --yes
-
drush sql:query --file=../${CI_PROJECT_NAME}.sql
-
drush cr
-
drush updatedb
-
drush config-import sync
-
drush cr
only
:
variables
:
-
$CI_COMMIT_REF_NAME == "master"
-
$CI_COMMIT_MESSAGE =~ /\[re-build-db\]/i
-
$FORCE_DB_UPDATE == "yes"
script
:
|
if [[ "$DBREQUIRED" == "yes" ]]; then
docker cp ${CI_PROJECT_NAME}.sql ${COMPOSE_PROJECT_NAME}_php_1:/var/www/html
drush sql:drop --yes
drush sql:query --file=../${CI_PROJECT_NAME}.sql
drush cr
drush updatedb
drush config-import sync
drush cr
fi
except
:
refs
:
-
tags
...
...
@@ -148,19 +173,18 @@ stages:
-
default
variables
:
GIT_STRATEGY
:
none
script
:
-
drush cr
-
drush updatedb
-
drush config-import sync
-
drush cr
script
:
|
if [[ "$DBREQUIRED" == "no" ]]; then
drush cr
drush updatedb
drush config-import sync
drush cr
fi
except
:
refs
:
-
master
-
tags
variables
:
-
$CI_COMMIT_MESSAGE =~ /^Merge tag /i
-
$CI_COMMIT_MESSAGE =~ /\[re-build-db\]/i
-
$FORCE_DB_UPDATE == "yes"
-
$CAE
-
$DISABLE_CI_TESTS
dependencies
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment