Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional app ID to builds #73

Merged
merged 7 commits into from
Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions flat-manager-client
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ApiError(Exception):
self.status = response.status

try:
self.body = json.loads(response);
self.body = json.loads(body)
except:
self.body = {"status": self.status, "error-type": "no-error", "message": "No json error details from server"}

Expand Down Expand Up @@ -444,9 +444,14 @@ def get_object_multipart(repo_path, object):

async def create_command(session, args):
build_url = urljoin(args.manager_url, "api/v1/build")
resp = await session.post(build_url, headers={'Authorization': 'Bearer ' + args.token}, json={
json = {
"repo": args.repo
})
}
if args.app_id is not None:
json["app-id"] = args.app_id
if args.public_download is not None:
json["public-download"] = args.public_download
resp = await session.post(build_url, headers={'Authorization': 'Bearer ' + args.token}, json=json)
async with resp:
if resp.status != 200:
raise ApiError(resp, await resp.text())
Expand Down Expand Up @@ -630,6 +635,9 @@ if __name__ == '__main__':
create_parser = subparsers.add_parser('create', help='Create new build')
create_parser.add_argument('manager_url', help='remote repo manager url')
create_parser.add_argument('repo', help='repo name')
create_parser.add_argument('app_id', nargs='?', help='app ID')
create_parser.add_argument('--public_download', action='store_true', default=None, help='allow public read access to the build repo')
create_parser.add_argument('--no_public_download', action='store_false', dest='public_download', default=None, help='allow public read access to the build repo')
create_parser.set_defaults(func=create_command)

push_parser = subparsers.add_parser('push', help='Push to repo manager')
Expand Down
1 change: 1 addition & 0 deletions migrations/2022-08-05-212616_add_build_app_id/down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE builds DROP COLUMN app_id;
1 change: 1 addition & 0 deletions migrations/2022-08-05-212616_add_build_app_id/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE builds ADD app_id TEXT;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE builds DROP COLUMN public_download;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE builds ADD public_download BOOLEAN DEFAULT TRUE NOT NULL;
Loading