Skip to content

Commit

Permalink
Allow for arbitrary before and after steps in github-actions nebari …
Browse files Browse the repository at this point in the history
…deployment
  • Loading branch information
costrouc committed Mar 3, 2023
1 parent 4612b86 commit 28078ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions nebari/provider/cicd/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,16 @@ def gen_nebari_ops(config):
step1 = checkout_image_step()
step2 = setup_python_step()
step3 = install_nebari_step(nebari_version)
gha_steps = [step1, step2, step3]

for step in config['ci_cd'].get('before_script'):
gha_steps.append(GHA_job_step(**step))

step4 = GHA_job_step(
name="Deploy Changes made in nebari-config.yaml",
run=f"nebari deploy -c nebari-config.yaml --disable-prompt{' --skip-remote-state-provision' if os.environ.get('NEBARI_GH_BRANCH') else ''}",
)
gha_steps.append(step4)

step5 = GHA_job_step(
name="Push Changes",
Expand All @@ -262,11 +267,12 @@ def gen_nebari_ops(config):
)
},
)

gha_steps = [step1, step2, step3, step4]
if commit_render:
gha_steps.append(step5)

for step in config['ci_cd'].get('after_script'):
gha_steps.append(GHA_job_step(**step))

job1 = GHA_job_id(name="nebari", runs_on_="ubuntu-latest", steps=gha_steps)
jobs = GHA_jobs(__root__={"build": job1})

Expand Down
4 changes: 2 additions & 2 deletions nebari/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ class CICD(Base):
type: CiEnum
branch: str
commit_render: typing.Optional[bool] = True
before_script: typing.Optional[typing.List[str]]
after_script: typing.Optional[typing.List[str]]
before_script: typing.Optional[typing.List[typing.Union[str, typing.Dict]]]
after_script: typing.Optional[typing.List[typing.Union[str, typing.Dict]]]


# ======== Generic Helm Extensions ========
Expand Down

0 comments on commit 28078ad

Please sign in to comment.