提交 85a5dcbf 编写于 作者: B Billy Lynch 提交者: tekton-robot

Dockerize sync tool.

This achieves a few things:

1. Creates Dockerfile for sync tool, so that it can be invoked from
   Tekton tasks.
2. Makes sync config directory configurable by flag, so that the tool
   can be ran from any directory. This defaults to sync/config (same as
   before).

Symlinks are retainined in the root directory for requirements.txt and
runtime.txt to satisfy Netlify Build requirements:
https://docs.netlify.com/configure-builds/manage-dependencies/#python

Issue: #34
上级 0039c98f
sync/requirements.txt
\ No newline at end of file
3.7
\ No newline at end of file
sync/runtime.txt
\ No newline at end of file
FROM python:3.7
WORKDIR /app
# Only copy specific values instead of the entire directory.
# We're primarily trying to avoid pulling in config/, since it's confusing that
# it will not be used.
COPY sync.py sync.py
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
ENTRYPOINT [ "python3", "sync.py" ]
# sync
This directory includes a helper script for synchronizing contents
from specified Tekton repositories to this repository.
......@@ -5,7 +7,19 @@ To run this script locally, set up a Python 3 environment with appropriate
Google Cloud Platform credentials, and execute the following command:
```bash
cd ..
pip install -r requirements.txt
python sync/sync.py
pip3 install -r requirements.txt
python3 sync.py
```
## Usage
```bash
USAGE: sync.py [flags]
flags:
sync.py:
-c,--config: Config directory
(default: 'config')
Try --helpfull to get a list of all flags.
```
wget==3.2
PyYAML==5.1.2
google-cloud-storage==1.23.0
Jinja2==2.11.1
google-auth==1.14.0
absl-py==0.9.0
\ No newline at end of file
3.7
\ No newline at end of file
......@@ -8,14 +8,23 @@ import os
import re
import shutil
from jinja2 import Environment, FileSystemLoader
from absl import app
from absl import flags
from jinja2 import Environment
from jinja2 import FileSystemLoader
import wget
from yaml import load, Loader
from yaml import load
from yaml import Loader
FLAGS = flags.FLAGS
# Flag names are globally defined! So in general, we need to be
# careful to pick names that are unlikely to be used by other libraries.
# If there is a conflict, we'll get an error at import time.
flags.DEFINE_string('config', os.path.dirname(os.path.abspath(__file__)) + '/config', 'Config directory', short_name='c')
CONTENT_DIR = './content/en/docs'
JS_ASSET_DIR = './assets/js'
SYNC_DIR = './sync/config'
TEMPLATE_DIR = './templates'
VAULT_DIR = './content/en/vault'
BUCKET_NAME = 'tekton-website-assets'
......@@ -118,8 +127,8 @@ def scan(dir_path):
return sync_config_paths
if __name__ == '__main__':
sync_config_paths = scan(f'./{SYNC_DIR}')
def main(argv):
sync_config_paths = scan(f'{FLAGS.config}')
sync_configs = []
for sync_config_path in sync_config_paths:
with open(sync_config_path) as f:
......@@ -130,3 +139,6 @@ if __name__ == '__main__':
component_versions = get_component_versions(sync_configs)
prepare_version_switcher_script(component_versions)
prepare_vault_landing_page(component_versions)
if __name__ == '__main__':
app.run(main)
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册