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

Update repos used in deployments #645

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: 8 additions & 0 deletions lib/ramble/ramble/cmd/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import ramble.workspace.shell
import ramble.pipeline
import ramble.filters
from ramble.main import RambleCommand


description = "(experimental) manage workspace deployments"
Expand Down Expand Up @@ -135,6 +136,13 @@ def pull_file(src, dest):

pull_file(src, dest)

obj_repo_path = os.path.join(
ws.root, ramble.pipeline.PushDeploymentPipeline.object_repo_name
)
if os.path.exists(obj_repo_path):
repo_cmd = RambleCommand("repo")
repo_cmd("add", obj_repo_path, global_args=["-D", ws.root])


def deployment_run_pipeline(args, pipeline):
include_phase_dependencies = getattr(args, "include_phase_dependencies", None)
Expand Down
29 changes: 1 addition & 28 deletions lib/ramble/ramble/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ class PushDeploymentPipeline(Pipeline):
index_filename = "index.json"
index_namespace = "deployment_files"
tar_extension = ".tar.gz"
object_repo_name = "object_repo"

def __init__(
self, workspace, filters, create_tar=False, upload_url=None, deployment_name=None
Expand All @@ -573,7 +574,6 @@ def __init__(
self.require_inventory = True
self.create_tar = create_tar
self.upload_url = upload_url
self.object_repo_name = "object_repo"

if deployment_name:
workspace.deployment_name = deployment_name
Expand All @@ -582,8 +582,6 @@ def __init__(
self.deployment_name = workspace.name

def _execute(self):
from spack.util import spack_yaml as syaml

configs_dir = os.path.join(
self.workspace.named_deployment, ramble.workspace.workspace_config_path
)
Expand All @@ -593,31 +591,6 @@ def _execute(self):

aux_software_dir = os.path.join(configs_dir, ramble.workspace.auxiliary_software_dir_name)
fs.mkdirp(aux_software_dir)
aux_repo_conf = os.path.join(aux_software_dir, "repos.yaml")

repo_conf_defs = [
(conf_def["config_section"], f'{conf_def["config_section"]}.yaml')
for conf_def in ramble.repository.type_definitions.values()
]

for repo_conf in repo_conf_defs:
aux_repo_conf = os.path.join(aux_software_dir, repo_conf[1])
repo_data = syaml.syaml_dict()
if os.path.exists(aux_repo_conf):
with open(aux_repo_conf) as f:
repo_data = syaml.load_config(f.read())
else:
repo_data[repo_conf[0]] = []

add_repo = True
for repo in repo_data[repo_conf[0]]:
if repo == f"../../{self.object_repo_name}":
add_repo = False
if add_repo:
repo_data[repo_conf[0]].append(f"../../{self.object_repo_name}")

with open(aux_repo_conf, "w+") as f:
f.write(syaml.dump_config(repo_data))

repo_path = os.path.join(self.workspace.named_deployment, self.object_repo_name)
for object_type_def in ramble.repository.type_definitions.values():
Expand Down