trivial change to trigger ci

Signed-off-by: Vanessa Sochat <vsochat@stanford.edu>
This commit is contained in:
Vanessa Sochat 2019-08-29 11:21:49 -04:00
parent 31dd643642
commit 40ca353c48
No known key found for this signature in database
GPG Key ID: 55B56B9BF3B77E5C
2 changed files with 67 additions and 63 deletions

View File

@ -5,11 +5,30 @@
# #
version: 2.1 version: 2.1
# Commands
commands:
check_token:
description: Check that QUAY_TOKEN is provided in environment
steps:
- run:
if [[ -z "${QUAY_TOKEN}" ]]; then
echo "QUAY_TOKEN is undefined. Add to CircleCI environment to continue."
exit 1;
fi
pull_cache:
description: Pulls Quay.io docker images usable for our cache
steps:
- run: docker pull quay.io/nushell/nu:latest
- run: docker pull quay.io/nushell/nu-base:latest
orbs: orbs:
# https://circleci.com/orbs/registry/orb/circleci/docker # https://circleci.com/orbs/registry/orb/circleci/docker
docker: circleci/docker@0.5.13 docker: circleci/docker@0.5.13
workflows: workflows:
version: 2.0 version: 2.0
@ -21,23 +40,23 @@ workflows:
image: nushell/nu-base image: nushell/nu-base
tag: latest tag: latest
dockerfile: docker/Dockerfile.nu-base dockerfile: docker/Dockerfile.nu-base
extra_build_args: --cache-from=quay.io/nushell/nu-base:latest,quay.io/nushell/nu:latest
filters: filters:
branches: branches:
ignore: ignore:
- master - master
before_build:
- docker/publish: - check_token
deploy: false - pull_cache
image: nushell/nu
tag: latest
dockerfile: docker/Dockerfile
requires:
- docker/publish
after_build: after_build:
- run: - run:
name: Preview Docker Tag for Build name: Build Multistage (smaller) container
command: | command: |
DOCKER_TAG=v$(docker run nushell/nushell --version | cut -d' ' -f2) docker build -f docker/Dockerfile -t nushell/nu .
- run:
name: Preview Docker Tag for Nushell Build
command: |
DOCKER_TAG=$(docker run nushell/nu --version | cut -d' ' -f2)
echo "Version that would be used for Docker tag is v${DOCKER_TAG}" echo "Version that would be used for Docker tag is v${DOCKER_TAG}"
# workflow publishes to Docker Hub, with each job having different triggers # workflow publishes to Docker Hub, with each job having different triggers
@ -47,34 +66,33 @@ workflows:
# Deploy versioned and latest images on tags (releases) only. # Deploy versioned and latest images on tags (releases) only.
- docker/publish: - docker/publish:
image: nushell/nu-base image: nushell/nu-base
registry: quay.io
tag: latest tag: latest
dockerfile: docker/Dockerfile.nu-base dockerfile: docker/Dockerfile.nu-base
extra_build_args: --cache-from=quay.io/nushell/nu-base:latest,quay.io/nushell/nu:latest
filters: filters:
branches: branches:
ignore: /.*/ ignore: /.*/
tags: tags:
only: /^v.*/ only: /^v.*/
before_build:
- check_token
- pull_cache
after_build: after_build:
- run:
name: Build Multistage (smaller) container
command: |
docker build -f docker/Dockerfile -t nushell/nu .
- run: - run:
name: Publish Docker Tag with Nushell Version name: Publish Docker Tag with Nushell Version
command: | command: |
DOCKER_TAG=v$(docker run nushell/nu-base --version | cut -d' ' -f2) DOCKER_TAG=$(docker run nushell/nu --version | cut -d' ' -f2)
echo "Version for Docker tag is ${DOCKER_TAG}" echo "Version for Docker tag is ${DOCKER_TAG}"
docker tag nushell/nu-base:latest nushell/nu-base:${DOCKER_TAG} docker tag nushell/nu-base:latest nushell/nu-base:${DOCKER_TAG}
docker tag nushell/nu:latest nushell/nu:${DOCKER_TAG}
- docker/publish: docker login -u="nushell+circleci" -p="${QUAY_TOKEN}" quay.io
image: nushell/nu docker push nushell/nu-base
tag: latest docker push nushell/nu
dockerfile: docker/Dockerfile
requires:
- docker/publish
after_build:
- run:
name: Publish Docker Tag with Nushell Version
command: |
DOCKER_TAG=v$(docker run nushell/nu --version | cut -d' ' -f2)
echo "Version for Docker tag is ${DOCKER_TAG}"
docker tag nushell/nu-base:latest nushell/nu:${DOCKER_TAG}
# publish devel to Docker Hub on merge to master # publish devel to Docker Hub on merge to master
@ -84,39 +102,24 @@ workflows:
# Deploy devel tag on merge to master # Deploy devel tag on merge to master
- docker/publish: - docker/publish:
image: nushell/nu-base image: nushell/nu-base
registry: quay.io
tag: devel tag: devel
dockerfile: docker/Dockerfile.nu-base dockerfile: docker/Dockerfile.nu-base
extra_build_args: --cache-from=quay.io/nushell/nu-base:latest,quay.io/nushell/nu:latest
before_build:
- check_token
- pull_cache
filters: filters:
branches: branches:
only: master only: master
after_build:
- docker/publish: - run:
image: nushell/nu name: Build Multistage (smaller) container
tag: devel command: |
dockerfile: docker/Dockerfile docker build -f docker/Dockerfile -t nushell/nu:devel .
requires: - run:
- docker/publish name: Publish Development Docker Tags
command: |
docker login -u="nushell+circleci" -p="${QUAY_TOKEN}" quay.io
# Nightly build docker push nushell/nu-base:devel
build_with_deploy_nightly: docker push nushell/nu:devel
triggers:
- schedule:
cron: "0 22 * * *" # 22:00 UTC
filters:
branches:
only:
- master
jobs:
- docker/publish:
image: nushell/nu-base
tag: nightly
dockerfile: docker/Dockerfile.nu-base
- docker/publish:
image: nushell/nu
tag: nightly
requires:
- docker/publish
dockerfile: docker/Dockerfile

View File

@ -1,17 +1,18 @@
FROM rust:1.37-slim FROM rust:1.37-slim
# docker build -t nushell/nu-base . # docker build -f docker/Dockerfile.nu-base -t nushell/nu-base .
# docker run -it nushell/nu-base # docker run -it nushell/nu-base
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y libssl-dev \ RUN apt-get update && apt-get install -y libssl-dev \
libxcb-composite0-dev \ libxcb-composite0-dev \
libx11-dev \ libx11-dev \
pkg-config && \ pkg-config
mkdir -p /code
RUN USER=root cargo new --bin /code
ADD . /code
WORKDIR /code WORKDIR /code
RUN cargo build --release && cargo run --release && \ ADD . /code
cp target/release/nu /usr/local/bin RUN cargo build --release && cargo run --release
RUN cp target/release/nu /usr/local/bin
ENTRYPOINT ["nu"] ENTRYPOINT ["nu"]