Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gitlab-ci
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
wpdesk
Predators
Shopify
Tools
gitlab-ci
Commits
61601fcb
Commit
61601fcb
authored
2 weeks ago
by
Sebastian Pisula
Browse files
Options
Downloads
Patches
Plain Diff
postcode app
parent
edf30fc8
No related branches found
No related tags found
1 merge request
!24
Feature/new ci
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gitlab-ci.yml
+89
-110
89 additions, 110 deletions
gitlab-ci.yml
with
89 additions
and
110 deletions
gitlab-ci.yml
+
89
−
110
View file @
61601fcb
variables
:
PHP_ERROR_REPORTING
:
E_ALL
COMPOSER_ALLOW_SUPERUSER
:
1
GIT_STRATEGY
:
fetch
PRODUCTION_SHOPIFY_API_KEY
:
"
"
PRODUCTION_DEPLOY_HOST
:
s125.cyber-folks.pl
PRODUCTION_DEPLOY_PORT
:
222
PRODUCTION_DEPLOY_USER
:
wlgmnfabmq
PRODUCTION_DEPLOY_DIR
:
"
"
STAGE_SHOPIFY_API_KEY
:
"
"
STAGE_DEPLOY_HOST
:
s125.cyber-folks.pl
STAGE_DEPLOY_PORT
:
222
STAGE_DEPLOY_USER
:
wlgmnfabmq
STAGE_DEPLOY_DIR
:
"
"
RUN_AFTER_DEPLOY
:
"
pwd"
DEPLOY_AFTER_SCRIPT
:
"
"
PREDATORS_GROUP_ID
:
788
stages
:
-
build
-
tests
-
build
-
deploy
-
purge_cache
.template
:
&prepare-assets
tags
:
-
vendor
.template
:
&build-rules
rules
:
-
if
:
'
$CI_PIPELINE_SOURCE
==
"merge_request_event"
||
$CI_COMMIT_REF_NAME
==
"devel"'
when
:
always
variables
:
APP_ENV
:
"
staging"
SHOPIFY_APP_CLIENT_ID
:
$STAGING_SHOPIFY_APP_CLIENT_ID
MANTLE_PIXEL_TOKEN
:
$STAGING_MANTLE_PIXEL_TOKEN
-
if
:
'
$CI_COMMIT_TAG'
when
:
always
variables
:
APP_ENV
:
"
production"
SHOPIFY_APP_CLIENT_ID
:
$PRODUCTION_SHOPIFY_APP_CLIENT_ID
MANTLE_PIXEL_TOKEN
:
$PRODUCTION_MANTLE_PIXEL_TOKEN
.template
:
&deploy-rules
variables
:
RELEASE_VERSION
:
$CI_JOB_ID
SHOPIFY_APP_CONFIG
:
"
staging"
SHOPIFY_CLI_PARTNERS_TOKEN
:
$STAGING_SHOPIFY_CLI_PARTNERS_TOKEN
DEPLOY_DIR
:
$STAGING_DEPLOY_DIR
DEPLOY_USER
:
$STAGING_DEPLOY_USER
DEPLOY_PORT
:
$STAGING_DEPLOY_PORT
DEPLOY_HOST
:
$STAGING_DEPLOY_HOST
before_script
:
-
if [ "$RELEASE_VERSION" == "" ]; then echo "RELEASE_VERSION is empty" ; exit 1; fi
-
if [ "$SHOPIFY_APP_CONFIG" == "" ]; then echo "SHOPIFY_APP_CONFIG is empty" ; exit 1; fi
-
if [ "$SHOPIFY_CLI_PARTNERS_TOKEN" == "" ]; then echo "SHOPIFY_CLI_PARTNERS_TOKEN is empty" ; exit 1; fi
-
if [ "$DEPLOY_DIR" == "" ]; then echo "DEPLOY_DIR is empty" ; exit 1; fi
-
if [ "$DEPLOY_USER" == "" ]; then echo "DEPLOY_USER is empty" ; exit 1; fi
-
if [ "$DEPLOY_PORT" == "" ]; then echo "DEPLOY_PORT is empty" ; exit 1; fi
-
if [ "$DEPLOY_HOST" == "" ]; then echo "DEPLOY_HOST is empty" ; exit 1; fi
-
echo $RELEASE_VERSION;
-
echo $SHOPIFY_APP_CONFIG;
-
echo $DEPLOY_DIR;
rules
:
-
if
:
'
$CI_COMMIT_REF_NAME
==
"devel"'
# Automatyczne na branchu `devel`
when
:
always
-
if
:
'
$CI_PIPELINE_SOURCE
==
"merge_request_event"'
# Manualne w kontekście Merge Request
when
:
manual
-
if
:
'
$CI_COMMIT_REF_NAME
!=
"master"
&&
$CI_COMMIT_TAG
==
""'
# Manualne na innych branchach (bez `master` i tagów)
when
:
manual
-
if
:
'
$CI_COMMIT_TAG'
# Automatyczne na tagu (produkcja)
when
:
always
variables
:
RELEASE_VERSION
:
$CI_COMMIT_TAG
SHOPIFY_APP_CONFIG
:
"
production"
SHOPIFY_CLI_PARTNERS_TOKEN
:
$PRODUCTION_SHOPIFY_CLI_PARTNERS_TOKEN
DEPLOY_DIR
:
$PRODUCTION_DEPLOY_DIR
DEPLOY_USER
:
$PRODUCTION_DEPLOY_USER
DEPLOY_PORT
:
$PRODUCTION_DEPLOY_PORT
DEPLOY_HOST
:
$PRODUCTION_DEPLOY_HOST
build web frontend
:
<<
:
*build-rules
image
:
node:latest
artifacts
:
name
:
"
assets"
paths
:
-
web/frontend/dist
image
:
node:latest
stage
:
build
interruptible
:
true
script
:
-
if [ "$SHOPIFY_API_KEY" == "" ]; then echo "SHOPIFY_API_KEY is empty" ; exit 1; fi
before_script
:
-
if [ "$APP_ENV" == "" ]; then echo "APP_ENV is empty" ; exit 1; fi
-
if [ "$SHOPIFY_APP_CLIENT_ID" == "" ]; then echo "SHOPIFY_APP_CLIENT_ID is empty" ; exit 1; fi
-
if [ "$MANTLE_PIXEL_TOKEN" == "" ]; then echo "MANTLE_PIXEL_TOKEN is empty" ; exit 1; fi
-
echo $APP_ENV;
-
node -v
-
cd web/frontend
-
npm config set -- //${CI_SERVER_HOST}/:_authToken=${PREDATORS_DEPLOY_TOKEN}
-
npm config set @octolize:registry=https://${CI_SERVER_HOST}/api/v4/packages/npm/
-
npm config list
-
npm ci
script
:
-
npm ci
--prefer-offline --no-audit
-
npm run build
.template
:
&deploy-template
build web backend
:
<<
:
*build-rules
image
:
composer:latest
artifacts
:
paths
:
-
web/backend/vendor
stage
:
build
script
:
-
php -v
-
cd web/backend
-
composer config gitlab-token.gitlab.wpdesk.dev gitlab-ci-token ${CI_JOB_TOKEN}
-
composer install --optimize-autoloader --no-dev --no-scripts
deploy web
:
<<
:
*deploy-rules
image
:
wpdesknet/amazon-svn-deploy
stage
:
deploy
tags
:
-
vendor
before_script
:
script
:
-
echo "$DEMO_FS_SSH_KEY" | tr -d '\r' > ~/.ssh/id_rsa_demo_fs
-
chmod 0600 ~/.ssh/id_rsa_demo_fs
-
echo "$SSH_KNOWN_HOSTS" | tr -d '\r' > ~/.ssh/known_hosts
script
:
-
if [ "$DEPLOY_HOST" ] == "" ]; then echo "DEPLOY_HOST is empty" ; exit 1; fi
-
if [ "$DEPLOY_USER" ] == "" ]; then echo "DEPLOY_USER is empty" ; exit 1; fi
-
if [ "$DEPLOY_DIR" ] == "" ]; then echo "DEPLOY_DIR is empty" ; exit 1; fi
-
if [ "$DEPLOY_PORT" ] == "" ]; then echo "DEPLOY_PORT is empty" ; exit 1; fi
-
ls -al
-
ssh-keyscan -H -p $DEPLOY_PORT $DEPLOY_HOST >> ~/.ssh/known_hosts
-
export RSYNC_RSH="ssh -p $DEPLOY_PORT -v -i ~/.ssh/id_rsa_demo_fs"
...
...
@@ -63,80 +108,14 @@ stages:
-
ssh -p $DEPLOY_PORT -i ~/.ssh/id_rsa_demo_fs $DEPLOY_USER@$DEPLOY_HOST "cd $DEPLOY_DIR && php bin/console doctrine:migrations:migrate --no-interaction && php bin/console cache:clear && $RUN_AFTER_DEPLOY"
after_script
:
-
$DEPLOY_AFTER_SCRIPT
.template
:
&deploy-to-stage
<<
:
*deploy-template
variables
:
DEPLOY_HOST
:
$STAGE_DEPLOY_HOST
DEPLOY_PORT
:
$STAGE_DEPLOY_PORT
DEPLOY_USER
:
$STAGE_DEPLOY_USER
DEPLOY_DIR
:
$STAGE_DEPLOY_DIR
dependencies
:
-
composer install
-
prepare assets stage
-
build web backend
-
build web frontend
.template
:
&deploy-to-production
<<
:
*deploy-template
variables
:
DEPLOY_HOST
:
$PRODUCTION_DEPLOY_HOST
DEPLOY_PORT
:
$PRODUCTION_DEPLOY_PORT
DEPLOY_USER
:
$PRODUCTION_DEPLOY_USER
DEPLOY_DIR
:
$PRODUCTION_DEPLOY_DIR
dependencies
:
-
composer install
-
prepare assets production
composer install
:
artifacts
:
name
:
"
vendor"
paths
:
-
web/backend/vendor
image
:
composer:latest
tags
:
-
vendor
stage
:
build
interruptible
:
true
deploy app
:
<<
:
*deploy-rules
image
:
node:latest
stage
:
deploy
script
:
-
php -v
-
cd web/backend
-
composer config gitlab-token.gitlab.wpdesk.dev gitlab-ci-token ${CI_JOB_TOKEN}
-
composer install --optimize-autoloader --no-dev --no-scripts
prepare assets stage
:
<<
:
*prepare-assets
except
:
-
master
-
tags
variables
:
SHOPIFY_API_KEY
:
$STAGE_SHOPIFY_API_KEY
MANTLE_APP_TOKEN
:
$STAGE_MANTLE_APP_TOKEN
prepare assets production
:
<<
:
*prepare-assets
only
:
-
master
-
tags
variables
:
SHOPIFY_API_KEY
:
$PRODUCTION_SHOPIFY_API_KEY
MANTLE_APP_TOKEN
:
$PRODUCTION_MANTLE_APP_TOKEN
deploy to stage
:
<<
:
*deploy-to-stage
only
:
-
devel
deploy to stage manual
:
<<
:
*deploy-to-stage
when
:
manual
deploy to production
:
<<
:
*deploy-to-production
only
:
-
tags
deploy to production manual
:
<<
:
*deploy-to-production
only
:
-
master
-
tags
when
:
manual
-
npm ci
-
npm run deploy -- --force --version=$RELEASE_VERSION --config=$SHOPIFY_APP_CONFIG
\ No newline at end of file
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