Skip to content

Instantly share code, notes, and snippets.

@rockydd
Created August 28, 2018 10:10
Show Gist options
  • Save rockydd/925eb65194cec67e56125f292b00591b to your computer and use it in GitHub Desktop.
Save rockydd/925eb65194cec67e56125f292b00591b to your computer and use it in GitHub Desktop.
.tpl_install_npm: &npm_install
before_script:
- node -v && npm -v
- npm rebuild node-sass
- npm install --unsafe-perm --no-save
.build_staging_and_upload: &upload_gui_for_staging
image: vmdev/base_node:chrome-alpine
stage: staging_build
script:
- npm run -s build.staging
- tar czvf ${GUI_SERVE_TAR} serve
- echo Uploading ${GUI_SERVE_TAR} to artifactory
- curl -u${ARTIFACTORY_USER}:${ARTIFACTORY_PASSWORD} -T ${GUI_SERVE_TAR} ${ARTIFACTORY_URL}${GUI_SERVE_TAR}
variables:
GUI_SERVE_TAR: msp-gui-${CI_COMMIT_REF_SLUG}.tgz
cache:
key: "$CI_COMMIT_REF_NAME"
paths:
- node_modules/
- cache_global/
stages:
- test
- build
- staging_build
- demo_build
- demo_deploy
lint_and_spec:
image: vmdev/base_node:chrome-alpine
stage: test
<<: *npm_install
script:
-
- npm run -s test.ci
artifacts:
name: coverage
when: on_success
expire_in: 1 day
paths:
- coverage/
raw_build:
image: vmdev/base_node:chrome-alpine
stage: build
<<: *npm_install
script:
- npm run -s build
# -----------------------------------------------------------------------------
# staging jobs
upload_gui_pkg_for_branch:
<<: *upload_gui_for_staging
only:
- branches
except:
- master
when: manual
upload_gui_pkg_for_sandbox:
<<: *upload_gui_for_staging
only:
- draft/gui-sandbox
upload_gui_pkg_for_master:
<<: *upload_gui_for_staging
only:
- master
# -----------------------------------------------------------------------------
# demo site jobs
build_job:
stage: demo_build
tags:
- deployer
script:
- echo $CI_PROJECT_NAME $CI_BUILD_REF_NAME build start...
- pwd
- mv coverage/ src/assets/coverage-report
- project.sh -n $CI_PROJECT_NAME -a build -b $CI_BUILD_REF_NAME
when: manual
.cbuild_job:
stage: demo_build
tags:
- deployer
script:
- echo $CI_PROJECT_NAME cachebuild start...
- project.sh -n $CI_PROJECT_NAME -a cachebuild -b $CI_BUILD_REF_NAME
when: manual
.qbuild_job:
stage: demo_build
tags:
- deployer
script:
- echo $CI_PROJECT_NAME quick build start...
- echo "CI_BUILD_REF_NAME = $CI_BUILD_REF_NAME"
- echo "CI_PROJECT_NAME = $CI_PROJECT_NAME"
- echo "CI_COMMIT_SHA = $CI_COMMIT_SHA"
- project.sh -n $CI_PROJECT_NAME -a qbuild -b $CI_BUILD_REF_NAME -c "git checkout $CI_COMMIT_SHA"
when: manual
deploy_job:
stage: demo_deploy
tags:
- deployer
environment:
name: $CI_BUILD_REF_NAME/$CI_PROJECT_NAME
url: http://vmdev--$CI_PROJECT_NAME--master.${CI_RUNNER_DESCRIPTION}.agent.hs-portal.eng.vmware.com
script:
- echo "deploy script..."
- project.sh -n $CI_PROJECT_NAME -a start -b $CI_BUILD_REF_NAME -d "${CI_RUNNER_DESCRIPTION}.agent.hs-portal.eng.vmware.com"
- sleep 5
- docker ps | grep $CI_PROJECT_NAME
when: manual
# -----------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment