Skip to content

Commit

Permalink
Bulldozer 1.0 Github App rewrite (#50)
Browse files Browse the repository at this point in the history
Bulldozer 1.0 Github App rewrite
  • Loading branch information
ajlake authored Oct 25, 2018
1 parent 75f60bc commit 87ae18e
Show file tree
Hide file tree
Showing 1,521 changed files with 38,495 additions and 622,195 deletions.
212 changes: 67 additions & 145 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,166 +1,88 @@
darwin-linux-no-cgo: &darwin-linux-no-cgo
working_directory: /go/src/github.com/palantir/bulldozer
docker:
- image: nmiyake/go:go-darwin-linux-no-cgo-1.9-t112
environment:
CGO_ENABLED: 0

define-artifact-dir: &define-artifacts-dir
run: echo "export ARTIFACT_STORE=/tmp/artifacts/${CIRCLE_PROJECT_REPONAME}-${TAG_NAME}-tests" >> $BASH_ENV

mkdir-artifacts-dir: &mkdir-artifacts-dir
run: mkdir -p "${ARTIFACT_STORE}"

store-test-results: &store-test-results
type: test-results-store
path: /tmp/artifacts

store-artifacts: &store-artifacts
type: artifacts-store
path: /tmp/artifacts

make-client: &make-client
run: ./scripts/make_client.sh

install-docker-client: &install-docker-client
run:
name: Install docker client
command: |
set -x
VER="17.05.0-ce"
curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz
tar -xz -C /tmp -f /tmp/docker-$VER.tgz
mv /tmp/docker/* /usr/bin
build-docker-image: &build-docker-image
run:
name: Build docker image
command: |
set -x
version=$(./godelw project-version)
cp /etc/ssl/certs/ca-certificates.crt .
docker build \
-t palantirtechnologies/bulldozer \
--build-arg VERSION=${version} \
-f Dockerfile \
.
rm -f ca-certificates.crt
install-git: &install-git
run:
name: Install git
command: apt-get install -y git

install-yarn: &install-yarn
run:
name: Install yarn
command: |
curl -sL https://deb.nodesource.com/setup_6.x | bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
apt-get -y update
apt-get -y install nodejs yarn
common:
godel-cache:
key: &godel-cache-key v1-godel-cache-{{ checksum "godelw" }}-{{ checksum "godel/config/godel.yml" }}
<<: &restore-godel-cache
restore_cache:
keys:
- *godel-cache-key
<<: &save-godel-cache
save_cache:
key: *godel-cache-key
paths:
- ~/.godel

test-results:
dir: &results-dir /tmp/test-results
<<: &store-results
store_test_results:
path: *results-dir
<<: &store-artifacts
store_artifacts:
path: *results-dir
destination: test-results

### Jobs ###

version: 2
jobs:
build:
<<: *darwin-linux-no-cgo
working_directory: /go/src/github.com/palantir/bulldozer
environment:
TESTS_DIR: *results-dir
docker:
- image: nmiyake/go:go-darwin-linux-1.11-t134
steps:
- *define-artifacts-dir
- *mkdir-artifacts-dir
- checkout
- *install-yarn

- restore_cache:
keys:
- v1-dependencies-{{ checksum "./client/package.json" }}
- v1-dependencies-

- run: go version
- *restore-godel-cache
- run: ./godelw version
- run: ./godelw verify --apply=false --junit-output="${ARTIFACT_STORE}/tests.xml"

- setup_remote_docker
- *install-docker-client

- run: ./godelw dist
- *make-client
- *build-docker-image

- save_cache:
paths:
- ./client/node_modules
key: v1-dependencies-{{ checksum "./client/package.json" }}
- *save-godel-cache
- run: mkdir -p "${TESTS_DIR}"
- run: ./godelw build
- run: ./godelw verify --apply=false --junit-output="$TESTS_DIR/$CIRCLE_PROJECT_REPONAME-tests.xml"
- *store-results
- *store-artifacts
- persist_to_workspace:
root: /go/src/github.com/palantir/bulldozer
root: .
paths:
- client/build
- *store-test-results

changelog:
<<: *darwin-linux-no-cgo
steps:
- checkout
- *install-git
- *define-artifacts-dir
- *mkdir-artifacts-dir
- run: git log `git describe --tags --abbrev=0`..HEAD --pretty="### %s%n%b%n" > /tmp/artifacts/changelog.md
- *store-artifacts
- build/bulldozer

publish-snapshot:
<<: *darwin-linux-no-cgo
dist:
working_directory: /go/src/github.com/palantir/bulldozer
docker:
- image: nmiyake/go:go-darwin-linux-1.11-docker-17.06.0-ce-bsdtar-unzip-t134
steps:
- checkout
- setup_remote_docker
- *install-docker-client
- attach_workspace:
at: /go/src/github.com/palantir/bulldozer
- run: ./godelw dist
- *build-docker-image
- run: ./scripts/publish_docker.sh

publish-release:
<<: *darwin-linux-no-cgo
steps:
- checkout
- setup_remote_docker
- *install-docker-client
- run: ./godelw publish bintray --url https://api.bintray.com --subject palantir --repository releases --user "$BINTRAY_USERNAME" --password "$BINTRAY_PASSWORD" --publish --downloads-list bulldozer
- run: sha256sum dist/*.tgz
- attach_workspace:
at: /go/src/github.com/palantir/bulldozer
- *build-docker-image
- run: ./scripts/publish_docker.sh
at: .
- *restore-godel-cache
- run: ./godelw docker build --verbose
- deploy:
name: Publish
command: |
if [[ "${CIRCLE_BRANCH}" == "develop" ]]; then
docker login -u "${DOCKERHUB_USERNAME}" -p "${DOCKERHUB_PASSWORD}"
./godelw docker push --tags=snapshot
fi
if [[ -n "${CIRCLE_TAG}" ]] ; then
docker login -u "${DOCKERHUB_USERNAME}" -p "${DOCKERHUB_PASSWORD}"
./godelw docker push --tags=latest,version
./godelw publish bintray \
--url https://api.bintray.com \
--subject palantir --repository releases --product bulldozer \
--username "${BINTRAY_USERNAME}" --password "${BINTRAY_PASSWORD}" \
--downloads-list --publish bulldozer
fi
### Workflows ###

workflows:
version: 2
build-publish:
build:
jobs:
- build:
filters:
tags:
only: /.*/
- changelog:
requires:
- build
filters:
tags:
ignore: /.*/
branches:
only: /^master$/
- publish-snapshot:
requires:
- build
filters:
tags:
ignore: /.*/
branches:
only: /^master$/
- publish-release:
filters: { tags: { only: /.*/ } }
- dist:
filters: { tags: { only: /.*/ } }
requires:
- build
filters:
tags:
only: /^[0-9]+(\.[0-9]+)+(-rc[0-9]+)?(-alpha[0-9]+)?$/
branches:
ignore: /.*/
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

12 changes: 1 addition & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,2 @@
*.iml
*.ipr
*.iws
.idea/
/build/
coverage.out
dist/
gotest.out
.DS_Store
config/bulldozer.yml
client/build
client/node_modules
build/
11 changes: 0 additions & 11 deletions Dockerfile

This file was deleted.

Loading

0 comments on commit 87ae18e

Please sign in to comment.