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

fix docker image run issues #268

Merged
merged 4 commits into from
Apr 2, 2024
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
8 changes: 4 additions & 4 deletions pylib/ic_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
class IcAdmin:
"""Interface with the ic-admin utility."""

def __init__(self, deployment: typing.Optional[IcDeployment | str] = None, git_revision: str = ""):
def __init__(self, deployment: typing.Optional[IcDeployment | str] = None, git_revision: str | None = None):
"""Create an object with the specified ic-admin path and NNS URL."""
if isinstance(deployment, str):
self.nns_url = deployment
Expand All @@ -56,12 +56,12 @@ def _ic_admin_run(self, *cmd):
if cmd[0].startswith("propose"):
if "HSM_PIN" in os.environ:
auth = ["--use-hsm", "--pin", os.environ["HSM_PIN"], "--slot", "4", "--key-id", "01"]
elif "PROPOSER_KEY_FILE" in os.environ:
auth = ["-s", os.environ["PROPOSER_KEY_FILE"]]
else:
# TODO
print("not HSM_PIN")
logging.error("no auth")
auth = []
else:
print("not propose")
auth = []

cmd = [self.ic_admin_path, *auth, "--nns-url", self.nns_url, *cmd]
Expand Down
1 change: 1 addition & 0 deletions release-controller/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
credentials.json
proposer.key
17 changes: 3 additions & 14 deletions release-controller/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,23 @@ env = {

py_binary(
name = "reconciler",
srcs = ["reconciler.py"],
env = env,
deps = deps + [
":release-controller-lib",
],
)

py_library(
name = "release-controller-lib",
srcs = glob(
["*.py"],
exclude = [
"test_*.py",
"reconciler.py",
"pytest.py",
],
),
env = env,
deps = deps,
)

py_test(
name = "pytest",
srcs = ["pytest.py"],
data = glob(["test_*.py"]),
data = glob(["*.py"]),
env = env,
deps = deps + [
":release-controller-lib",
],
deps = deps,
)

py_oci_image(
Expand Down
9 changes: 4 additions & 5 deletions release-controller/reconciler.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ def __init__(
def reconcile(self):
config = self.loader.index()
active_versions = self.ic_prometheus.active_versions()
# TODO: remove hardcoded git revision
ic_admin = IcAdmin(self.nns_url, git_revision="e5c6356b5a752a7f5912de133000ae60e0e25aaf")
ic_admin = IcAdmin(self.nns_url, git_revision=os.environ.get("IC_ADMIN_VERSION"))
for rc_idx, rc in enumerate(
config.root.releases[: config.root.releases.index(oldest_active_release(config, active_versions)) + 1]
):
Expand Down Expand Up @@ -221,7 +220,7 @@ def place_proposal(ic_admin, changelog, version: str, forum_post_url: str, unele
"--summary",
summary,
*(["--dry-run"] if dry_run else []),
"--proposer", "39", # TODO: replace with system proposer
"--proposer", os.environ["PROPOSER_NEURON_ID"], # TODO: replace with system proposer
"--release-package-sha256-hex",
version_package_checksum(version),
"--release-package-urls",
Expand Down Expand Up @@ -249,15 +248,15 @@ def main():
if "dev" not in os.environ
else DevReleaseLoader()
)
state = ReconcilerState(pathlib.Path.home() / ".cache/release-controller")
state = ReconcilerState(pathlib.Path(os.environ.get('RECONCILER_STATE_DIR', pathlib.Path.home() / ".cache/release-controller")))
forum_client = ReleaseCandidateForumClient(
discourse_client,
)
github_client = Github(auth=Auth.Token(os.environ["GITHUB_TOKEN"]))
reconciler = Reconciler(
forum_client=forum_client,
loader=config_loader,
notes_client=ReleaseNotesClient(credentials_file=pathlib.Path(__file__).parent.resolve() / "credentials.json"),
notes_client=ReleaseNotesClient(credentials_file=pathlib.Path(os.environ.get('GDOCS_CREDENTIALS_PATH', pathlib.Path(__file__).parent.resolve() / "credentials.json"))),
publish_client=PublishNotesClient(github_client.get_repo(dre_repo)),
nns_url="https://ic0.app",
state=state,
Expand Down
Loading