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

[GH-171] - Update deploy.yml to Send Notifications to Microsoft Teams and Align with Other Repos #173

Merged
merged 21 commits into from
Jan 21, 2025

Conversation

soufianerafik
Copy link
Contributor

@soufianerafik soufianerafik commented Jan 17, 2025

Change Description: This PR updates the deploy.yml workflow to send deployment notifications to Microsoft Teams instead of Slack. It also aligns with the notification setup used in the Identity.UW repository, to keep deployment update notifications consistent and standardized across the board.

Screenshot 2025-01-21 at 10 27 34 AM Screenshot 2025-01-21 at 10 27 00 AM

Closes Github(s): GH-171

UW-Directory Pull Request checklist

  • I have run poetry run tox
  • I have selected a semver-guidance: label for this pull request (under labels,
    to the right of the screen)

@soufianerafik soufianerafik added the semver-guidance:no-bump Use this when you don't want the version to change. label Jan 17, 2025
@soufianerafik soufianerafik self-assigned this Jan 17, 2025
Copy link
Contributor

Download and run the latest build with:

./scripts/run-development-server.sh -i gcr.io/uwit-mci-iam/husky-directory.app:pull-request-173

@soufianerafik soufianerafik marked this pull request as ready for review January 21, 2025 19:27
The semver you want to deploy. If you do not provide this, the workflow
will promote from the "previous" cluster (dev -> eval, eval -> prod).
associated-record:
required: false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reference #identity-uw

Copy link
Contributor

@goulter goulter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a couple of questions.


jobs:
# The `configure` job reconciles the target version (if it wasn't explicitly provided),
# creates a slack notification for the deployment (except for developer instances),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"creates a slack notification for the deployment (except for developer instances)"
did we keep the part about "except for developer instances"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, great call @goulter - Thanks!

It's handled here: https://github.com/UWIT-IAM/uw-husky-directory/pull/173/files#diff-28802fbf11c83a2eee09623fb192785e7ca92a3f40602a517c011b947a1822d3L167

+      - name: Notify Teams of Deployment Start
+        # creates MS Teams notification for the deployment (except for developer instances),
+       if: env.target_stage == 'dev' || env.target_stage == 'eval' || env.target_stage == 'prod'

Just to confirm, do we have developer instances like identity.UW? Either way, this won't send notifications if we create them in the future. :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, thats a great point. There are no developer instances of the directory.

else
target_version=$(./scripts/get-deployed-version.sh -s ${source_stage})
target_version="${{ env.target_version }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you clarify the change? (lines 84/93)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@goulter : It is used to directly set the target_version when it is explicitly provided as input (via the target-version environment variable).

For more details please check https://github.com/UWIT-IAM/identity-uw/blob/develop/.github/workflows/deploy-from-ui.yml#L98

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should have been more specific. Why not keep target_version=$(./scripts/get-deployed-version.sh -s ${source_stage})?

Copy link
Contributor Author

@soufianerafik soufianerafik Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change from target_version=$(./scripts/get-deployed-version.sh -s ${source_stage}) to target_version="${{ env.target_version }}" in the else clause is intentional.

In this case, we've already confirmed that env.target_version exists (since we're in the else block of if [[ -z "${{ env.target_version }}" ]]), so we should use the provided version directly rather than pulling from the source stage. This is done to make sure that when a user explicitly provides a version, we respect that choice instead of overwriting it with a version from another environment.

The original code would ignore the user-provided version and always pull from the source stage, which defeats the purpose of allowing version specification through the input variable.

This change allows for two clear paths:

  1. No version provided -> derive from source stage.
  2. Version provided -> use that version directly.

I've also made this diagram to help visually understand the logic:

Screenshot 2025-01-21 at 2 04 30 PM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, so, the existing code was broke, lovely. Thanks for fixing it.

@soufianerafik soufianerafik requested a review from goulter January 21, 2025 21:25
@soufianerafik soufianerafik linked an issue Jan 21, 2025 that may be closed by this pull request
@soufianerafik soufianerafik merged commit 2a9e35e into main Jan 21, 2025
5 checks passed
@soufianerafik soufianerafik deleted the GH-171 branch January 21, 2025 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-guidance:no-bump Use this when you don't want the version to change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update deploy.yml to Use Microsoft Teams Instead of Slack
2 participants