Skip to content

Commit

Permalink
Add CICD goodies.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbudnack committed Oct 24, 2019
1 parent 470c0df commit a57bacf
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
pipeline {
agent any
environment {
ARTIFACTORY_CREDS = credentials('ARTIFACTORY_CREDS')
ARTIFACTORY_USER = "${ARTIFACTORY_CREDS_USR}"
ARTIFACTORY_PASSWORD = "${ARTIFACTORY_CREDS_PSW}"
}
stages {
stage('Publish') {
when {
expression { env.BRANCH_NAME.endsWith('-acv') }
}
steps {
sh 'make deploy'
}
}
}
post {
always {
sh 'make --ignore-errors stop-ci'
}
}
}
33 changes: 33 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
CONTAINER_NAME := acv-sfdc-ci
VERSION := $(shell git fetch --tags && git describe --tags)

.PHONY: clean
clean:
find . -type f -name '.DS_Store' -delete -o -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete

.PHONY: deps
deps:
pipenv install
pipenv install --dev

build: clean
git submodule update --init --recursive
@docker build \
--build-arg ARTIFACTORY_USER=${ARTIFACTORY_USER} \
--build-arg ARTIFACTORY_PASSWORD=${ARTIFACTORY_PASSWORD} \
--build-arg VERSION=${VERSION} \
--tag $(CONTAINER_NAME):$(VERSION) .

.PHONY: deploy
deploy: build
docker run \
-e APP_MODE=deploy \
-e ARTIFACTORY_USER=${ARTIFACTORY_USER} \
-e ARTIFACTORY_PASSWORD=${ARTIFACTORY_PASSWORD} \
-v /var/run/docker.sock:/var/run/docker.sock \
$(CONTAINER_NAME):$(VERSION)

.PHONY: stop-ci
stop-ci:
docker ps -a -q --filter ancestor=$(CONTAINER_NAME):$(VERSION) | xargs docker rm -f
docker ps -a -q --filter ancestor=mysql:5.7git s | xargs docker rm -f

0 comments on commit a57bacf

Please sign in to comment.