Skip to content

Instantly share code, notes, and snippets.

@hpoul
Created February 19, 2017 19:53
Show Gist options
  • Select an option

  • Save hpoul/c7a2fa20e367bb88cb8cb974f898d89c to your computer and use it in GitHub Desktop.

Select an option

Save hpoul/c7a2fa20e367bb88cb8cb974f898d89c to your computer and use it in GitHub Desktop.
image: google/dart:1.22.0
stages:
- build
- deploy
# before_script:
# - apt-get update -qy
# - apt-get install unzip
# - wget https://storage.googleapis.com/dart-archive/channels/stable/release/30107/sdk/dartsdk-linux-x64-release.zip
# - mkdir deps
# - unzip dartsdk-linux-x64-release.zip -d deps/
build:
stage: build
script:
- export BUILD_NUMBER=gl$CI_BUILD_ID
- echo Setting BUILD_NUMBER to $BUILD_NUMBER
- echo "dart sdk at ${DART_SDK}"
- ./build.sh
artifacts:
paths:
- build
.deploy_template: &deploy_template
before_script:
# install private ssh key
- apt-get update -qy
- 'which ssh-agent || ( apt-get install openssh-client -y )'
# Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
# Add the SSH key stored in GITLAB_PRIVATE_KEY variable to the agent store
- ssh-add <(echo "$GITLAB_PRIVATE_KEY")
# For Docker builds disable host key checking. Be aware that by adding that
# you are suspectible to man-in-the-middle attacks.
# WARNING: Use this only with the Docker executor, if you use it with shell
# you will overwrite your user's SSH config.
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
- echo "Deploying to ${WORKTRAIL_ENV}"
- ssh -p 22009 herbert@projects.tapo.at "echo `pwd` ; mkdir -p ${REMOTE_DIR} ; echo created ${REMOTE_DIR} xx $REMOTE_DIR"
- scp -P 22009 build/worktrail-dart-polymer*.tar.gz herbert@projects.tapo.at:${REMOTE_DIR}
- ssh -p 22009 herbert@projects.tapo.at find "${REMOTE_DIR}"
- ssh -p 22009 herbert@projects.tapo.at sudo /home/scripts/worktrail-dart-polymer-ui-${WORKTRAIL_ENV}-jenkins-deploy.sh "${REMOTE_DIR}"
- echo "Blubbing."
deploy_qa:
<<: *deploy_template
stage: deploy
variables:
REMOTE_DIR: "gitlab/build-${CI_BUILD_ID}"
WORKTRAIL_ENV: qa
environment:
name: qa
only:
- master
deploy_prod:
<<: *deploy_template
stage: deploy
variables:
REMOTE_DIR: "gitlab/build-${CI_BUILD_ID}"
WORKTRAIL_ENV: prod
environment:
name: prod
when: manual
only:
- master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment