relengapi -> releng, fixes #7
This commit is contained in:
Родитель
e6dd2d1359
Коммит
b3eb9950fe
|
@ -1,3 +0,0 @@
|
|||
src/relengapi_tools=https://github.com/heroku/heroku-buildpack-nodejs
|
||||
src/relengapi_tools=https://github.com/garbas/heroku-buildpack-neo
|
||||
https://github.com/heroku/heroku-buildpack-python
|
36
.flooignore
36
.flooignore
|
@ -1,30 +1,14 @@
|
|||
#*
|
||||
*.o
|
||||
*.pyc
|
||||
*.pyo
|
||||
*~
|
||||
env/
|
||||
extern/
|
||||
node_modules/
|
||||
elm-stuff/
|
||||
tmp
|
||||
vendor/
|
||||
*.db
|
||||
*.pyc
|
||||
*.swp
|
||||
.-rplugin~
|
||||
|
||||
/TODO.txt
|
||||
/dist/
|
||||
/.floo
|
||||
/docs/build/
|
||||
/env/
|
||||
/requirements-flatten.txt
|
||||
/src/relengapi/.coverage
|
||||
/src/relengapi/.coverage-html
|
||||
/src/relengapi/docs_build_dir/
|
||||
/src/relengapi/relengapi.egg-info/
|
||||
/src/relengapi/result
|
||||
/src/relengapi_clobberer/env/
|
||||
/src/relengapi_clobberer/relengapi_clobberer.egg-info/
|
||||
/src/relengapi_common/relengapi_common.egg-info/
|
||||
/src/relengapi_frontend/.coverage
|
||||
/src/relengapi_frontend/elm-stuff/
|
||||
/src/relengapi_frontend/build
|
||||
/result*
|
||||
/src/**/*.egg-info/
|
||||
/src/**/.coverage
|
||||
/src/**/.coverage-html
|
||||
/src/**/build
|
||||
/src/**/elm-stuff/
|
||||
/src/**/node_modules/
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
*.db
|
||||
*.pyc
|
||||
*.swp
|
||||
.-rplugin~
|
||||
|
||||
/.-rplugin~
|
||||
/.floo
|
||||
/docs/build/
|
||||
/result*
|
||||
|
|
18
.travis.yml
18
.travis.yml
|
@ -1,18 +0,0 @@
|
|||
language: python
|
||||
sudo: false
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
python:
|
||||
- "2.7"
|
||||
env:
|
||||
- DATABASE_URL=sqlite:///$PWD/app.db
|
||||
install:
|
||||
- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install 6
|
||||
- git clone https://github.com/garbas/neo
|
||||
- cd neo && npm install && cd ..
|
||||
- sed -i -e 's|file:../../../neo|file:../../neo|' src/relengapi_tools/package.json
|
||||
- make install
|
||||
script: "make lint check docs"
|
||||
after_success:
|
||||
- codecov
|
36
Makefile
36
Makefile
|
@ -1,23 +1,27 @@
|
|||
.PHONY: help develop build-all build docker \
|
||||
.PHONY: help develop build docker \
|
||||
deploy-staging-all deploy-staging \
|
||||
deploy-production-all deploy-production \
|
||||
update-all
|
||||
|
||||
APP=
|
||||
APPS=relengapi_clobberer \
|
||||
relengapi_frontend \
|
||||
APPS=\
|
||||
releng_frontend \
|
||||
releng_clobberer \
|
||||
shipit_dashboard
|
||||
|
||||
TOOL=
|
||||
TOOLS=pypi2nix awscli \
|
||||
TOOLS=\
|
||||
pypi2nix \
|
||||
awscli \
|
||||
node2nix \
|
||||
mysql2sqlite \
|
||||
mysql2pgsql
|
||||
|
||||
APP_PORT_relengapi_clobberer=8000
|
||||
APP_PORT_relengapi_frontend=8001
|
||||
APP_PORT_shipit_dashboard=8002
|
||||
|
||||
APP_PORT_releng_frontend=8001
|
||||
APP_PORT_releng_clobberer=8002
|
||||
APP_PORT_shipit_frontend=8003
|
||||
APP_PORT_shipit_dashboard=8004
|
||||
|
||||
|
||||
help:
|
||||
|
@ -47,8 +51,8 @@ develop-run-FRONTEND: require-APP
|
|||
NEO_BASE_URL=https://localhost:$$APP_PORT_$(APP) \
|
||||
nix-shell nix/default.nix -A $(APP) --run "neo start --config webpack.config.js"
|
||||
|
||||
develop-run-relengapi_clobberer: develop-run-BACKEND
|
||||
develop-run-relengapi_frontend: develop-run-FRONTEND
|
||||
develop-run-releng_clobberer: develop-run-BACKEND
|
||||
develop-run-releng_frontend: develop-run-FRONTEND
|
||||
|
||||
develop-run-shipit_dashboard: develop-run-BACKEND
|
||||
develop-run-shipit_frontend: develop-run-BACKEND
|
||||
|
@ -79,7 +83,7 @@ deploy-staging-all: $(foreach app, $(APPS), deploy-staging-$(app)) deploy-stagin
|
|||
|
||||
deploy-staging: require-APP deploy-staging-$(APP)
|
||||
|
||||
deploy-staging-relengapi_clobberer: docker-relengapi_clobberer
|
||||
deploy-staging-releng_clobberer: docker-releng_clobberer
|
||||
if [[ -n "`docker images -q $(subst deploy-staging-,,$@)`" ]]; then \
|
||||
docker rmi -f `docker images -q $(subst deploy-staging-,,$@)`; \
|
||||
fi
|
||||
|
@ -90,7 +94,7 @@ deploy-staging-relengapi_clobberer: docker-relengapi_clobberer
|
|||
docker push \
|
||||
registry.heroku.com/releng-staging-$(subst deploy-staging-,,$@)/web
|
||||
|
||||
deploy-staging-relengapi_frontend: require-AWS build-app-relengapi_frontend build-tool-awscli
|
||||
deploy-staging-releng_frontend: require-AWS build-app-releng_frontend build-tool-awscli
|
||||
./result-tool-awscli/bin/aws s3 sync \
|
||||
--delete \
|
||||
--acl public-read \
|
||||
|
@ -113,7 +117,7 @@ deploy-production-all: $(foreach app, $(APPS), deploy-production-$(app)) deploy-
|
|||
|
||||
deploy-production: require-APP deploy-production-$(APP)
|
||||
|
||||
deploy-production-relengapi_clobberer: docker-relengapi_clobberer
|
||||
deploy-production-releng_clobberer: docker-releng_clobberer
|
||||
if [[ -n "`docker images -q $(subst deploy-production-,,$@)`" ]]; then \
|
||||
docker rmi -f `docker images -q $(subst deploy-production-,,$@)`; \
|
||||
fi
|
||||
|
@ -124,7 +128,7 @@ deploy-production-relengapi_clobberer: docker-relengapi_clobberer
|
|||
docker push \
|
||||
registry.heroku.com/releng-production-$(subst deploy-production-,,$@)/web
|
||||
|
||||
deploy-production-relengapi_frontend: require-AWS build-app-relengapi_frontend build-tool-awscli
|
||||
deploy-production-releng_frontend: require-AWS build-app-releng_frontend build-tool-awscli
|
||||
./result-tool-awscli/bin/aws s3 sync \
|
||||
--delete \
|
||||
--acl public-read \
|
||||
|
@ -189,8 +193,8 @@ require-APP:
|
|||
@if [[ -z "$(APP)" ]]; then \
|
||||
echo ""; \
|
||||
echo "You need to specify which APP, eg:"; \
|
||||
echo " make develop APP=relengapi_clobberer"; \
|
||||
echo " make build-app APP=relengapi_clobberer"; \
|
||||
echo " make develop APP=releng_clobberer"; \
|
||||
echo " make build-app APP=releng_clobberer"; \
|
||||
echo " ..."; \
|
||||
echo ""; \
|
||||
echo "Available APPS are: "; \
|
||||
|
@ -207,7 +211,7 @@ require-AWS:
|
|||
[[ -z "$$AWS_SECRET_ACCESS_KEY" ]]; then \
|
||||
echo ""; \
|
||||
echo "You need to specify AWS credentials, eg:"; \
|
||||
echo " make deploy-production-relengapi_clobberer \\"; \
|
||||
echo " make deploy-production-releng_clobberer \\"; \
|
||||
echo " AWS_ACCESS_KEY_ID=\"...\" \\"; \
|
||||
echo " AWS_SECRET_ACCESS_KEY=\"...\""; \
|
||||
echo ""; \
|
||||
|
|
23
README.rst
23
README.rst
|
@ -1,11 +1,12 @@
|
|||
Welcome to relengapi
|
||||
====================
|
||||
Welcome to releng
|
||||
=================
|
||||
|
||||
Purspose of relengapi ... TODO
|
||||
Purspose of releng ... TODO
|
||||
|
||||
- Documentation: https://docs.mozilla-releng.org
|
||||
- Issues: https://gitub.com/garbas/mozilla-releng/issues
|
||||
- Code: https://gitub.com/garbas/mozilla-releng
|
||||
|
||||
- Documentation: https://docs.relengapi.mozilla.org
|
||||
- Issues: https://gitub.com/mozilla/build-relengapi/issues
|
||||
- Code: https://gitub.com/mozilla/build-relengapi
|
||||
|
||||
Repository structure
|
||||
====================
|
||||
|
@ -81,18 +82,18 @@ Repository structure
|
|||
|
||||
- ``settings.py``
|
||||
|
||||
Production relengapi settings file for Heroku.
|
||||
Production releng settings file for Heroku.
|
||||
|
||||
- ``src/``
|
||||
|
||||
Directory where we keep all our source code
|
||||
|
||||
- ``relengapi_frontend/``
|
||||
- ``releng_frontend/``
|
||||
|
||||
Read its `README<src/relengapi_frontend/README.md` for more info.
|
||||
Read its `README<src/releng_frontend/README.md` for more info.
|
||||
|
||||
- ``relengapi_clobberer/``
|
||||
- ``releng_clobberer/``
|
||||
|
||||
Read its `README<src/relengapi_clobberer/README.md` for more info.
|
||||
Read its `README<src/releng_clobberer/README.md` for more info.
|
||||
|
||||
.. _pip: https://pip.pypa.io
|
||||
|
|
|
@ -224,7 +224,7 @@ latex_elements = {
|
|||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
(master_doc, 'RelengAPI.tex', u'RelengAPI Documentation',
|
||||
(master_doc, 'Releng.tex', u'Release Engineering Documentation',
|
||||
u'Rok Garbas', 'manual'),
|
||||
]
|
||||
|
||||
|
@ -254,7 +254,7 @@ latex_documents = [
|
|||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
(master_doc, 'relengapi', u'RelengAPI Documentation',
|
||||
(master_doc, 'releng', u'Release Engineering Documentation',
|
||||
[author], 1)
|
||||
]
|
||||
|
||||
|
@ -268,8 +268,8 @@ man_pages = [
|
|||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
(master_doc, 'RelengAPI', u'RelengAPI Documentation',
|
||||
author, 'RelengAPI', 'One line description of project.',
|
||||
(master_doc, 'RelEng', u'Release Engineering Documentation',
|
||||
author, 'RelEng', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
|
|
|
@ -12,24 +12,24 @@ Quick overview of all releng services with short description.
|
|||
.. todo:: write about AWS policies (production/staging)
|
||||
|
||||
|
||||
relengapi_frontend
|
||||
------------------
|
||||
releng_frontend
|
||||
---------------
|
||||
|
||||
Staging:
|
||||
|
||||
- Url: https://staging.mozilla-releng.org
|
||||
- S3: https://console.aws.amazon.com/s3/home?region=us-west-2&bucket=releng-staging-relengapi-frontend
|
||||
- S3: https://console.aws.amazon.com/s3/home?region=us-west-2&bucket=releng-staging-frontend
|
||||
- CloudFront: https://console.aws.amazon.com/cloudfront/home?region=us-west-2#distribution-settings:E21OUD0VFT2UQ6
|
||||
|
||||
Production:
|
||||
|
||||
- Url: https://mozilla-releng.org
|
||||
- S3: https://console.aws.amazon.com/s3/home?region=us-west-2&bucket=releng-production-relengapi-frontend
|
||||
- S3: https://console.aws.amazon.com/s3/home?region=us-west-2&bucket=releng-production-frontend
|
||||
- CloudFront: https://console.aws.amazon.com/cloudfront/home?region=us-west-2#distribution-settings:E7SMSK9P6UW3N
|
||||
|
||||
|
||||
relengapi_clobberer
|
||||
-------------------
|
||||
releng_clobberer
|
||||
----------------
|
||||
|
||||
.. todo:: mention that newrelic and papertrail addons are used
|
||||
|
||||
|
|
|
@ -31,5 +31,5 @@ current implementation
|
|||
|
||||
|
||||
Technical stuff:
|
||||
- relengapi stack
|
||||
- relengapi repo
|
||||
- releng stack
|
||||
- releng repo
|
||||
|
|
|
@ -22,20 +22,17 @@ let
|
|||
};
|
||||
|
||||
lib = import ./lib/default.nix { inherit releng_pkgs; };
|
||||
|
||||
tools = import ./tools/default.nix { inherit releng_pkgs; };
|
||||
|
||||
elmPackages = pkgs.elmPackages.override { nodejs = pkgs."nodejs-6_x"; };
|
||||
|
||||
releng_docs = import ./../docs { inherit releng_pkgs; };
|
||||
|
||||
relengapi_clobberer = import ./../src/relengapi_clobberer { inherit releng_pkgs; };
|
||||
|
||||
relengapi_frontend = import ./../src/relengapi_frontend { inherit releng_pkgs; };
|
||||
releng_frontend = import ./../src/releng_frontend { inherit releng_pkgs; };
|
||||
releng_clobberer = import ./../src/releng_clobberer { inherit releng_pkgs; };
|
||||
|
||||
#shipit_frontend = import ./../src/shipit_frontend { inherit releng_pkgs; };
|
||||
shipit_dashboard = import ./../src/shipit_dashboard { inherit releng_pkgs; };
|
||||
|
||||
#shipit = import ./../src/shipit { inherit releng_pkgs; };
|
||||
};
|
||||
|
||||
in releng_pkgs
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
recursive-include relengapi_clobberer/*
|
||||
recursive-include releng_clobberer/*
|
||||
|
||||
include VERSION
|
||||
include relengapi_clobberer/*.yml
|
||||
include releng_clobberer/*.yml
|
||||
|
||||
recursive-exclude * __pycache__
|
||||
recursive-exclude * *.py[co]
|
|
@ -0,0 +1,109 @@
|
|||
{ releng_pkgs }:
|
||||
|
||||
let
|
||||
|
||||
inherit (builtins) readFile concatStringsSep;
|
||||
inherit (releng_pkgs.lib) fromRequirementsFile;
|
||||
inherit (releng_pkgs.pkgs) makeWrapper writeScriptBin;
|
||||
inherit (releng_pkgs.pkgs.lib) removeSuffix inNixShell;
|
||||
inherit (releng_pkgs.tools) pypi2nix;
|
||||
|
||||
name = "releng_clobberer";
|
||||
version = removeSuffix "\n" (readFile ./VERSION);
|
||||
|
||||
beforeSQL = ''
|
||||
DROP TABLE IF EXISTS clobberer_builds;
|
||||
DROP TABLE IF EXISTS clobberer_times;
|
||||
DROP TABLE IF EXISTS builds;
|
||||
DROP TABLE IF EXISTS clobber_times;
|
||||
'';
|
||||
afterSQL = ''
|
||||
ALTER TABLE builds RENAME TO clobberer_builds;
|
||||
ALTER TABLE clobber_times RENAME TO clobberer_times;
|
||||
'';
|
||||
|
||||
python = import ./requirements.nix { inherit (releng_pkgs) pkgs; };
|
||||
|
||||
# TODO: move this migrate scripts to releng_pkgs.tools
|
||||
migrate = import ./migrate.nix { inherit releng_pkgs; };
|
||||
|
||||
srcs = [
|
||||
"./../releng_common"
|
||||
"./../${name}"
|
||||
];
|
||||
|
||||
self = python.mkDerivation {
|
||||
namePrefix = "";
|
||||
name = "${name}-${version}";
|
||||
srcs = if inNixShell then null else (map (x: ./. + ("/" + x)) srcs);
|
||||
sourceRoot = ".";
|
||||
buildInputs = [ makeWrapper ] ++
|
||||
fromRequirementsFile [ ./requirements-dev.txt
|
||||
./requirements-setup.txt ] python.packages;
|
||||
propagatedBuildInputs =
|
||||
fromRequirementsFile [ ./../releng_common/requirements.txt
|
||||
./requirements.txt
|
||||
./requirements-prod.txt ] python.packages;
|
||||
postInstall = ''
|
||||
mkdir -p $out/bin $out/etc
|
||||
|
||||
ln -s ${python.interpreter.interpreter} $out/bin
|
||||
ln -s ${python.packages."gunicorn"}/bin/gunicorn $out/bin
|
||||
ln -s ${python.packages."newrelic"}/bin/newrelic-admin $out/bin
|
||||
|
||||
cp ./src-*-releng_clobberer/settings.py $out/etc
|
||||
|
||||
for i in $out/bin/*; do
|
||||
wrapProgram $i --set PYTHONPATH $PYTHONPATH
|
||||
done
|
||||
'';
|
||||
checkPhase = ''
|
||||
flake8 settings.py setup.py releng_clobberer/
|
||||
# TODO: pytest ${name}/
|
||||
'';
|
||||
shellHook = ''
|
||||
export CACHE_DEFAULT_TIMEOUT=3600
|
||||
export CACHE_TYPE=filesystem
|
||||
export CACHE_DIR=$PWD/cache
|
||||
export DATABASE_URL=sqlite:///$PWD/app.db
|
||||
|
||||
for i in ${concatStringsSep " " srcs}; do
|
||||
if test -e src/''${i:5}/setup.py; then
|
||||
echo "Setting \"''${i:5}\" in development mode ..."
|
||||
pushd src/''${i:5} >> /dev/null
|
||||
tmp_path=$(mktemp -d)
|
||||
export PATH="$tmp_path/bin:$PATH"
|
||||
export PYTHONPATH="$tmp_path/${python.__old.python.sitePackages}:$PYTHONPATH"
|
||||
mkdir -p $tmp_path/${python.__old.python.sitePackages}
|
||||
${python.__old.bootstrapped-pip}/bin/pip install -q -e . --prefix $tmp_path
|
||||
popd >> /dev/null
|
||||
fi
|
||||
done
|
||||
'';
|
||||
passthru.mysql2sqlite = migrate.mysql2sqlite { inherit name beforeSQL afterSQL; };
|
||||
passthru.mysql2postgresql = migrate.mysql2postgresql { inherit name beforeSQL afterSQL; };
|
||||
passthru.python = python;
|
||||
passthru.dockerEnvs = [
|
||||
"APP_SETTINGS=${self}/etc/settings.py"
|
||||
];
|
||||
passthru.dockerConfig = {
|
||||
Cmd = [
|
||||
"newrelic-admin" "run-program"
|
||||
"gunicorn" "${name}:app"
|
||||
"--timeout" "300" "--log-file" "-"
|
||||
];
|
||||
};
|
||||
passthru.updateSrc = writeScriptBin "update" ''
|
||||
pushd src/${name}
|
||||
${pypi2nix}/bin/pypi2nix -v \
|
||||
-V 3.5 \
|
||||
-E "postgresql" \
|
||||
-r requirements.txt \
|
||||
-r requirements-setup.txt \
|
||||
-r requirements-dev.txt \
|
||||
-r requirements-prod.txt
|
||||
popd
|
||||
'';
|
||||
};
|
||||
|
||||
in self
|
|
@ -6,7 +6,7 @@ from __future__ import absolute_import
|
|||
|
||||
import os
|
||||
|
||||
from relengapi_common import db, create_app
|
||||
from releng_common import db, create_app
|
||||
|
||||
|
||||
DEBUG = bool(os.environ.get('DEBUG', __name__ == '__main__'))
|
||||
|
@ -29,7 +29,7 @@ if not os.environ.get('APP_SETTINGS') and \
|
|||
|
||||
|
||||
app = create_app(
|
||||
"relengapi_clobberer",
|
||||
"releng_clobberer",
|
||||
extensions=[init_app, db],
|
||||
debug=DEBUG,
|
||||
debug_src=HERE,
|
|
@ -5,7 +5,7 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
from flask import g, current_app
|
||||
from relengapi_clobberer import models
|
||||
from releng_clobberer import models
|
||||
|
||||
|
||||
def get_buildbot():
|
||||
|
@ -24,7 +24,7 @@ def get_buildbot():
|
|||
# who = 'automation'
|
||||
|
||||
# TODO: require scopes
|
||||
# relengapi_common.auth.auth.require_scope('releng???/api/clobberer/buildbot/post)
|
||||
# releng_common.auth.auth.require_scope('releng???/api/clobberer/buildbot/post)
|
||||
def post_buildbot(body):
|
||||
result = []
|
||||
|
|
@ -9,7 +9,7 @@ import sqlalchemy as sa
|
|||
import taskcluster as tc
|
||||
import time
|
||||
|
||||
from relengapi_common.db import db
|
||||
from releng_common.db import db
|
||||
|
||||
|
||||
BUILDBOT_BUILDDIR_REL_PREFIX = 'rel-'
|
|
@ -8,7 +8,7 @@ paths:
|
|||
/buildbot:
|
||||
|
||||
get:
|
||||
operationId: "relengapi_clobberer.api.get_buildbot"
|
||||
operationId: "releng_clobberer.api.get_buildbot"
|
||||
responses:
|
||||
200:
|
||||
description: An array of branches
|
||||
|
@ -18,7 +18,7 @@ paths:
|
|||
$ref: '#/definitions/Branch'
|
||||
|
||||
post:
|
||||
operationId: "relengapi_clobberer.api.post_buildbot"
|
||||
operationId: "releng_clobberer.api.post_buildbot"
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
|
@ -52,13 +52,13 @@ paths:
|
|||
/taskcluster:
|
||||
|
||||
get:
|
||||
operationId: "relengapi_clobberer.api.get_taskcluster"
|
||||
operationId: "releng_clobberer.api.get_taskcluster"
|
||||
responses:
|
||||
200:
|
||||
description: An array of branches
|
||||
|
||||
post:
|
||||
operationId: "relengapi_clobberer.api.post_taskcluster"
|
||||
operationId: "releng_clobberer.api.post_taskcluster"
|
||||
responses:
|
||||
200:
|
||||
description: Branches clobbered
|
|
@ -0,0 +1,2 @@
|
|||
-r ../releng_common/requirements.txt
|
||||
-e ../releng_common
|
|
@ -21,7 +21,7 @@ with open(os.path.join(here, 'requirements.txt')) as f:
|
|||
)
|
||||
|
||||
setup(
|
||||
name='relengapi_clobberer',
|
||||
name='releng_clobberer',
|
||||
version=open(os.path.join(here, 'VERSION')).read().strip(),
|
||||
description='The code behind https://clobberer.mozilla-releng.net',
|
||||
author='Rok Garbas',
|
|
@ -11,11 +11,11 @@ import sys
|
|||
|
||||
from flask import Flask, send_from_directory
|
||||
|
||||
from relengapi_common import api, log, cors
|
||||
from releng_common import api, log, cors
|
||||
|
||||
__APP = dict()
|
||||
|
||||
logger = logging.getLogger('relengapi_common')
|
||||
logger = logging.getLogger('releng_common')
|
||||
|
||||
|
||||
def create_app(name, extensions=[], config=None, debug=False, debug_src=None,
|
||||
|
@ -38,7 +38,7 @@ def create_app(name, extensions=[], config=None, debug=False, debug_src=None,
|
|||
elif os.environ.get('APP_SETTINGS'): # noqa
|
||||
app.config.from_envvar('APP_SETTINGS')
|
||||
else:
|
||||
print("Using default settings; to configure relengapi, set "
|
||||
print("Using default settings; to configure releng, set "
|
||||
"APP_SETTINGS to point to your settings file")
|
||||
sys.exit(1)
|
||||
|
|
@ -10,7 +10,7 @@ import pathlib
|
|||
import werkzeug.exceptions
|
||||
|
||||
|
||||
logger = logging.getLogger('relengapi_common.api')
|
||||
logger = logging.getLogger('releng_common.api')
|
||||
|
||||
|
||||
def common_error_handler(exception):
|
|
@ -24,7 +24,7 @@ class UnstructuredRenderer(structlog.processors.KeyValueRenderer):
|
|||
|
||||
|
||||
def setup_console_logging(quiet=False):
|
||||
root = logging.getLogger('relengapi_common')
|
||||
root = logging.getLogger('releng_common')
|
||||
if quiet:
|
||||
root.setLevel(logging.WARNING)
|
||||
else:
|
|
@ -19,13 +19,12 @@ with open(os.path.join(here, 'requirements.txt')) as f:
|
|||
|
||||
|
||||
setup(
|
||||
name='relengapi_common',
|
||||
name='releng_common',
|
||||
version=version,
|
||||
description='Common code for all services behind '
|
||||
'https://mozilla-releng.net',
|
||||
description='Services behind https://mozilla-releng.net',
|
||||
author='Mozilla Release Engineering',
|
||||
author_email='release@mozilla.com',
|
||||
url='https://github.com/mozilla/build-relengapi',
|
||||
url='https://github.com/garbas/mozilla-releng',
|
||||
install_requires=install_requires,
|
||||
packages=find_packages(),
|
||||
include_package_data=True,
|
|
@ -3,26 +3,33 @@
|
|||
|
||||
let
|
||||
|
||||
inherit (releng_pkgs) elmPackages;
|
||||
inherit (builtins) fromJSON readFile filterSource attrValues concatStringsSep;
|
||||
inherit (releng_pkgs.elmPackages) elm;
|
||||
inherit (releng_pkgs.elmPackages.lib) makeElmStuff;
|
||||
inherit (releng_pkgs.pkgs) writeScriptBin cacert;
|
||||
inherit (releng_pkgs.pkgs.stdenv) mkDerivation;
|
||||
inherit (releng_pkgs.tools) node2nix elm2nix;
|
||||
|
||||
pkg = fromJSON (readFile ./package.json);
|
||||
name = pkg.name;
|
||||
version = pkg.version;
|
||||
|
||||
pkg = builtins.fromJSON (builtins.readFile ./package.json);
|
||||
node_modules = import ./package.nix { inherit (releng_pkgs) pkgs; };
|
||||
|
||||
self = mkDerivation {
|
||||
name = "${pkg.name}-${pkg.version}";
|
||||
src = builtins.filterSource
|
||||
name = "${name}-${version}";
|
||||
src = filterSource
|
||||
(path: type: baseNameOf path != "elm-stuff"
|
||||
&& baseNameOf path != "node_modules"
|
||||
)
|
||||
./.;
|
||||
buildInputs = [ elmPackages.elm ] ++ (builtins.attrValues node_modules);
|
||||
buildInputs = [ elm ] ++ (attrValues node_modules);
|
||||
configurePhase = ''
|
||||
rm -rf node_modules
|
||||
rm -rf elm-stuff
|
||||
'' + elmPackages.lib.makeElmStuff (import ./elm-package.nix) + ''
|
||||
'' + (makeElmStuff (import ./elm-package.nix)) + ''
|
||||
mkdir node_modules
|
||||
for item in ${builtins.concatStringsSep " " (builtins.attrValues node_modules)}; do
|
||||
for item in ${concatStringsSep " " (attrValues node_modules)}; do
|
||||
ln -s $item/lib/node_modules/* ./node_modules
|
||||
done
|
||||
'';
|
||||
|
@ -34,12 +41,12 @@ let
|
|||
cp build/* $out/ -R
|
||||
'';
|
||||
shellHook = ''
|
||||
cd src/${pkg.name}
|
||||
cd src/${name}
|
||||
'' + self.configurePhase;
|
||||
passthru.updateSrc = releng_pkgs.pkgs.writeScriptBin "update" ''
|
||||
export SSL_CERT_FILE="${releng_pkgs.pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
|
||||
pushd src/relengapi_frontend
|
||||
${releng_pkgs.tools.node2nix}/bin/node2nix \
|
||||
passthru.updateSrc = writeScriptBin "update" ''
|
||||
export SSL_CERT_FILE="${cacert}/etc/ssl/certs/ca-bundle.crt"
|
||||
pushd src/${name}
|
||||
${node2nix}/bin/node2nix \
|
||||
--composition package.nix \
|
||||
--input node-packages.json \
|
||||
--output node-packages.nix \
|
||||
|
@ -47,8 +54,8 @@ let
|
|||
--flatten \
|
||||
--pkg-name nodejs-6_x
|
||||
rm -rf elm-stuff
|
||||
${elmPackages.elm}/bin/elm-package install -y
|
||||
${releng_pkgs.tools.elm2nix}/bin/elm2nix elm-package.nix
|
||||
${elm}/bin/elm-package install -y
|
||||
${elm2nix}/bin/elm2nix elm-package.nix
|
||||
popd
|
||||
'';
|
||||
};
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"name": "relengapi_frontend",
|
||||
"name": "releng_frontend",
|
||||
"version": "0.1.0",
|
||||
"description": "relengapi frontend",
|
||||
"description": "releng frontend",
|
||||
"main": "src/index.js",
|
||||
"author": "Rok Garbas <rok@garbas.si>",
|
||||
"repository": "https://github.com/mozilla/build-relengapi",
|
||||
"repository": "https://github.com/garbas/mozilla-releng",
|
||||
"license": "MPL-2.0",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
|
@ -25,7 +25,7 @@
|
|||
},
|
||||
"keywords": [
|
||||
"mozilla",
|
||||
"relengapi"
|
||||
"releng"
|
||||
],
|
||||
"dependencies": {
|
||||
"bootstrap": "4.0.0-alpha.2",
|
|
@ -1,111 +0,0 @@
|
|||
{ releng_pkgs }:
|
||||
|
||||
let
|
||||
|
||||
name = "relengapi_clobberer";
|
||||
|
||||
beforeSQL = ''
|
||||
DROP TABLE IF EXISTS clobberer_builds;
|
||||
DROP TABLE IF EXISTS clobberer_times;
|
||||
DROP TABLE IF EXISTS builds;
|
||||
DROP TABLE IF EXISTS clobber_times;
|
||||
'';
|
||||
afterSQL = ''
|
||||
ALTER TABLE builds RENAME TO clobberer_builds;
|
||||
ALTER TABLE clobber_times RENAME TO clobberer_times;
|
||||
'';
|
||||
|
||||
inherit (builtins) readFile concatStringsSep;
|
||||
inherit (releng_pkgs.lib) fromRequirementsFile;
|
||||
inherit (releng_pkgs.pkgs) makeWrapper;
|
||||
inherit (releng_pkgs.pkgs.lib) removeSuffix inNixShell;
|
||||
|
||||
python = import ./requirements.nix { inherit (releng_pkgs) pkgs; };
|
||||
|
||||
migrate = import ./migrate.nix { inherit releng_pkgs; };
|
||||
|
||||
version = removeSuffix "\n" (readFile ./VERSION);
|
||||
|
||||
srcs = [
|
||||
"./../relengapi_common"
|
||||
"./../relengapi_clobberer"
|
||||
];
|
||||
|
||||
self = python.mkDerivation {
|
||||
namePrefix = "";
|
||||
name = "${name}-${version}";
|
||||
srcs = if inNixShell then null else (map (x: ./. + ("/" + x)) srcs);
|
||||
sourceRoot = ".";
|
||||
buildInputs = [ makeWrapper ] ++
|
||||
fromRequirementsFile [ ./requirements-dev.txt
|
||||
./requirements-setup.txt ] python.packages;
|
||||
propagatedBuildInputs =
|
||||
fromRequirementsFile [ ./../relengapi_common/requirements.txt
|
||||
./requirements.txt
|
||||
./requirements-prod.txt ] python.packages;
|
||||
postInstall = ''
|
||||
mkdir -p $out/bin $out/etc
|
||||
|
||||
ln -s ${python.interpreter.interpreter} $out/bin
|
||||
ln -s ${python.packages."gunicorn"}/bin/gunicorn $out/bin
|
||||
ln -s ${python.packages."newrelic"}/bin/newrelic-admin $out/bin
|
||||
|
||||
cp ./src-*-relengapi_clobberer/settings.py $out/etc
|
||||
|
||||
for i in $out/bin/*; do
|
||||
wrapProgram $i --set PYTHONPATH $PYTHONPATH
|
||||
done
|
||||
'';
|
||||
checkPhase = ''
|
||||
flake8 settings.py setup.py relengapi_clobberer/
|
||||
# TODO: pytest relengapi_clobberer/
|
||||
'';
|
||||
shellHook = ''
|
||||
export CACHE_DEFAULT_TIMEOUT=3600
|
||||
export CACHE_TYPE=filesystem
|
||||
export CACHE_DIR=$PWD/cache
|
||||
export DATABASE_URL=sqlite:///$PWD/app.db
|
||||
|
||||
for i in ${concatStringsSep " " srcs}; do
|
||||
if test -e src/''${i:5}/setup.py; then
|
||||
echo "Setting \"''${i:5}\" in development mode ..."
|
||||
pushd src/''${i:5} >> /dev/null
|
||||
tmp_path=$(mktemp -d)
|
||||
export PATH="$tmp_path/bin:$PATH"
|
||||
export PYTHONPATH="$tmp_path/${python.__old.python.sitePackages}:$PYTHONPATH"
|
||||
mkdir -p $tmp_path/${python.__old.python.sitePackages}
|
||||
${python.__old.bootstrapped-pip}/bin/pip install -q -e . --prefix $tmp_path
|
||||
popd >> /dev/null
|
||||
fi
|
||||
done
|
||||
'';
|
||||
passthru.mysql2sqlite = migrate.mysql2sqlite {
|
||||
inherit name beforeSQL afterSQL;
|
||||
};
|
||||
passthru.mysql2postgresql = migrate.mysql2postgresql {
|
||||
inherit name beforeSQL afterSQL;
|
||||
};
|
||||
passthru.python = python;
|
||||
passthru.dockerEnvs = [
|
||||
"APP_SETTINGS=${self}/etc/settings.py"
|
||||
];
|
||||
passthru.dockerConfig = {
|
||||
Cmd = [
|
||||
"newrelic-admin" "run-program"
|
||||
"gunicorn" "relengapi_clobberer:app"
|
||||
"--timeout" "300" "--log-file" "-"
|
||||
];
|
||||
};
|
||||
passthru.updateSrc = releng_pkgs.pkgs.writeScriptBin "update" ''
|
||||
pushd src/relengapi_clobberer
|
||||
${releng_pkgs.tools.pypi2nix}/bin/pypi2nix -v \
|
||||
-V 3.5 \
|
||||
-E "postgresql" \
|
||||
-r requirements.txt \
|
||||
-r requirements-setup.txt \
|
||||
-r requirements-dev.txt \
|
||||
-r requirements-prod.txt
|
||||
popd
|
||||
'';
|
||||
};
|
||||
in self
|
|
@ -1,2 +0,0 @@
|
|||
-r ../relengapi_common/requirements.txt
|
||||
-e ../relengapi_common
|
|
@ -19,7 +19,7 @@ setup(
|
|||
author_email='release@mozilla.com',
|
||||
url='https://ship-it.mozilla-releng.net',
|
||||
install_requires=[
|
||||
"relengapi_common",
|
||||
"releng_common",
|
||||
],
|
||||
extras_require={
|
||||
},
|
||||
|
@ -28,7 +28,7 @@ setup(
|
|||
zip_safe=False,
|
||||
entry_points={
|
||||
"console_scripts": [
|
||||
'relengapi = relengapi.cmd:main',
|
||||
'releng = releng.cmd:main',
|
||||
],
|
||||
},
|
||||
license='MPL2',
|
||||
|
|
|
@ -2,21 +2,18 @@
|
|||
|
||||
let
|
||||
|
||||
name = "shipit_dashboard";
|
||||
|
||||
inherit (builtins) readFile concatStringsSep;
|
||||
inherit (releng_pkgs.lib) fromRequirementsFile;
|
||||
inherit (releng_pkgs.pkgs) makeWrapper;
|
||||
inherit (releng_pkgs.pkgs.lib) removeSuffix inNixShell;
|
||||
|
||||
python = import ./requirements.nix {
|
||||
inherit (releng_pkgs) pkgs;
|
||||
};
|
||||
|
||||
name = "shipit_dashboard";
|
||||
version = removeSuffix "\n" (readFile ./VERSION);
|
||||
|
||||
python = import ./requirements.nix { inherit (releng_pkgs) pkgs; };
|
||||
|
||||
srcs = [
|
||||
"./../relengapi_common"
|
||||
"./../releng_common"
|
||||
"./../${name}"
|
||||
];
|
||||
|
||||
|
@ -29,7 +26,7 @@ let
|
|||
fromRequirementsFile [ ./requirements-dev.txt
|
||||
./requirements-setup.txt ] python.packages;
|
||||
propagatedBuildInputs = [ python.packages."clouseau" ] ++
|
||||
fromRequirementsFile [ ./../relengapi_common/requirements.txt
|
||||
fromRequirementsFile [ ./../releng_common/requirements.txt
|
||||
./requirements.txt
|
||||
./requirements-prod.txt ] python.packages;
|
||||
postInstall = ''
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
-r ../relengapi_common/requirements.txt
|
||||
-e ../relengapi_common
|
||||
-r ../releng_common/requirements.txt
|
||||
-e ../releng_common
|
||||
|
||||
# from https://github.com/calixteman/clouseau/blob/master/requirements.txt
|
||||
requests>=2.7.0
|
||||
|
|
|
@ -6,7 +6,7 @@ from __future__ import absolute_import
|
|||
|
||||
import os
|
||||
|
||||
from relengapi_common import db, create_app
|
||||
from releng_common import db, create_app
|
||||
from shipit_dashboard.workflow import run_workflow
|
||||
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ from __future__ import absolute_import
|
|||
|
||||
|
||||
import sqlalchemy as sa
|
||||
from relengapi_common.db import db
|
||||
from releng_common.db import db
|
||||
|
||||
import datetime
|
||||
import pickle
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# coding=utf-8
|
||||
from relengapi_common.db import db
|
||||
from releng_common.db import db
|
||||
from shipit_dashboard.models import BugAnalysis, BugResult
|
||||
from shipit_dashboard.helpers import compute_dict_hash
|
||||
from clouseau.bugzilla import Bugzilla
|
||||
|
|
|
@ -4,5 +4,5 @@ PLAN:
|
|||
- example: https://people.mozilla.org/~sledru/relman-dashboard/
|
||||
|
||||
- bootstrap the project
|
||||
- copy login from relengapi_tools
|
||||
- copy login from releng_tools
|
||||
- create a route for dashboard
|
||||
|
|
Загрузка…
Ссылка в новой задаче