diff --git a/nebari/provider/cicd/github.py b/nebari/provider/cicd/github.py index 668ca74b2..8b565d306 100644 --- a/nebari/provider/cicd/github.py +++ b/nebari/provider/cicd/github.py @@ -241,18 +241,23 @@ 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", run=( "git config user.email 'nebari@quansight.com' ; " "git config user.name 'github action' ; " - "git add . ; " + "git add ./.gitignore ./.github ./stages; " "git diff --quiet && git diff --staged --quiet || (git commit -m '${{ env.COMMIT_MSG }}') ; " f"git push origin {branch}" ), @@ -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}) diff --git a/nebari/schema.py b/nebari/schema.py index 70f6f19d6..fdda15596 100644 --- a/nebari/schema.py +++ b/nebari/schema.py @@ -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 ========