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

make the commit of the terraform rendering optional #995

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 3 additions & 1 deletion qhub/render/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from cookiecutter.generate import generate_files
from ..version import __version__
from ..constants import TERRAFORM_VERSION
from ..utils import pip_install_qhub, QHUB_GH_BRANCH
from ..utils import pip_install_qhub, QHUB_GH_BRANCH, QHUB_PREVENT_COMMIT_RENDER

# existing files and folders to delete when `render_template` is called
DELETABLE_PATHS = [
Expand Down Expand Up @@ -60,6 +60,8 @@ def patch_versioning_extra_config(config):

config["QHUB_GH_BRANCH"] = QHUB_GH_BRANCH

config["QHUB_PREVENT_COMMIT_RENDER"] = QHUB_PREVENT_COMMIT_RENDER

if "terraform_version" not in config:
config["terraform_version"] = TERRAFORM_VERSION

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ jobs:
- name: Deploy Changes made in qhub-config.yaml
run: |
qhub deploy -c qhub-config.yaml --disable-prompt {% if cookiecutter.QHUB_GH_BRANCH == '' %}--skip-remote-state-provision{% endif %}

{% if cookiecutter.QHUB_PREVENT_COMMIT_RENDER != 'yes' -%}
- name: Push Changes
run: |
git config user.email "qhub@quansight.com"
Expand All @@ -78,3 +80,4 @@ jobs:
env:
COMMIT_MSG: |
qhub-config.yaml automated commit: {{ '${{ github.sha }}' }}
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ render-qhub:
- git checkout "{{ cookiecutter.ci_cd.branch }}"
- {{ cookiecutter.pip_install_qhub }}
- qhub deploy --config qhub-config.yaml --disable-prompt --skip-remote-state-provision
{% if cookiecutter.QHUB_PREVENT_COMMIT_RENDER != 'yes' -%}
- git config user.email "qhub@quansight.com"
- git config user.name "gitlab ci"
- git add .
- git diff --quiet && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}"; git push origin "{{ cookiecutter.ci_cd.branch }}")
{% endif %}
only:
refs:
- "{{ cookiecutter.ci_cd.branch }}"
Expand Down
2 changes: 1 addition & 1 deletion qhub/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
pip_install_qhub = (
f"pip install https://github.com/Quansight/qhub/archive/{QHUB_GH_BRANCH}.zip"
)

QHUB_PREVENT_COMMIT_RENDER = os.environ.get("QHUB_PREVENT_COMMIT_RENDER","no")

# Regex for suitable project names
namestr_regex = r"^[A-Za-z][A-Za-z\-_]*[A-Za-z]$"
Expand Down