-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding Custom Output Format * Updated 📖 * Build * Updated main function to catch errors
- Loading branch information
Showing
7 changed files
with
137 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
--- | ||
load: "" | ||
kind: pipeline | ||
name: test-amd64 | ||
|
||
platform: | ||
arch: amd64 | ||
|
||
environment: | ||
ZIPLINE_URL: http://zipline:3000/ | ||
|
||
services: | ||
- name: postgres | ||
image: postgres:15 | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DATABASE: postgres | ||
|
||
- name: zipline | ||
image: ghcr.io/diced/zipline:latest | ||
environment: | ||
DEBUG: true | ||
CORE_PORT: 3000 | ||
CORE_RETURN_HTTPS: false | ||
CORE_SECRET: H8Y9lSs48w3HwOgFfpaF0G | ||
CORE_DATABASE_URL: postgres://postgres:postgres@postgres/postgres | ||
depends_on: | ||
- postgres | ||
|
||
steps: | ||
- name: test-3.11 | ||
image: python:3.11 | ||
depends_on: | ||
- zipline | ||
commands: | ||
- python3 -m pip install -r requirements.txt | ||
- flake8 zipline.py | ||
- python3 setup.py install | ||
- export ZIPLINE_TOKEN=$(python3 get_test_token.py) | ||
- zipline zipline.py | ||
|
||
- name: test-3.10 | ||
image: python:3.10 | ||
depends_on: | ||
- zipline | ||
commands: | ||
- python3 -m pip install -r requirements.txt | ||
- flake8 zipline.py | ||
- python3 setup.py install | ||
- export ZIPLINE_TOKEN=$(python3 get_test_token.py) | ||
- zipline zipline.py | ||
|
||
- name: test-3.9 | ||
image: python:3.9 | ||
depends_on: | ||
- zipline | ||
commands: | ||
- python3 -m pip install -r requirements.txt | ||
- flake8 zipline.py | ||
- python3 setup.py install | ||
- export ZIPLINE_TOKEN=$(python3 get_test_token.py) | ||
- zipline zipline.py | ||
|
||
- name: test-3.8 | ||
image: python:3.8 | ||
depends_on: | ||
- zipline | ||
commands: | ||
- python3 -m pip install -r requirements.txt | ||
- flake8 zipline.py | ||
- python3 setup.py install | ||
- export ZIPLINE_TOKEN=$(python3 get_test_token.py) | ||
- zipline zipline.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
ZIPLINE_URL=https://i.cssnr.com/ | ||
ZIPLINE_TOKEN=LlMPn29pIhfFHiCeNFJPtr8h.7gdjTxk5bpnSdMZNSF | ||
ZIPLINE_EMBED=True | ||
ZIPLINE_EXPIRE= | ||
ZIPLINE_FORMAT="{filename} -> {url}\n{raw_url}" | ||
ZIPLINE_EXPIRE=1y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import os | ||
import sys | ||
import psycopg2 | ||
import requests | ||
|
||
query = 'SELECT "token" FROM public."User" WHERE id=1 ORDER BY id ASC;' | ||
pg_data = { | ||
'host': 'postgres', | ||
'database': 'postgres', | ||
'user': 'postgres', | ||
'password': 'postgres', | ||
} | ||
zip_data = { | ||
'username': 'administrator', | ||
'password': 'password', | ||
'code': None, | ||
} | ||
|
||
# set zipline url | ||
zip_uri = os.environ.get('ZIPLINE_URL', 'http://zipline:3000').rstrip('/') | ||
zip_url = f'{zip_uri}/api/auth/login' | ||
|
||
# log in to create account | ||
r = requests.post(zip_url, json=zip_data) | ||
r.raise_for_status() | ||
|
||
# get token from postgres | ||
with psycopg2.connect(**pg_data) as conn: | ||
with conn.cursor() as cur: | ||
cur.execute(query) | ||
result = cur.fetchone() | ||
|
||
# exit with error if no results | ||
if not result: | ||
print(f'No result from postgres query: {query}') | ||
sys.exit(1) | ||
|
||
# print environment variable for export | ||
print(f'{result[0]}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
build | ||
flake8 | ||
psycopg2 | ||
python-decouple | ||
python-dotenv | ||
requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters