From b05e8fcae999abc8ad2b18dc58a0b15ddb10d4eb Mon Sep 17 00:00:00 2001 From: Juan Mrad Date: Tue, 1 Oct 2024 03:26:51 -0500 Subject: [PATCH 1/5] [hma] Update CONTRIBUTING.md to include release instructions (#1631) Add release instructions to contributing doc to explain how to release a new version of the project --- hasher-matcher-actioner/CONTRIBUTING.md | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/hasher-matcher-actioner/CONTRIBUTING.md b/hasher-matcher-actioner/CONTRIBUTING.md index bc5d2d121..db758ba07 100644 --- a/hasher-matcher-actioner/CONTRIBUTING.md +++ b/hasher-matcher-actioner/CONTRIBUTING.md @@ -13,6 +13,33 @@ Open Media Match is written in Python, uses [Flask](https://flask.palletsproject Please see CONTRIBUTING in the repo root for more general guidelines on how to contribute by developing locally and submitting pull requests on GitHub. +# Releasing a New Version + +To release a new version of the Open Media Match image, follow these steps: + +1. **Update the version.txt file** + +The version number is stored in the `version.txt` file located at the project subfolder. Modify this file to reflect the new version number (e.g., `v1.1.0`). + +```bash +echo "v1.1.0" > version.txt +``` + +2. **Merge to main** +Once the `version.txt` file is updated, and merged to main a new build will be triggered automatically via the CI/CD pipeline. This will create a new Docker image with the updated version and be pushed to the registry. + +3. **Verify the Build and Release** +Monitor the build process to ensure everything runs smoothly. Once the build completes, the new Docker image will be tagged with the updated version and pushed to the registry. + +4. **Test the New Image** +After the new image is successfully built and tagged, it can be tested locally by using the tagged image or deployed to your environment. This process may vary depending on your deployment setup (e.g., Kubernetes, Docker Swarm, etc.). + +**Notes:** +- Do the version increase on its own PR to separate version releases from code changes. +- Ensure any expected changes in the codebase are included in the release, and all tests are passing before modifying the `version.txt` file. +- For breaking changes, consider incrementing the major version number (e.g., `v2.0.0`). + + # Developer onboarding and environment setup There are a few different ways you can set up a development instance of Open Media Match and get to work. From 57bd1a2ea01255a7e4cb63d45a6ea3fe061eb6f8 Mon Sep 17 00:00:00 2001 From: Juan Mrad Date: Wed, 2 Oct 2024 11:54:38 +0100 Subject: [PATCH 2/5] Update Platforms for Release of Docker image We want to update the platforms on release image to ensure we have the correct ones. --- .github/workflows/hma-release.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/hma-release.yaml b/.github/workflows/hma-release.yaml index 7b0e1030c..fb4b8bbae 100644 --- a/.github/workflows/hma-release.yaml +++ b/.github/workflows/hma-release.yaml @@ -55,6 +55,7 @@ jobs: push: true provenance: false context: hasher-matcher-actioner + platforms: linux/amd64,linux/arm64 tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}/hma:latest ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}/hma:${{ env.VERSION }} From a568cb272c7df4a53b689a98764934dd27ce2e11 Mon Sep 17 00:00:00 2001 From: Juan Mrad Date: Wed, 2 Oct 2024 11:55:30 +0100 Subject: [PATCH 3/5] Update version.txt --- hasher-matcher-actioner/version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hasher-matcher-actioner/version.txt b/hasher-matcher-actioner/version.txt index 90a27f9ce..af0b7ddbf 100644 --- a/hasher-matcher-actioner/version.txt +++ b/hasher-matcher-actioner/version.txt @@ -1 +1 @@ -1.0.5 +1.0.6 From a482716fcc043d57828703dc2d8603f59f27369d Mon Sep 17 00:00:00 2001 From: Doug Neal Date: Wed, 2 Oct 2024 14:38:21 +0100 Subject: [PATCH 4/5] [hma] Install extensions in devcontainer --- .../.devcontainer/devcontainer.json | 2 +- hasher-matcher-actioner/.devcontainer/postcreate.sh | 11 +++++++++++ hasher-matcher-actioner/extensions/.gitignore | 1 + hasher-matcher-actioner/extensions/README.md | 3 +++ 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100755 hasher-matcher-actioner/.devcontainer/postcreate.sh create mode 100644 hasher-matcher-actioner/extensions/.gitignore create mode 100644 hasher-matcher-actioner/extensions/README.md diff --git a/hasher-matcher-actioner/.devcontainer/devcontainer.json b/hasher-matcher-actioner/.devcontainer/devcontainer.json index cfede72ec..635a8172a 100644 --- a/hasher-matcher-actioner/.devcontainer/devcontainer.json +++ b/hasher-matcher-actioner/.devcontainer/devcontainer.json @@ -43,10 +43,10 @@ } }, "remoteUser": "vscode", - "postCreateCommand": "pip install --editable .[all]", "mounts": [ "source=python-threatexchange-cmdhistory,target=/commandhistory,type=volume", "source=${localEnv:HOME}${localEnv:USERPROFILE},target=/host-home-folder,type=bind,consistency=cached" ], + "postCreateCommand": "/workspace/.devcontainer/postcreate.sh", "postAttachCommand": "/workspace/.devcontainer/startup.sh" } \ No newline at end of file diff --git a/hasher-matcher-actioner/.devcontainer/postcreate.sh b/hasher-matcher-actioner/.devcontainer/postcreate.sh new file mode 100755 index 000000000..ad6b20069 --- /dev/null +++ b/hasher-matcher-actioner/.devcontainer/postcreate.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +pip install --editable .[all] + +# Find Python packages in opt and install them +for setup_script in "$(find /workspace/opt -name setup.py)" +do + module_dir="$(dirname "$setup_script")" + pip install --editable "$module_dir" +done diff --git a/hasher-matcher-actioner/extensions/.gitignore b/hasher-matcher-actioner/extensions/.gitignore new file mode 100644 index 000000000..72e8ffc0d --- /dev/null +++ b/hasher-matcher-actioner/extensions/.gitignore @@ -0,0 +1 @@ +* diff --git a/hasher-matcher-actioner/extensions/README.md b/hasher-matcher-actioner/extensions/README.md new file mode 100644 index 000000000..533f7a452 --- /dev/null +++ b/hasher-matcher-actioner/extensions/README.md @@ -0,0 +1,3 @@ +# Optional Packages + +Drop any Python packages here which you need to be installed to the container but which can not be added to the `pyproject.toml`, e.g. proprietary extensions. From 0f1cc504d103294957a7ac0d6befcdc888cfe87f Mon Sep 17 00:00:00 2001 From: Doug Neal Date: Wed, 2 Oct 2024 16:49:35 +0100 Subject: [PATCH 5/5] [hma] automatically install available extensions in dev container --- hasher-matcher-actioner/.devcontainer/postcreate.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hasher-matcher-actioner/.devcontainer/postcreate.sh b/hasher-matcher-actioner/.devcontainer/postcreate.sh index ad6b20069..25db67b42 100755 --- a/hasher-matcher-actioner/.devcontainer/postcreate.sh +++ b/hasher-matcher-actioner/.devcontainer/postcreate.sh @@ -4,8 +4,12 @@ set -e pip install --editable .[all] # Find Python packages in opt and install them -for setup_script in "$(find /workspace/opt -name setup.py)" +for setup_script in "$(find /workspace/extensions -name setup.py)" do module_dir="$(dirname "$setup_script")" pip install --editable "$module_dir" + for extension in "$(echo "import setuptools; [ print (p) for p in setuptools.find_packages('${module_dir}') ]" | python)" + do + threatexchange config extensions add "$extension" + done done