-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 🐛 Fix incorrect module path for update user roles (#51) * 🚑 Update User Roles: Use sync search and add summary (#52) * 🚑 Use sync search and add summary for searches and actions * Formatted code with black --line-length 120 --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Better summary for update user roles job (#53) * 🚑 Use sync search and add summary for searches and actions * Formatted code with black --line-length 120 * better debugging --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Update user.py * 🚑 Correct logic for matched user sets + role filtering (#55) * 🚑 correct logic for matched user sets + role filtering * Formatted code with black --line-length 120 * Update role filter logic in user.py --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Fix update user role cmd (#56) * 🚑 correct logic for matched user sets + role filtering * Formatted code with black --line-length 120 * Update role filter logic in user.py * Formatted code with black --line-length 120 * aliasing * Update user.py --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Fix update user role cmd (#57) * 🚑 correct logic for matched user sets + role filtering * Formatted code with black --line-length 120 * Update role filter logic in user.py * Formatted code with black --line-length 120 * aliasing * Update user.py * Update user.py * Formatted code with black --line-length 120 --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * ✨ Use paged search to support larger data sets (#58) * 🚑 correct logic for matched user sets + role filtering * Formatted code with black --line-length 120 * Update role filter logic in user.py * Formatted code with black --line-length 120 * aliasing * Update user.py * Update user.py * Formatted code with black --line-length 120 * implement paging because we love ldap ❤️ * remove test case + add var for page size * Formatted code with black --line-length 120 --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Bump setuptools from 71.1.0 to 72.0.0 (#60) Bumps [setuptools](https://github.com/pypa/setuptools) from 71.1.0 to 72.0.0. - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](pypa/setuptools@v71.1.0...v72.0.0) --- updated-dependencies: - dependency-name: setuptools dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * 🐛 Fix error handling for policy/role recreation (#65) * 🐛 error handling for policy/role recreation * 🎨 formatting * ♻️ Add image build (#66) * 🎨 formatting * 🔧 Implement Ruff as required check instead of Black creating a commit re-formatting code (#73) * 🔧 Implement Ruff as check instead of Black creating a commit * Update python-checks.yml --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
191ef62
commit 653bfa7
Showing
12 changed files
with
395 additions
and
123 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: "Image Build" | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
run-name: "Image Build for tag ${{ github.ref_name }}" | ||
|
||
permissions: | ||
packages: write | ||
contents: write | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Create safe tag for image | ||
id: safe_tag | ||
run: | | ||
echo "SAFE_TAG=$(echo ${{ github.ref_name }} | sed 's/[^a-zA-Z0-9.]/-/g')" >> $GITHUB_OUTPUT | ||
- name: Set up Docker Buildx | ||
id: setup_buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log into ghcr | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push to ghcr | ||
id: build_publish | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
platforms: linux/amd64, linux/arm64 | ||
push: true | ||
tags: ghcr.io/ministryofjustice/hmpps-ldap-automation:${{ steps.safe_tag.outputs.SAFE_TAG }} | ||
build-args: | | ||
VERSION_REF=${{ steps.BumpVersionAndPushTag.outputs.new_tag }} | ||
- name: Slack failure notification | ||
if: ${{ failure() }} | ||
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0 | ||
with: | ||
payload: | | ||
{"blocks":[{"type": "section","text": {"type": "mrkdwn","text": ":no_entry: Failed GitHub Action:"}},{"type": "section","fields":[{"type": "mrkdwn","text": "*Workflow:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>"},{"type": "mrkdwn","text": "*Job:*\n${{ github.job }}"},{"type": "mrkdwn","text": "*Repo:*\n${{ github.repository }}"}]}]} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.PWO_PUBLIC_SLACK_WEBHOOK_URL }} | ||
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Ensure formatted code | ||
on: | ||
pull_request: | ||
types: [ opened, edited, reopened, synchronize, ready_for_review ] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
jobs: | ||
format_check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install ruff | ||
run: pip install ruff | ||
- name: Check formatting for Python code | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
set +e | ||
output=$(ruff format --check) | ||
exit_code=$? | ||
if [ $exit_code -eq 0 ]; then | ||
echo "All Python code is properly formatted." | ||
gh pr comment ${{ github.event.pull_request.number }} --body ":white_check_mark: All Python code is properly formatted." | ||
else | ||
echo "$output" | ||
echo "<details><summary>:rotating_light: Python code is not properly formatted. Click to expand.</summary>" > output.txt | ||
echo "" >> output.txt | ||
echo '```' >> output.txt | ||
echo "$output" >> output.txt | ||
echo '```' >> output.txt | ||
echo "" >> output.txt | ||
echo '</details>' >> output.txt | ||
echo "" >> output.txt | ||
echo 'Please run `ruff format` to format the code.' >> output.txt | ||
gh pr comment ${{ github.event.pull_request.number }} --body-file output.txt | ||
exit 1 | ||
fi | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install ruff | ||
run: pip install ruff | ||
- name: Lint Python code | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
set +e | ||
output=$(ruff check) | ||
exit_code=$? | ||
if [ $exit_code -eq 0 ]; then | ||
echo "No linting errors found." | ||
gh pr comment ${{ github.event.pull_request.number }} --body ":white_check_mark: No linting errors found in Python code." | ||
else | ||
echo "$output" | ||
echo "<details><summary>:rotating_light: Linting errors found in Python code. Click to expand.</summary>" > output.txt | ||
echo "" >> output.txt | ||
echo '```' >> output.txt | ||
echo "$output" >> output.txt | ||
echo '```' >> output.txt | ||
echo "" >> output.txt | ||
echo '</details>' >> output.txt | ||
echo "" >> output.txt | ||
echo 'Tip: You can run `ruff check --fix` to fix automatically fixable errors.' >> output.txt | ||
gh pr comment ${{ github.event.pull_request.number }} --body-file output.txt | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM python:3.10-alpine | ||
|
||
LABEL org.opencontainers.image.source = "https://github.com/ministryofjustice/hmpps-ldap-automation-cli" | ||
|
||
ARG VERSION_REF=main | ||
|
||
# Basic tools for now | ||
RUN apk add --update --no-cache bash ca-certificates git build-base libffi-dev openssl-dev gcc musl-dev gcc g++ linux-headers build-base openldap-dev python3-dev | ||
|
||
RUN python3 -m pip install --upgrade pip && python3 -m pip install git+https://github.com/ministryofjustice/hmpps-ldap-automation-cli.git@${VERSION_REF} | ||
|
||
CMD ["ldap-automation"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.