diff --git a/.squash.yml b/.squash.yml index d4675cf..13af25b 100644 --- a/.squash.yml +++ b/.squash.yml @@ -2,100 +2,28 @@ deployments: default: vm_size: 1G vm_storage_gb: 10G - environment: - TEST_VAL=42 ready_wait: 120 - backend_wait: 20 copy_files: /abcd ~/code - check_root_url: true - auto_deploy_on_commits: true - squash_pr_comments: true - subdomain_port_mapping: - - test:81 - - test--test:81 - - another-test:8000 - - and--another-test:8000 - deployment_page_commands: - list something: - - ls -la ./ - - sleep 40 && echo branch id is $SQUASH_BRANCH_WITH_ID - echo awesome: - - echo awesome - echo target: - stuff-service: - - echo awesome - /PI: + squash_pr_comments: true + pipelines: + - default: + scripts: + - echo true + - sleep 30 && ls -la + branch: vm_size: 1 - vm_storage_gb: 130 - deployment_type: kubernetes - environment: - TEST_VAL=42 - ready_wait: - 120 - filename: - ./stuff/Dockerfile - dockerfileonly: true - run_options: --env TEST_VAL2=${SQUASH_BRANCH_WITH_ID} --restart always - context_path: ./stuff - subdomains: - Awesome Name: - - awesomedomain,/?que=99764QQ - Awesomness x2: - - subd,/abc - Awesomness x3: - - plain - deployment_page_commands: - list something: - - ls -la ./ - - sleep 40 && echo branch id is $SQUASH_BRANCH_WITH_ID - branchA: - vm_size: 6 - environment: - TEST_VAL=4242 - ready_wait: - 120 - filename: - ./stuff/DockerfileA - dockerfileonly: true - run_options: --env TEST_VAL2=43 - context_path: ./stuff - post_launch: - - target: 'stuff-service' - command: exec - docker: true - options: -it {target} bash -c 'echo TEST_VAL2 is $TEST_VAL2' - - target: 'stuff-service' - command: exec - docker: true - options: -it {target} bash -c 'echo TEST_VAL is $TEST_VAL' - branchB: - vm_size: 8GB - environment: - TEST_VAL=424242 - ready_wait: - 120 - filename: - ./stuff/DockerfileB + vm_storage_gb: 13 + ready_wait: 120 + filename: ./stuff/Dockerfile dockerfileonly: true - run_options: --env TEST_VAL2=${SQUASH_DOMAIN} - context_path: ./stuff - post_launch: - - target: 'stuff-service' - command: exec - docker: true - options: -it {target} bash -c 'echo TEST_VAL2 is $TEST_VAL2' - - target: 'stuff-service' - command: exec - docker: true - options: -it {target} bash -c 'echo TEST_VAL is $TEST_VAL' - dockerQ: - ready_wait: 10 - filename: - ./stuff/DockerfileQ context_path: ./stuff - branchCompose: - filename: - ./docker-compose.yml + pipelines: + - default: + scripts: + - echo true + - secondary: + scripts: + - sleep 30 && ls -la nodocker: dockerimage: r.cfcr.io/wisedrette/wisedrette/dockertest:master @@ -103,3 +31,11 @@ deployments: server: r.cfcr.io username: wisedrette password: $REGISTRY_PASSWORD + pipelines: + - default: + scripts: + - echo true + - secondary: + scripts: + - sleep 30 && ls -la + diff --git a/docker-compose.yml b/docker-compose.yml index 8461517..3267c71 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,6 @@ services: ports: - 80:80 environment: - - TEST_VAL - SQUASH_BRANCH_WITH_ID - SQUASH_DOMAIN - SQUASH_MASTER_DEPLOYMENT diff --git a/stuff/Dockerfile b/stuff/Dockerfile index 4cff88c..e8cd13f 100644 --- a/stuff/Dockerfile +++ b/stuff/Dockerfile @@ -1,4 +1,6 @@ -FROM python:3.6.1-onbuild +FROM joyzoursky/python-chromedriver:3.6-selenium COPY . /usr/src/app +WORKDIR /usr/src/app +RUN pip install -r requirements.txt CMD ["bash", "run_server.sh"] diff --git a/stuff/DockerfileA b/stuff/DockerfileA deleted file mode 100644 index 73aaeb0..0000000 --- a/stuff/DockerfileA +++ /dev/null @@ -1,4 +0,0 @@ -FROM python:3.6.1-onbuild - -COPY . /usr/src/app -CMD ["python", "serverA.py"] diff --git a/stuff/DockerfileB b/stuff/DockerfileB deleted file mode 100644 index edbd01e..0000000 --- a/stuff/DockerfileB +++ /dev/null @@ -1,4 +0,0 @@ -FROM python:3.6.1-onbuild - -COPY . /usr/src/app -CMD ["python", "serverB.py"] diff --git a/stuff/DockerfileQ b/stuff/DockerfileQ deleted file mode 100644 index a774146..0000000 --- a/stuff/DockerfileQ +++ /dev/null @@ -1,29 +0,0 @@ -FROM phusion/baseimage:0.10.1 - -RUN DEBIAN_FRONTEND=noninteractive apt-get update -y && apt-get install -y \ -wget gettext git libfreetype6-dev libjpeg8-dev liblcms2-dev libpq-dev libsqlite3-dev \ -libtiff5-dev libwebp-dev libxml2-dev libxslt1-dev redis-server memcached \ -nginx npm zip unzip libmagic-dev \ -python python-dev python-pip python-psycopg2 python-tk vim \ -tcl8.6-dev tk8.6-dev wget zlib1g-dev xmlsec1 libxmlsec1-openssl \ -build-essential libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libxmlsec1-dev \ -libpq-dev libgdk-pixbuf2.0-0 libffi-dev shared-mime-info && \ -apt-get clean && \ -rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ -pip install virtualenv && \ -ln -s /usr/bin/nodejs /usr/bin/node && \ -adduser --disabled-login --disabled-password --gecos "" devel && \ -echo "devel ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \ -usermod -p '*' devel && chmod 777 /var/run && chmod 777 /var/log - -RUN DEBIAN_FRONTEND=noninteractive add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -sc)-pgdg main" && wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - -RUN DEBIAN_FRONTEND=noninteractive apt-get update -y && apt-get install -y postgresql-9.6 postgresql-contrib-9.6 postgresql-9.6-postgis-2.4 \ -postgresql-9.6-repac - -RUN npm config set strict-ssl false - -RUN npm install -g npm@4.0.2 - - -COPY . /usr/src/app -CMD ["/sbin/my_init"] diff --git a/stuff/requirements.txt b/stuff/requirements.txt index 7e10602..f245317 100644 --- a/stuff/requirements.txt +++ b/stuff/requirements.txt @@ -1 +1,2 @@ flask +selenium==3.13.0 \ No newline at end of file diff --git a/stuff/selenium_test.py b/stuff/selenium_test.py new file mode 100644 index 0000000..6bbcec8 --- /dev/null +++ b/stuff/selenium_test.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3.6 +import os +import sys +from selenium import webdriver +from selenium.webdriver.common.keys import Keys +from selenium.common.exceptions import NoSuchElementException + +chrome_options = webdriver.ChromeOptions() +chrome_options.add_argument('--no-sandbox') +chrome_options.add_argument('--window-size=1420,1080') +chrome_options.add_argument('--headless') +chrome_options.add_argument('--disable-gpu') +driver = webdriver.Chrome(chrome_options=chrome_options) +driver.get('https://{}'.format(os.environ.get('SQUASH_DOMAIN', ''))) +try: + driver.find_element_by_tag_name('body') + driver.close() + sys.exit(0) +except NoSuchElementException: + sys.exit(1) diff --git a/stuff/server.py b/stuff/server.py index 8db5d93..63dc331 100644 --- a/stuff/server.py +++ b/stuff/server.py @@ -20,7 +20,7 @@ def run_job(): @app.route('/') def index(): logging.warning(request.referrer) - return '
Hello world. About this page.' + return 'Hello new world. About this page.' @app.route('/about/') diff --git a/stuff/serverA.py b/stuff/serverA.py deleted file mode 100644 index e5f97ed..0000000 --- a/stuff/serverA.py +++ /dev/null @@ -1,31 +0,0 @@ -from flask import Flask -import threading -import time -import logging - -app = Flask(__name__) - - -@app.before_first_request -def activate_job(): - def run_job(): - while True: - logging.warning("Run recurring task") - time.sleep(0.25) - - thread = threading.Thread(target=run_job) - thread.start() - - -@app.route('/') -def index(): - return 'Hello world. SERVER A here. About this page.' - - -@app.route('/about') -def about(): - return 'This is the about page' - - -if __name__ == "__main__": - app.run(host='0.0.0.0', port=80, debug=True) diff --git a/stuff/serverB.py b/stuff/serverB.py deleted file mode 100644 index f785e4d..0000000 --- a/stuff/serverB.py +++ /dev/null @@ -1,31 +0,0 @@ -from flask import Flask -import threading -import time -import logging - -app = Flask(__name__) - - -@app.before_first_request -def activate_job(): - def run_job(): - while True: - logging.warning("Run recurring task") - time.sleep(0.25) - - thread = threading.Thread(target=run_job) - thread.start() - - -@app.route('/') -def index(): - return 'Hello world from DOCKER B. About this page.' - - -@app.route('/about') -def about(): - return 'This is the about page' - - -if __name__ == "__main__": - app.run(host='0.0.0.0', port=80, debug=True) diff --git a/test1 b/test1 deleted file mode 100644 index 8b13789..0000000 --- a/test1 +++ /dev/null @@ -1 +0,0 @@ -