Skip to content

Commit

Permalink
Add .gitlab-ci.yml and bin/update_config.sh (mozilla#8141)
Browse files Browse the repository at this point in the history
Add .gitlab-ci.yml and bin/update_config.sh for mozilla#6794

Build and deploy to iowa-a/bedrock-dev on gitlab-ci-dev & master
Remove jenkins/branches/master.yml
  • Loading branch information
jgmize authored Nov 13, 2019
1 parent d988553 commit f41d484
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 12 deletions.
39 changes: 39 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
variables:
CLUSTER_NAME: iowa-a
CONFIG_REPO: git@github.com:mozmeao/www-config
CONFIG_BRANCH: master

stages:
- build
- update-config

build:
stage: build
only:
- gitlab-ci-dev
- master
tags:
- oregon-b-shell
script:
- make clean build-ci
- FROM_DOCKER_REPOSITORY=mozorg/bedrock_test docker/bin/push2dockerhub.sh
- FROM_DOCKER_REPOSITORY=mozorg/bedrock_assets docker/bin/push2dockerhub.sh
- FROM_DOCKER_REPOSITORY=mozorg/bedrock_code docker/bin/push2dockerhub.sh
- FROM_DOCKER_REPOSITORY=mozorg/bedrock_build docker/bin/push2dockerhub.sh
- FROM_DOCKER_REPOSITORY=mozorg/bedrock docker/bin/push2dockerhub.sh
- bin/upload-staticfiles.sh

.update-config:
stage: update-config
tags:
- oregon-b-shell
script:
- bin/update_config.sh

dev:
extends: .update-config
only:
- gitlab-ci-dev
- master
variables:
NAMESPACE: bedrock-dev
22 changes: 22 additions & 0 deletions bin/update_config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
set -ex
# required env vars: CLUSTER_NAME, CONFIG_BRANCH, CONFIG_REPO, NAMESPACE,
# DEPLOYMENT_YAML, DEPLOYMENT_LOG_BASE_URL, DEPLOYMENT_NAME, DEPLOYMENT_VERSION

. ${BASH_SOURCE%/*}/../docker/bin/set_git_env_vars.sh # sets DEPLOYMENT_DOCKER_IMAGE
pushd $(mktemp -d)
git clone --depth=1 -b ${CONFIG_BRANCH:=master} ${CONFIG_REPO} config_checkout
cd config_checkout

set -u
for CLUSTER in ${CLUSTERS:=iowa-a}; do
for DEPLOYMENT in {clock-,}deploy.yaml; do
DEPLOYMENT_FILE=${CLUSTER}/${NAMESPACE:=bedrock-dev}/${DEPLOYMENT}
if [[ -f ${DEPLOYMENT_FILE} ]]; then
sed -i -e "s|image: .*|image: ${DEPLOYMENT_DOCKER_IMAGE}|" ${DEPLOYMENT_FILE}
git add ${DEPLOYMENT_FILE}
fi
done
done
git commit -m "set image to ${DEPLOYMENT_DOCKER_IMAGE} in ${CLUSTERS}" || echo "nothing new to commit"
git push
12 changes: 0 additions & 12 deletions jenkins/branches/master.yml

This file was deleted.

0 comments on commit f41d484

Please sign in to comment.