Skip to content
Open
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
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ members = [

[dependency-groups]
dev = [
# held back due to https://github.com/psf/black/issues/4963
"black<26.1.0",
"black",
"coverage",
"coveralls",
"fakeredis",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,15 @@ def upgrade(migrate_engine):
metadata.create_all()

# 2) Copy the conditions from the existing Scheduled Changes tables to them.
migrate_engine.execute(
"""INSERT INTO rules_scheduled_changes_conditions
migrate_engine.execute("""INSERT INTO rules_scheduled_changes_conditions
(sc_id, telemetry_product, telemetry_channel, telemetry_uptake, data_version, `when`)
SELECT sc_id, telemetry_product, telemetry_channel, telemetry_uptake, data_version, `when` from rules_scheduled_changes;
"""
)
migrate_engine.execute(
"""INSERT INTO rules_scheduled_changes_conditions_history
""")
migrate_engine.execute("""INSERT INTO rules_scheduled_changes_conditions_history
(change_id, changed_by, timestamp, sc_id, telemetry_product, telemetry_channel, telemetry_uptake, data_version, `when`)
SELECT change_id, changed_by, timestamp, sc_id, telemetry_product, telemetry_channel, telemetry_uptake,
data_version, `when` from rules_scheduled_changes_history;
"""
)
""")

# 3) _Then_ drop the conditions columns from the existing Tables.
rules_scheduled_changes = Table("rules_scheduled_changes", metadata, autoload=True)
Expand Down
24 changes: 8 additions & 16 deletions src/auslib/migrate/versions/019_add_change_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,33 @@ def upgrade(migrate_engine):

# 2) Update the values of change_type depending on base_data_version

migrate_engine.execute(
"""
migrate_engine.execute("""
UPDATE rules_scheduled_changes
SET change_type = "insert"
WHERE base_data_version is NULL;
"""
)
migrate_engine.execute(
"""
""")
migrate_engine.execute("""
UPDATE rules_scheduled_changes
SET change_type = "update"
WHERE base_data_version is not NULL;
"""
)
""")

# 3) Alter the column and set nullable=False
change_type.alter(nullable=False)

change_type = Column("change_type", String(50))
change_type.create(Table("rules_scheduled_changes_history", metadata, autoload=True))

migrate_engine.execute(
"""
migrate_engine.execute("""
UPDATE rules_scheduled_changes_history
SET change_type = "insert"
WHERE base_data_version is NULL;
"""
)
migrate_engine.execute(
"""
""")
migrate_engine.execute("""
UPDATE rules_scheduled_changes_history
SET change_type = "update"
WHERE base_data_version is not NULL;
"""
)
""")
rules_scheduled_changes = Table("rules_scheduled_changes", metadata, autoload=True)
rules_scheduled_changes.c.base_update_type.alter(nullable=True)

Expand Down
2 changes: 1 addition & 1 deletion src/auslib/util/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def parse(self, vstring):
if not match:
raise ValueError("invalid version number '%s'" % vstring)

(major, minor, patch, prerelease, prerelease_num) = match.group(1, 2, 4, 5, 6)
major, minor, patch, prerelease, prerelease_num = match.group(1, 2, 4, 5, 6)

if patch:
self.version = tuple(map(int, [major, minor, patch]))
Expand Down
1 change: 0 additions & 1 deletion taskcluster/balrog_taskgraph/transforms/docker_push.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
Set environment variables for the skopeo push-image command
"""


import os
import tomllib

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
Support run-on-releases option
"""


from taskgraph.transforms.base import TransformSequence

transforms = TransformSequence()
Expand Down
30 changes: 10 additions & 20 deletions tests/admin/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,13 @@ def my_userinfo(*args, **kwargs):
app.config["M2M_ACCOUNT_MAPPING"] = {}
app.config["CORS_ORIGINS"] = "*"
with open(self.version_file, "w+") as f:
f.write(
"""
f.write("""
{
"source":"https://github.com/mozilla-releng/balrog",
"version":"1.0",
"commit":"abcdef123456"
}
"""
)
""")
dbo.setDb("sqlite:///:memory:", releases_history_buckets={"*": "fake"}, releases_history_class=FakeGCSHistory)

self.orig_releases_history = dbo.releases.history
Expand Down Expand Up @@ -119,33 +117,28 @@ def my_userinfo(*args, **kwargs):
dbo.releases.t.insert().execute(name="a", product="a", data=createBlob(dict(name="a", hashFunction="sha512", schema_version=1)), data_version=1)
dbo.releases.t.insert().execute(name="ab", product="a", data=createBlob(dict(name="ab", hashFunction="sha512", schema_version=1)), data_version=1)
dbo.releases.history.bucket.blobs["ab/None-456-bob.json"] = FakeBlob("")
dbo.releases.history.bucket.blobs["ab/1-456-bob.json"] = FakeBlob(
"""
dbo.releases.history.bucket.blobs["ab/1-456-bob.json"] = FakeBlob("""
{
"name": "ab",
"hashFunction": "sha512",
"schema_version": 1
}
"""
)
""")
dbo.releases.t.insert().execute(name="b", product="b", data=createBlob(dict(name="b", hashFunction="sha512", schema_version=1)), data_version=1)
dbo.releases.history.bucket.blobs["b/None-567-bob.json"] = FakeBlob("")
dbo.releases.history.bucket.blobs["b/1-567-bob.json"] = FakeBlob(
"""
dbo.releases.history.bucket.blobs["b/1-567-bob.json"] = FakeBlob("""
{
"name": "b",
"hashFunction": "sha512",
"schema_version": 1
}
"""
)
""")
dbo.releases.t.insert().execute(name="c", product="c", data=createBlob(dict(name="c", hashFunction="sha512", schema_version=1)), data_version=1)
dbo.releases.t.insert().execute(
name="d",
product="d",
data_version=1,
data=createBlob(
"""
data=createBlob("""
{
"name": "d",
"schema_version": 1,
Expand All @@ -164,12 +157,10 @@ def my_userinfo(*args, **kwargs):
}
}
}
"""
),
"""),
)
dbo.releases.history.bucket.blobs["d/None-678-bob.json"] = FakeBlob("")
dbo.releases.history.bucket.blobs["d/1-678-bob.json"] = FakeBlob(
"""
dbo.releases.history.bucket.blobs["d/1-678-bob.json"] = FakeBlob("""
{
"name": "d",
"schema_version": 1,
Expand All @@ -188,8 +179,7 @@ def my_userinfo(*args, **kwargs):
}
}
}
"""
)
""")
dbo.rules.t.insert().execute(
rule_id=1,
priority=100,
Expand Down
Loading