Skip to content

Commit 7e35e65

Browse files
authored
Actions for Deploy (#141)
1 parent b33091d commit 7e35e65

5 files changed

Lines changed: 59 additions & 7 deletions

File tree

.github/workflows/main.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Continuous Deployment
2+
on: [push]
3+
jobs:
4+
Minikube:
5+
runs-on: ubuntu-latest
6+
services:
7+
docker:
8+
image: docker
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2.3.1
12+
- name: Setup Python
13+
uses: actions/setup-python@v2
14+
with:
15+
python-version: 3.7
16+
- name: Install pip
17+
run: |
18+
python -m pip install --upgrade pip
19+
- name: minikube
20+
env:
21+
K8_PROVIDER: minikube
22+
K8_VERSION: v1.16.0
23+
CHANGE_MINIKUBE_NONE_USER: true
24+
CCO_INTERACTIVE_CI: interactive.yaml
25+
run: |
26+
pip install -e .
27+
bash .travis.sh install-tools
28+
minikube config set cpus 4 && minikube config set memory 8192 && minikube config set vm-driver none && minikube config set kubernetes-version "${K8_VERSION}"
29+
sudo minikube start --memory=4976mb
30+
sudo chown -R $USER $HOME/.kube $HOME/.minikube
31+
echo Checking helm
32+
ckan-cloud-operator cluster initialize --cluster-provider=minikube
33+
sleep 60 && kubectl get ns && kubectl get pods -n ckan-cloud
34+
ckan-cloud-operator ckan instance create helm --instance-id a-ckan-instance --instance-name a-ckan-instance --update sample-values/values.datagov.yaml
35+
minikube delete
36+
- name: Deploy
37+
env:
38+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
39+
DOCKER_USER: ${{ secrets.DOCKER_USER }}
40+
TRAVIS_REPO_SLUG: ${{ secrets.TRAVIS_REPO_SLUG }}
41+
HELM_VERSION: v2.16.11
42+
43+
run: |
44+
mkdir $HOME/bin
45+
curl -L https://raw.githubusercontent.com/datopian/travis-ci-operator/master/travis_ci_operator.sh > $HOME/bin/travis_ci_operator.sh
46+
bash $HOME/bin/travis_ci_operator.sh init
47+
$HOME/bin/travis_ci_operator.sh docker-login
48+
bash .travis.sh install
49+
bash .travis.sh script
50+
$HOME/bin/travis_ci_operator.sh docker-login
51+
bash .travis.sh deploy

.travis.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env bash
22

3-
TAG="${TRAVIS_TAG:-${TRAVIS_COMMIT}}"
3+
TAG="${GITHUB_SHA:-${GITHUB_REF }}"
44
AWS_IAM_AUTHENTICATOR_VERSION="1.14.6/2019-08-22"
55
TERRAFORM_VERSION=0.12.18
66
PACKER_VERSION=1.5.1
7-
HELM_VERSION=v2.16.1
7+
HELM_VERSION="${HELM_VERSION:-v2.16.1}"
88

99
if [ "${1}" == "install" ]; then
1010
! docker pull viderum/ckan-cloud-operator:latest && echo Failed to pull image && exit 1
@@ -73,6 +73,7 @@ elif [ "${1}" == "install-tools" ]; then
7373
chmod 700 get_helm.sh &&\
7474
./get_helm.sh --version "${HELM_VERSION}" &&\
7575
helm version --client && rm ./get_helm.sh
76+
helm init --client-only --stable-repo-url https://charts.helm.sh/stable
7677
echo Helm Installed Successfully!
7778

7879
sudo apt-get update && sudo apt-get install -y socat jq
@@ -114,7 +115,7 @@ elif [ "${1}" == "deploy" ]; then
114115
echo && echo "viderum/ckan-cloud-operator:jnlp-${TAG}" && echo &&\
115116
docker push "viderum/ckan-cloud-operator:jnlp-${TAG}"
116117
[ "$?" != "0" ] && echo Failed to tag and push jnlp image && exit 1
117-
if [ "${TRAVIS_BRANCH}" == "master" ]; then
118+
if [ "${GITHUB_REF}" == "master" ]; then
118119
docker tag ckan-cloud-operator viderum/ckan-cloud-operator:latest &&\
119120
echo && echo viderum/ckan-cloud-operator:latest && echo &&\
120121
docker push viderum/ckan-cloud-operator:latest

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ FROM python:3.7.6-slim
22

33
WORKDIR /cco
44

5-
RUN apt-get update
6-
RUN apt-get install -y nano curl unzip sudo bash libpq-dev build-essential
5+
RUN apt-get update
6+
RUN apt-get install -y nano curl unzip sudo bash libpq-dev build-essential
77
ENV EDITOR nano
88

99
COPY . .

Dockerfile.minimal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ COPY ckan_cloud_operator /usr/src/ckan-cloud-operator/ckan_cloud_operator
88
COPY *.sh *.py /usr/src/ckan-cloud-operator/
99
RUN python3 -m pip install psycopg2 pyyaml kubernetes click toml requests
1010
RUN python3 -m pip install -e /usr/src/ckan-cloud-operator
11-
ENTRYPOINT ["ckan-cloud-operator"]
11+
ENTRYPOINT ["ckan-cloud-operator"]

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.0
1+
0.5.0

0 commit comments

Comments
 (0)