Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
APK Foundry
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Max Rees
APK Foundry
Commits
27e9dbbd
Commit
27e9dbbd
authored
5 years ago
by
Max Rees
Browse files
Options
Downloads
Patches
Plain Diff
Update README, remove share/
parent
fdaa599d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.rst
+10
-29
10 additions, 29 deletions
README.rst
share/schema.sql
+0
-223
0 additions, 223 deletions
share/schema.sql
with
10 additions
and
252 deletions
README.rst
+
10
−
29
View file @
27e9dbbd
...
...
@@ -10,35 +10,16 @@ an APK-based package build orchestrator and distribution builder
:Copyright:
© 2019 Max Rees. GPL-2.0 open source licence.
Synopsis
--------
* ``af-agentd``: executes build requests and publishes the artifacts to
a central location
* ``af-dispatchd``: collect event requests and dispatches them to
available builder agents as well as record updates from the agents
Dependencies
------------
Base set
* Python 3.6+
* `attrs <http://attrs.org>`_
* `paho.mqtt <https://github.com/eclipse/paho.mqtt.python>`_
* MQTT broker (e.g. `mosquitto <https://mosquitto.org>`_)
``af-agentd``
* `apk-tools <https://gitlab.alpinelinux.org/alpine/apk-tools>`_
(``apk.static`` only)
* `bubblewrap <https://github.com/projectatomic/bubblewrap>`_
(installed as non-setuid)
* Linux kernel with unprivileged user namespace support
* `shadow-uidmap <https://github.com/shadow-maint/shadow>`_
* `skalibs <https://skarnet.org/software/skalibs>`_ (build-time only
for statically-compiled helper program)
``af-irc``
* `PyIRC <https://code.foxkit.us/IRC/PyIRC>`_
Web interface
* `jinja2 <http://jinja.pocoo.org>`_
* Python 3.6+
* GitLab runner
* `apk-tools <https://gitlab.alpinelinux.org/alpine/apk-tools>`_
(``apk.static`` only)
* `bubblewrap <https://github.com/projectatomic/bubblewrap>`_
(installed as non-setuid)
* Linux kernel with unprivileged user namespace support
* `shadow-uidmap <https://github.com/shadow-maint/shadow>`_
* `skalibs <https://skarnet.org/software/skalibs>`_ (build-time only
for statically-compiled helper program)
This diff is collapsed.
Click to expand it.
share/schema.sql
deleted
100644 → 0
+
0
−
223
View file @
fdaa599d
PRAGMA
foreign_keys
=
ON
;
CREATE
TABLE
IF
NOT
EXISTS
builders
(
builder
TEXT
PRIMARY
KEY
,
online
BOOLEAN
,
updated
TIMESTAMP
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
);
CREATE
TRIGGER
IF
NOT
EXISTS
builders_timestamp
AFTER
UPDATE
ON
builders
FOR
EACH
ROW
BEGIN
UPDATE
builders
SET
updated
=
CURRENT_TIMESTAMP
WHERE
builder
=
OLD
.
builder
;
END
;
CREATE
TABLE
IF
NOT
EXISTS
arches
(
builder
TEXT
NOT
NULL
,
arch
TEXT
NOT
NULL
,
idle
BOOLEAN
,
PRIMARY
KEY
(
builder
,
arch
),
FOREIGN
KEY
(
builder
)
REFERENCES
builders
(
builder
)
);
CREATE
TRIGGER
IF
NOT
EXISTS
arches_builders
BEFORE
INSERT
ON
arches
FOR
EACH
ROW
WHEN
CASE
NEW
.
builder
WHEN
NULL
THEN
NOT
EXISTS
(
SELECT
1
FROM
builders
WHERE
builder
IS
NULL
)
ELSE
TRUE
END
BEGIN
INSERT
OR
IGNORE
INTO
builders
(
builder
)
VALUES
(
NEW
.
builder
);
END
;
CREATE
TABLE
IF
NOT
EXISTS
events
(
eventid
INTEGER
PRIMARY
KEY
,
project
TEXT
NOT
NULL
,
type
INT
NOT
NULL
,
clone
TEXT
NOT
NULL
,
target
TEXT
NOT
NULL
,
revision
TEXT
NOT
NULL
,
user
TEXT
NOT
NULL
,
reason
TEXT
NOT
NULL
,
status
INT
NOT
NULL
DEFAULT
1
,
created
TIMESTAMP
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
updated
TIMESTAMP
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
mrid
INT
,
mrclone
TEXT
,
mrbranch
TEXT
);
CREATE
TRIGGER
IF
NOT
EXISTS
events_timestamp
AFTER
UPDATE
ON
events
FOR
EACH
ROW
BEGIN
UPDATE
events
SET
updated
=
CURRENT_TIMESTAMP
WHERE
eventid
=
OLD
.
eventid
;
END
;
CREATE
TABLE
IF
NOT
EXISTS
jobs
(
jobid
INTEGER
PRIMARY
KEY
,
eventid
INTEGER
NOT
NULL
,
builder
TEXT
,
arch
TEXT
NOT
NULL
,
status
INT
NOT
NULL
DEFAULT
1
,
created
TIMESTAMP
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
updated
TIMESTAMP
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
FOREIGN
KEY
(
eventid
)
REFERENCES
events
(
eventid
),
FOREIGN
KEY
(
builder
)
REFERENCES
builders
(
builder
)
);
CREATE
TRIGGER
IF
NOT
EXISTS
jobs_timestamp
AFTER
UPDATE
ON
jobs
FOR
EACH
ROW
BEGIN
UPDATE
jobs
SET
updated
=
CURRENT_TIMESTAMP
WHERE
jobid
=
OLD
.
jobid
;
END
;
CREATE
TRIGGER
IF
NOT
EXISTS
jobs_status
AFTER
UPDATE
OF
status
ON
jobs
FOR
EACH
ROW
BEGIN
UPDATE
events
SET
status
=
CASE
WHEN
NOT
EXISTS
-- (1, 4) = (new, start)
(
SELECT
1
FROM
jobs
WHERE
status
IN
(
1
,
4
)
AND
eventid
=
NEW
.
eventid
)
THEN
CASE
WHEN
56
IN
(
SELECT
DISTINCT
status
FROM
jobs
WHERE
eventid
=
NEW
.
eventid
)
THEN
56
-- cancel
WHEN
24
IN
(
SELECT
DISTINCT
status
FROM
jobs
WHERE
eventid
=
NEW
.
eventid
)
THEN
24
-- error
WHEN
152
IN
(
SELECT
DISTINCT
status
FROM
jobs
WHERE
eventid
=
NEW
.
eventid
)
THEN
152
-- fail
WHEN
312
IN
(
SELECT
DISTINCT
status
FROM
jobs
WHERE
eventid
=
NEW
.
eventid
)
THEN
312
-- depfail
ELSE
72
-- success
END
-- if the event is currently new then start it
WHEN
status
=
1
AND
NEW
.
status
!=
1
THEN
4
-- otherwise no change
ELSE
status
END
WHERE
eventid
=
NEW
.
eventid
;
END
;
CREATE
TRIGGER
IF
NOT
EXISTS
jobs_builders
BEFORE
UPDATE
OF
builder
ON
jobs
FOR
EACH
ROW
WHEN
CASE
NEW
.
builder
WHEN
NULL
THEN
NOT
EXISTS
(
SELECT
1
FROM
arches
WHERE
builder
IS
NULL
AND
arch
=
NEW
.
arch
)
ELSE
TRUE
END
BEGIN
INSERT
OR
IGNORE
INTO
arches
(
builder
,
arch
)
VALUES
(
NEW
.
builder
,
NEW
.
arch
);
END
;
CREATE
TABLE
IF
NOT
EXISTS
tasks
(
taskid
INTEGER
PRIMARY
KEY
,
jobid
INTEGER
NOT
NULL
,
repo
TEXT
NOT
NULL
,
pkg
TEXT
NOT
NULL
,
maintainer
TEXT
,
status
INT
NOT
NULL
DEFAULT
1
,
tail
TEXT
,
created
TIMESTAMP
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
updated
TIMESTAMP
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
FOREIGN
KEY
(
jobid
)
REFERENCES
jobs
(
jobid
)
);
CREATE
TRIGGER
IF
NOT
EXISTS
tasks_timestamp
AFTER
UPDATE
ON
tasks
FOR
EACH
ROW
BEGIN
UPDATE
tasks
SET
updated
=
CURRENT_TIMESTAMP
WHERE
taskid
=
OLD
.
taskid
;
END
;
CREATE
TRIGGER
IF
NOT
EXISTS
tasks_status
AFTER
UPDATE
OF
status
ON
tasks
FOR
EACH
ROW
BEGIN
UPDATE
jobs
SET
status
=
CASE
WHEN
NOT
EXISTS
-- (1, 4) = (new, start)
(
SELECT
1
FROM
tasks
WHERE
status
IN
(
1
,
4
)
AND
jobid
=
NEW
.
jobid
)
THEN
CASE
WHEN
56
IN
(
SELECT
DISTINCT
status
FROM
tasks
WHERE
jobid
=
NEW
.
jobid
)
THEN
56
-- cancel
WHEN
24
IN
(
SELECT
DISTINCT
status
FROM
tasks
WHERE
jobid
=
NEW
.
jobid
)
THEN
24
-- error
WHEN
152
IN
(
SELECT
DISTINCT
status
FROM
tasks
WHERE
jobid
=
NEW
.
jobid
)
THEN
152
-- fail
WHEN
312
IN
(
SELECT
DISTINCT
status
FROM
tasks
WHERE
jobid
=
NEW
.
jobid
)
THEN
312
-- depfail
ELSE
72
-- success
END
-- if the job is currently new then start it
WHEN
status
=
1
AND
NEW
.
status
!=
1
THEN
4
-- otherwise no change
ELSE
status
END
WHERE
jobid
=
NEW
.
jobid
;
END
;
CREATE
VIEW
IF
NOT
EXISTS
jobs_full
AS
SELECT
jobs
.
jobid
AS
jobid
,
jobs
.
eventid
AS
eventid
,
jobs
.
builder
AS
builder
,
jobs
.
arch
AS
arch
,
jobs
.
status
AS
status
,
jobs
.
created
AS
created
,
jobs
.
updated
AS
updated
,
events
.
project
AS
project
,
events
.
type
AS
type
,
events
.
clone
AS
clone
,
events
.
target
AS
target
,
events
.
mrid
AS
mrid
,
events
.
mrclone
AS
mrclone
,
events
.
mrbranch
AS
mrbranch
,
events
.
revision
AS
revision
,
events
.
user
AS
user
,
events
.
reason
AS
reason
FROM
jobs
INNER
JOIN
events
ON
jobs
.
eventid
=
events
.
eventid
;
CREATE
VIEW
IF
NOT
EXISTS
tasks_full
AS
SELECT
tasks
.
taskid
AS
taskid
,
tasks
.
jobid
AS
jobid
,
tasks
.
repo
AS
repo
,
tasks
.
pkg
AS
pkg
,
tasks
.
maintainer
AS
maintainer
,
tasks
.
status
AS
status
,
tasks
.
tail
AS
tail
,
tasks
.
created
AS
created
,
tasks
.
updated
AS
updated
,
jobs_full
.
eventid
AS
eventid
,
jobs_full
.
builder
AS
builder
,
jobs_full
.
arch
AS
arch
,
jobs_full
.
status
AS
status
,
jobs_full
.
project
AS
project
,
jobs_full
.
type
AS
type
,
jobs_full
.
clone
AS
clone
,
jobs_full
.
target
AS
target
,
jobs_full
.
mrid
AS
mrid
,
jobs_full
.
mrclone
AS
mrclone
,
jobs_full
.
mrbranch
AS
mrbranch
,
jobs_full
.
revision
AS
revision
,
jobs_full
.
user
AS
user
,
jobs_full
.
reason
AS
reason
FROM
tasks
INNER
JOIN
jobs_full
ON
tasks
.
jobid
=
jobs_full
.
jobid
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment