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

Adds Slack notifications about releases, upgrades to nextmv-py v0.11.1 #77

Merged
merged 5 commits into from
Sep 23, 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
7 changes: 6 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,14 @@ jobs:
if: ${{ env.APPS != '' }}
run: |
export PATH=$PATH:~/.nextmv # Make CLI available in non-interactive shell
export SLACK_NOTIFY_PARAM="" # Only notify slack for prod releases
if [ ${{ matrix.environment }} == "prod" ]; then
export SLACK_NOTIFY_PARAM="--slack-url \"${{ secrets.SLACK_URL_MISSION_CONTROL }}\""
fi
python main.py \
--apps "${{ env.APPS }}" \
--bucket "${{ env.BUCKET }}" \
--folder "${{ env.FOLDER }}" \
--manifest "${{ env.MANIFEST }}"
--manifest "${{ env.MANIFEST }}" \
$SLACK_NOTIFY_PARAM
working-directory: ./community-apps/.nextmv/release
26 changes: 26 additions & 0 deletions .nextmv/release/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from datetime import datetime

import nextmv
import requests
from boto3 import client as s3Client
from log import log
from manifest import Manifest
Expand All @@ -20,6 +21,7 @@ def main():
nextmv.Parameter("bucket", str, description="S3 bucket.", required=True),
nextmv.Parameter("folder", str, description="S3 bucket folder.", required=True),
nextmv.Parameter("manifest", str, description="Manifest file.", required=True),
nextmv.Parameter("slack-url", str, description="Slack webhook URL.", default=None),
)

apps = [
Expand Down Expand Up @@ -84,6 +86,14 @@ def main():
workflow_app=workflow_app,
)

if options.slack_url is not None:
notify_slack(
url=options.slack_url,
app=name,
version=new_app_version,
marketplace_version=new_marketplace_version,
)

manifest.upload(
client=client,
bucket=options.bucket,
Expand Down Expand Up @@ -241,5 +251,21 @@ def bump_marketplace_version(
return f"v{major}.{minor}.{patch}"


def notify_slack(url: str, app: str, version: str, marketplace_version: str) -> None:
"""
Notify Slack channel about release.
"""

response = requests.post(
url,
json={
"text": f"Release notification - community-apps/{app} {version} / marketplace {marketplace_version}",
Copy link
Member

Choose a reason for hiding this comment

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

I think we should either only notify for prod or log the environment that is being released in here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, totally. I somehow missed the distinction here. The parameter is optional, so, I will simply drop it in the workflow if not targeting prod. ☺️

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for noticing! 🤗

},
)

if response.status_code != 200:
log(f"Failed to send notification to Slack: {response.text}")


if __name__ == "__main__":
main()
3 changes: 2 additions & 1 deletion .nextmv/release/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
boto3>=1.34.33
pyyaml>=6.0.1
ruff>=0.1.7
nextmv==v0.11.0
requests>=2.26.0
nextmv==0.11.1
2 changes: 1 addition & 1 deletion python-ampl-facilitylocation/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ ampl-module-open==20240121
ampl-module-scip==20240121
ampl-module-xpress==20240115

nextmv==v0.11.0
nextmv==0.11.1
pandas==2.2.2
2 changes: 1 addition & 1 deletion python-ampl-knapsack/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ ampl-module-open==20240121
ampl-module-scip==20240121
ampl-module-xpress==20240115

nextmv==v0.11.0
nextmv==0.11.1

2 changes: 1 addition & 1 deletion python-ampl-priceoptimization/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ ampl-module-open==20240121
ampl-module-scip==20240121
ampl-module-xpress==20240115

nextmv==v0.11.0
nextmv==0.11.1

2 changes: 1 addition & 1 deletion python-gurobi-knapsack/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
gurobipy==11.0.0
nextmv==v0.11.0
nextmv==0.11.1

2 changes: 1 addition & 1 deletion python-hello-world/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Define the packages required by your project here.
nextmv==v0.11.0
nextmv==0.11.1
2 changes: 1 addition & 1 deletion python-highs-knapsack/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
highspy==1.7.2
nextmv==v0.11.0
nextmv==0.11.1
2 changes: 1 addition & 1 deletion python-ortools-costflow/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ortools==9.8.3296
nextmv==v0.11.0
nextmv==0.11.1
2 changes: 1 addition & 1 deletion python-ortools-demandforecasting/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ortools==9.8.3296
nextmv==v0.11.0
nextmv==0.11.1
2 changes: 1 addition & 1 deletion python-ortools-knapsack-multicsv/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ortools==9.8.3296
nextmv==v0.11.0
nextmv==0.11.1
2 changes: 1 addition & 1 deletion python-ortools-knapsack/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ortools==9.8.3296
nextmv==v0.11.0
nextmv==0.11.1
2 changes: 1 addition & 1 deletion python-ortools-routing/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ortools==9.8.3296
nextmv==v0.11.0
nextmv==0.11.1
2 changes: 1 addition & 1 deletion python-ortools-shiftassignment/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ortools==9.8.3296
nextmv==v0.11.0
nextmv==0.11.1
2 changes: 1 addition & 1 deletion python-ortools-shiftplanning/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ortools==9.8.3296
nextmv==v0.11.0
nextmv==0.11.1
2 changes: 1 addition & 1 deletion python-pyomo-knapsack/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pyomo==6.7.2
nextmv==v0.11.0
nextmv==0.11.1
2 changes: 1 addition & 1 deletion python-pyomo-shiftassignment/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pyomo==6.7.2
nextmv==v0.11.0
nextmv==0.11.1
2 changes: 1 addition & 1 deletion python-pyomo-shiftplanning/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pyomo==6.7.2
nextmv==v0.11.0
nextmv==0.11.1
2 changes: 1 addition & 1 deletion python-pyoptinterface-knapsack/requirements-arm64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ highsbox==1.7.2.post2
https://merschformann.github.io/random/content/wheels/pyoptinterface/pyoptinterface-0.2.8-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

# Other packages.
nextmv==v0.11.0
nextmv==0.11.1
2 changes: 1 addition & 1 deletion python-pyoptinterface-knapsack/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
pyoptinterface[highs]==0.2.8

# Other packages.
nextmv==v0.11.0
nextmv==0.11.1
2 changes: 1 addition & 1 deletion python-pyvroom-routing/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pyvroom==1.13.6
nextmv==v0.11.0
nextmv==0.11.1
2 changes: 1 addition & 1 deletion python-xpress-knapsack/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
xpress==9.4.2; platform_system != 'Darwin' or (platform_system == 'Darwin' and platform_machine != 'arm64')
nextmv==v0.11.0
nextmv==0.11.1

Loading