Skip to content

Commit

Permalink
Add getenv filter
Browse files Browse the repository at this point in the history
  • Loading branch information
ant31 committed Aug 7, 2017
1 parent 9fb5f73 commit 4a8f144
Show file tree
Hide file tree
Showing 33 changed files with 572 additions and 188 deletions.
41 changes: 22 additions & 19 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
image:
- Visual Studio 2015
environment:

global:
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd"
matrix:

# For Python versions available on Appveyor, see
Expand All @@ -13,46 +16,46 @@ environment:
# - PYTHON: "C:\\Python35"
- PYTHON: "C:\\Python27-x64"
BIN_NAME: appr-%APPVEYOR_REPO_TAG_NAME%-win-x64
PYTHON_ARCH: "64"
PYTHON_VERSION: "2.7.x"
# - PYTHON: "C:\\Python33-x64"
# - PYTHON: "C:\\Python34-x64"
# - PYTHON: "C:\\Python35-x64"

install:
- ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""

- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
- "pip install setuptools>=6.0"
- "python --version"

# Upgrade to the latest version of pip to avoid it displaying warnings
# about it being out of date.
- "pip install --disable-pip-version-check --user --upgrade pip"

# We need wheel installed to build wheels
- "pip install -r requirements_tests.txt"
- "pip install -U pyinstaller"
# # We need wheel installed to build wheels
- "pip install -r requirements_dev.txt"
# - "pip install jsonnet"
- "pip install -e ."

- "pip install -e git+https://github.com/pyinstaller/pyinstaller.git#egg=pyinstaller"
build: off

test_script:

test_script: []
# Run the project tests
- "py.test --cov=appr --cov-report=html --cov-report=term-missing --verbose tests"
#- "py.test --cov=appr --cov-report=html --cov-report=term-missing --verbose tests"

after_test:
# If tests are successful, create binary packages for the project.
- "pyinstaller --onefile bin/appr"
- "pyinstaller --add-data appr/jsonnet;appr/jsonnet --onefile bin/appr"
- ps: "ls dist"
- "copy dist\\appr.exe %BIN_NAME%.exe"
- "mkdir registry"
- "copy dist\\appr.exe registry\\appr.exe"
- "copy appr\\commands\\plugins\\helm\\appr.sh registry\\appr.sh"
- "copy appr\\commands\\plugins\\helm\\plugin.yaml registry\\plugin.yaml"
- "7z a registry-%BIN_NAME%-helm-plugin.zip registry\\*.*"
- ps: "ls dist"
- ps: "ls registry"
# - "mkdir registry"
# - "copy dist\\appr.exe registry\\appr.exe"
# - "7z a registry-%BIN_NAME%-helm-plugin.zip registry\\*.*"
# - ps: "ls dist"
# - ps: "ls registry"
- "C:\\projects\\appr\\dist\\appr.exe version quay.io"

artifacts:
# Archive the generated packages in the ci.appveyor.com build report.
- path: "%BIN_NAME%.exe"
- path: registry-%BIN_NAME%-helm-plugin.zip
type: zip

27 changes: 0 additions & 27 deletions .codecov.yml

This file was deleted.

84 changes: 36 additions & 48 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
stages:
- init
- unit-tests
- code-style
- integration-tests
- tests
- build
- release

variables:
FAILFASTCI_NAMESPACE: 'failfast-ci'
IMAGE: quay.io/appr/appr
CODECOV: 82510329-4647-4e4d-88ee-98ee1b2536c4

cache:
paths:
Expand All @@ -22,23 +20,21 @@ cache:
- make test db=$APPR_TEST_DB
tags:
- kubernetes
image: quay.io/appr/appr:test
image: quay.io/appr/appr:base

test-filesystem:
<<: *job
stage: unit-tests
stage: tests
script:
- pip install -U python-coveralls
- pip install -U codecov
- make test
- coveralls
- codecov --token=$CODECOV
variables:
APPR_TEST_DB: filesystem

test-etcd:
<<: *job
stage: integration-tests
stage: tests
services:
- quay.io/coreos/etcd:v3.0.6
variables:
Expand All @@ -47,7 +43,7 @@ test-etcd:

test-redis:
<<: *job
stage: integration-tests
stage: tests
services:
- redis:3
variables:
Expand All @@ -56,30 +52,41 @@ test-redis:

flake8:
<<: *job
stage: code-style
stage: tests
script:
- make flake8

pylint:
<<: *job
stage: code-style
stage: tests
script:
- pip install pylint
- make pylint


compile:
<<: *job
variables:
GIT_STRATEGY: none
DOCKER_HOST: tcp://localhost:2375
DOCKER_DRIVER: overlay2
image: docker:17.06-git
stage: release
services:
- docker:17.06-dind
script:
- pip install pyinstaller
- pyinstaller --onefile bin/appr --hidden-import gunicorn.glogging --hidden-import gunicorn.workers.gthread --hidden-import gunicorn.workers
artifacts:
paths:
- dist/appr
- mkdir /dist
- docker run --rm --entrypoint="/bin/sh" -v /dist:/dist quay.io/appr/appr:$CI_BUILD_REF_NAME -c 'cp /opt/bin/appr /dist/appr-alpine-x64'
- docker run --rm -v /dist:/dist quay.io/ant31/ghrelease:master --api-key $GITHUB_TOKEN --repo app-registry/appr --file /dist/appr-alpine-x64 --tag $CI_BUILD_REF_NAME
tags:
- kubernetes
only:
- tags


.docker: &docker
variables:
DOCKER_HOST: tcp://localhost:2375
DOCKER_DRIVER: overlay2
image: docker:17.06-git
before_script:
- docker login -u $DOCKER_USER -p $DOCKER_PASS quay.io
Expand All @@ -93,45 +100,26 @@ docker-build:
stage: build
script:
- docker build -t $IMAGE:$CI_BUILD_REF_NAME .
except:
- tags
- master
- docker push $IMAGE:$CI_BUILD_REF_NAME

docker-build:
docker-build-base:
<<: *docker
stage: init
script:
- make build-test
- docker build -f Dockerfile.base -t quay.io/appr/appr:base .
- docker push quay.io/appr/appr:base
when: manual

.docker-push: &docker-push
docker-release:
<<: *docker
stage: release
script:
- docker build -t $IMAGE:$CI_BUILD_REF_NAME .
- docker push $IMAGE:$CI_BUILD_REF_NAME
- docker build --build-arg with_kubectl=true -t quay.io/appr/appr:v$(VERSION)-kubectl .
- docker build --build-arg with_kubectl=false -t quay.io/appr/appr .

docker-release:
<<: *docker-push
- docker tag quay.io/appr/appr:v$(VERSION)-kubectl quay.io/appr/appr:kubectl
- docker push quay.io/appr/appr:v$(VERSION)-kubectl
- docker push quay.io/appr/appr:kubectl
- docker push quay.io/appr/appr
only:
- tags
- master

docker-push:
<<: *docker-push
except:
- tags
- master
when: manual

pypi-release:
<<: *job
image: python:2.7
stage: release
script:
- make release
tags:
- kubernetes
when: manual
only:
- tags
11 changes: 5 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,23 @@ matrix:
- BIN_NAME=appr-$TRAVIS_OS_NAME-x64

install:
- if [ "$MAKECMD" == "test" ] ; then pip install -U pyinstaller ; fi
- if [ "$MAKECMD" == "test" ] ; then pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip ; fi
- if [ "$MAKECMD" == "test" ] && [ "$TRAVIS_OS_NAME" == "linux" ] ; then pip install -U coveralls ; fi
- if [ "$MAKECMD" == "test" ] && [ "$TRAVIS_OS_NAME" == "linux" ] ; then pip install -U codecov ; fi
- pip install -r requirements_tests.txt
- pip install -r requirements_dev.txt
- pip install -r requirements_dev.txt -U
- pip install jsonnet
- pip install -e .

script:
- PYTHONPATH="." make $MAKECMD

after_success:
- echo $BIN_NAME
- if [ "$MAKECMD" == "test" ] ; then pyinstaller --onefile bin/appr --hidden-import gunicorn.glogging --hidden-import gunicorn.workers.gthread --hidden-import gunicorn.workers ; fi
- if [ "$MAKECMD" == "test" ] ; then pyinstaller --add-data "appr/jsonnet/:appr/jsonnet" --onefile bin/appr ; fi
- if [ "$MAKECMD" == "test" ] ; then mkdir -p appr-helm/registry; fi
- if [ "$MAKECMD" == "test" ] ; then mv dist/appr $BIN_NAME; fi
- if [ "$MAKECMD" == "test" ] ; then chmod +x $BIN_NAME; fi
- if [ "$MAKECMD" == "test" ] ; then cp $BIN_NAME appr-helm/registry/appr; fi
- if [ "$MAKECMD" == "test" ] && [ "$TRAVIS_OS_NAME" == "linux" ] ; then coveralls ; fi
- if [ "$MAKECMD" == "test" ] && [ "$TRAVIS_OS_NAME" == "linux" ] ; then codecov ; fi


deploy:
Expand All @@ -46,6 +44,7 @@ deploy:
overwrite: true
file:
- $BIN_NAME
- bin/apprc
skip_cleanup: true
on:
tags: true
Expand Down
19 changes: 19 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## 0.7.0 Released on 2017-07-24

- Introduce client-side deployments handling multiple formats:
- [ ] [Helm](https://github.com/kubernetes/helm)
- [x] [appr](https://github.com/coreos/kpm)
- [ ] Plain kubernetes configuration

- Add jsonnet support for future integration with [ksonnet](https://github.com/ksonnet/ksonnet-lib)

- New commands:

``` shell
# Resolve a jsonnet file, with a set of nativeExtension available
appr jsonnet FILE

# Client side deployment command
appr deploy quay.io/ant31/kube-lego --namespace kube-lego
```

## 0.6.2 Released on 2017-07-10

- Add options to allow unverified certs or custom CA.
Expand Down
30 changes: 23 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,41 @@
FROM six8/pyinstaller-alpine:latest
FROM quay.io/appr/appr:base

ENV workdir /opt/appr-server
RUN mkdir -p $workdir
RUN apk --no-cache --update add python py-pip openssl ca-certificates
RUN apk --no-cache --update add --virtual build-dependencies \
python-dev build-base wget openssl-dev libffi-dev
ADD . $workdir
python-dev build-base wget openssl-dev libffi-dev libstdc++
COPY . $workdir
WORKDIR $workdir

RUN pip install pip -U \
&& pip install gunicorn -U && pip install -e .
RUN pip install jsonnet
RUN pip install -e .

RUN /pyinstaller/pyinstaller.sh --onefile --noconfirm \
--add-data "appr/jsonnet/:appr/jsonnet" \
--onefile \
--hidden-import _jsonnet \
--log-level DEBUG \
--clean \
bin/appr


from alpine:latest
ARG with_kubectl=false
ENV HOME=/appr
RUN mkdir -p /opt/bin && mkdir -p /opt/bin/k8s && mkdir $HOME && mkdir -p $HOME/local
ENV PATH=${PATH}:/opt/bin:/opt/bin/k8s
RUN apk --no-cache add ca-certificates
COPY --from=0 /opt/appr-server/dist/appr /usr/bin/
ENV WITH_KUBECTL ${with_kubectl}
RUN if [ "$WITH_KUBECTL" = true ]; then \
apk add --update curl && rm -rf /var/cache/apk/* \
&& curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl \
&& chmod +x ./kubectl \
&& cp ./kubectl /opt/bin/k8s; \
fi

WORKDIR /appr/local

COPY --from=0 /opt/appr-server/dist/appr /opt/bin
RUN appr plugins install helm

ENTRYPOINT ["appr"]
14 changes: 14 additions & 0 deletions Dockerfile.base
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM six8/pyinstaller-alpine:apline-v3.4-pyinstaller-develop

ENV workdir /opt/appr-server
RUN mkdir -p $workdir
RUN apk --no-cache --update add python py-pip openssl ca-certificates git curl
RUN apk --no-cache --update add --virtual build-dependencies \
python-dev build-base wget openssl-dev libffi-dev libstdc++
COPY . $workdir
WORKDIR $workdir

RUN pip install pip -U \
&& pip install -r requirements_dev.txt \
&& pip install -e .

Loading

0 comments on commit 4a8f144

Please sign in to comment.