Skip to content

Instantly share code, notes, and snippets.

@vickoman
Created March 14, 2019 02:56
Show Gist options
  • Save vickoman/4c376967795d38e7f6dcf2974b744f6c to your computer and use it in GitHub Desktop.
Save vickoman/4c376967795d38e7f6dcf2974b744f6c to your computer and use it in GitHub Desktop.
### Author: Peter
### Created: Visual Studio Code
### Title: Widget Composer SDK pipeline
## Define the process
jobs:
- name: production-sdk
build_logs_to_retain: 5
serial: true
plan:
## Trigger slack alarm
- put: notify
params:
alert_type: started
# ## Get Knowbly SDK
- get: sdk
passed: []
trigger: false
## Build the App
- task: pack-npm
config:
platform: linux
image_resource:
type: docker-image
source:
repository: parboleda/node-knowbly
inputs:
- name: sdk
run:
path: sh
args:
- -exc
- |
apt-get update
apt-get install zip
apt-get install -y jq
jq --version
cd sdk
echo ((credentials.backup))-sdk-$(jq -r .version package.json)
zip -r ((credentials.backup))-sdk-$(jq -r .version package.json).zip ./
cp ./((credentials.backup))-sdk-$(jq -r .version package.json).zip ../build-output
ls ../build-output
outputs:
- name: build-output
## Copy flags
- task: copy-flags
config:
platform: linux
image_resource:
type: docker-image
source:
repository: parboleda/node-knowbly
inputs:
- name: sdk
run:
path: sh
args:
- -exc
- |
cd sdk
cp ./config/devFlags.default.js ./config/devFlags.js
cp -R ./ ../build-output-flags
ls ../build-output-flags
outputs:
- name: build-output-flags
# ## Push Knowbly SDK
- put: deploy-to-PCF
params:
manifest: build-output-flags/prod-manifest.yml
path: build-output-flags
on_success:
put: notify
params:
# var:
# - name: GIT_MSG
# file_value: sdk/.git/commit_message
# - name: GIT_COM
# file_value: sdk/.git/committer
# - name: GIT_REF
# file_value: sdk/.git/short_ref
# message: This is my commit message of success and this the var @here
alert_type: success
on_failure:
put: notify
params:
alert_type: failed
on_abort:
put: notify
params:
alert_type: aborted
## Store current build on S3
- put: release-backup
params:
path: build-output
file: build-output/((credentials.backup))-sdk-*.zip
# acl: public-read
## Job rollback
- name: rollback
serial: true
plan:
## Get the zip from s3
- get: release-backup
## Trigger slack alarm
- put: notify
params:
alert_type: started
## Build the App
- task: unpack-build
config:
platform: linux
image_resource:
type: docker-image
source:
repository: parboleda/node-knowbly
inputs:
- name: release-backup
run:
path: sh
args:
- -exc
- |
apt-get update
apt-get install zip
cd release-backup
unzip ((credentials.backup))-sdk-*.zip
rm ((credentials.backup))-sdk-*.zip
cp -R ./ ../build-output
ls ../build-output
outputs:
- name: build-output
- put: deploy-to-PCF
params:
manifest: build-output/prod-manifest.yml
path: build-output
on_success:
put: notify
params:
alert_type: success
on_failure:
put: notify
params:
alert_type: failed
on_abort:
put: notify
params:
alert_type: aborted
## Define Resource Types
resource_types:
## Slack Alerts
- name: slack-alert
type: docker-image
source:
repository: arbourd/concourse-slack-alert-resource
## Define Resources
resources:
## Slack notification
- name: notify
type: slack-alert
source:
url: ((credentials.slack.webhook-url))
# CF auth credentials
- name: deploy-to-PCF
type: cf
source:
api: ((credentials.cf.api))
organization: ((credentials.cf.organization))
password: ((credentials.cf.user.pass))
space: ((credentials.cf.space.prod))
username: ((credentials.cf.user.name))
skip_cert_check: false
## Define git resources
## Knowbly SDK
- name: sdk
type: git
source:
branch: ((credentials.git.branch.sdk))
uri: ((credentials.git.uri.sdk))
username: ((credentials.git.user.name))
password: ((credentials.git.user.pass))
## S3 Backup
- name: release-backup
type: s3
source:
bucket: ((credentials.aws.bucket))
access_key_id: ((credentials.aws.access-key-id))
secret_access_key: ((credentials.aws.secret-access-key))
regexp: ((credentials.backup))-sdk-(.*).zip
region_name: us-west-2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment