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 it easier to see what's deployed #816

Merged
merged 2 commits into from
Sep 11, 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
13 changes: 9 additions & 4 deletions .github/workflows/deploy-staged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ jobs:
slack_alert_webhook: ${{ secrets.SLACK_ALERT_WEBHOOK }}
azure_client_secret: ${{ secrets.AZURE_CLIENT_SECRET }}

prepare-release:
name: Prepare a draft release (to be published manually)
post-deploy:
name: "Post-deploy admin"
needs: deploy-prod
runs-on: ubuntu-latest
env:
Expand All @@ -96,5 +96,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4

- name: Generate a draft release
run: gh release create --generate-notes --latest --draft ${{ github.sha }} --title "Release candidate (${{github.sha}})"
- name: Generate a draft release (to be published manually)
run: gh release create --generate-notes --latest --draft ${{ github.sha }} --title "Release candidate"

- name: Update last-deployed tag
run: |
git tag -f last-deployed
git push --tags
1 change: 1 addition & 0 deletions .github/workflows/reusable-push-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ jobs:
ENV: ${{ inputs.env }}
CATALOGUE_URL: ${{ vars.CATALOGUE_URL }}
DEBUG: ${{ vars.DEBUG }}
GIT_REF: ${{ github.sha }}
DJANGO_ALLOWED_HOSTS: ${{ vars.DJANGO_ALLOWED_HOSTS }}
CSRF_TRUSTED_ORIGINS: ${{ vars.CSRF_TRUSTED_ORIGINS }}
DJANGO_LOG_LEVEL: ${{ vars.DJANGO_LOG_LEVEL }}
Expand Down
1 change: 1 addition & 0 deletions core/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ def analytics(request) -> dict[str, Any]:
return {
"ENABLE_ANALYTICS": settings.ENABLE_ANALYTICS,
"ANALYTICS_ID": settings.ANALYTICS_ID,
"GIT_REF": settings.GIT_REF,
}
2 changes: 2 additions & 0 deletions core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,3 +272,5 @@
CSRF_COOKIE_SECURE = True
LANGUAGE_COOKIE_SECURE = True
SESSION_COOKIE_SECURE = True

GIT_REF = os.environ.get("GIT_REF", "unknown")
2 changes: 2 additions & 0 deletions deployments/templates/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ spec:
value: "${CATALOGUE_URL}"
- name: DEBUG
value: "${DEBUG}"
- name: GIT_REF
value: "${GIT_REF}"
- name: DJANGO_ALLOWED_HOSTS
value: "${DJANGO_ALLOWED_HOSTS}"
- name: DJANGO_LOG_LEVEL
Expand Down
3 changes: 3 additions & 0 deletions templates/base/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@ <h2 class="govuk-visually-hidden">{% translate "Support links" %}</h2>
{% endblocktranslate %}
</div>
</div>
<p class="govuk-body govuk-body-s">
Find MoJ Data version {{ GIT_REF}}{% if GIT_REF != 'unknown' %} (<a href="https://github.com/ministryofjustice/find-moj-data/tree/{{GIT_REF}}">view source</a>){% endif %}
</p>
</div>
</footer>