Skip to content

Instantly share code, notes, and snippets.

@kenvontucky
Created September 28, 2018 13:29
Show Gist options
  • Save kenvontucky/f863f5628b7015963a919b8880f95214 to your computer and use it in GitHub Desktop.
Save kenvontucky/f863f5628b7015963a919b8880f95214 to your computer and use it in GitHub Desktop.
gitlab ci cd google app engine manual deploy
image: node:latest
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
stages:
- test
- build
- deploy
job:test:
stage: test
before_script:
- apt-get update && apt-get install -y unzip fontconfig locales gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
- npm install --silent
script: node_modules/.bin/ng test
job:e2e:
stage: test
before_script:
- apt-get update && apt-get install -y unzip fontconfig locales gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
- npm install --silent
script: node_modules/.bin/ng e2e
release:build:
stage: build
script: node_modules/.bin/ng build --prod --aot
artifacts:
name: "project-$CI_COMMIT_REF_NAME"
paths:
- dist/
only:
- tags
deploy:production:
stage: deploy
environment:
name: production
url: http://demo-app.com
before_script:
- wget https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-218.0.0-linux-x86.tar.gz
- tar -xzf google-cloud-sdk-218.0.0-linux-x86.tar.gz
- ./google-cloud-sdk/install.sh
dependencies:
- release:build
script:
- echo $GAE_KEY_FILE > gae_auth.json
- ./google-cloud-sdk/bin/gcloud auth activate-service-account --key-file gae_auth.json
- ./google-cloud-sdk/bin/gcloud app deploy --project=$GAE_PROJECT_ID
when: manual
only:
- tags
@TheDevelolper
Copy link

Do you have a link for the accompanying package.json file?

@kenvontucky
Copy link
Author

Here is the package.json

{
  "name": "demo-app",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.1.0",
    "@angular/common": "^6.1.0",
    "@angular/compiler": "^6.1.0",
    "@angular/core": "^6.1.0",
    "@angular/forms": "^6.1.0",
    "@angular/http": "^6.1.0",
    "@angular/platform-browser": "^6.1.0",
    "@angular/platform-browser-dynamic": "^6.1.0",
    "@angular/router": "^6.1.0",
    "core-js": "^2.5.4",
    "puppeteer": "^1.8.0",
    "rxjs": "~6.2.0",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.8.0",
    "@angular/cli": "~6.2.2",
    "@angular/compiler-cli": "^6.1.0",
    "@angular/language-service": "^6.1.0",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.3.0",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~2.9.2"
  }
}

@sourabhsurana1008
Copy link

Can you please provide gitlab runner configration for run jobs. So i am thinking it may be issue of runner type. please check below given error log.

config.toml

concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "analytics-runner"
  url = "https://gitlab.com/"
  token = "*********"
  executor = "docker"
  shell = "powershell"
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]

Error log
ERROR: Preparation failed: missing docker configuration
Will be retried in 3s ...
ERROR: Preparation failed: missing docker configuration
Will be retried in 3s ...
ERROR: Preparation failed: missing docker configuration
Will be retried in 3s ...
ERROR: Job failed (system failure): missing docker configuration

@kenvontucky
Copy link
Author

Sorry, I'm not using any custom runner, the example uses the default gitlab runners. I suggest you to take a look at https://docs.gitlab.com/runner/configuration/advanced-configuration.html.

@sourabhsurana1008
Copy link

Thanks for quick reply. I have last question regarding final outcome. Will your yml create docker image or only artifacts ?

@kenvontucky
Copy link
Author

Only artifacts are created under release:build.

@sourabhsurana1008
Copy link

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment