Skip to content

Commit

Permalink
Merge pull request #5193 from opsmill/bab-merge-stable-into-1.1
Browse files Browse the repository at this point in the history
Merge stable into branch release-1.1
  • Loading branch information
dgarros authored Dec 12, 2024
2 parents 5f62aeb + 2f96f31 commit 636f64e
Show file tree
Hide file tree
Showing 177 changed files with 6,221 additions and 4,199 deletions.
9 changes: 8 additions & 1 deletion .github/file-filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ doc_files: &doc_files
- package.json
- package-lock.json

release_files: &release_files
- "changelog/*.md"
- CHANGELOG.md
- "docs/docs/release_notes/infrahub/*.mdx"

helm_files: &helm_files
- "helm/**"

Expand All @@ -49,7 +54,6 @@ yaml_all: &yaml_all
markdown_all: &markdown_all
- "**/*.{md,mdx}"


backend_all:
- *backend_files
- *ci_config
Expand All @@ -62,6 +66,9 @@ documentation_all:
- *doc_files
- *markdown_all

release_all:
- *release_files

helm_all:
- *helm_files

Expand Down
47 changes: 37 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
outputs:
backend: ${{ steps.changes.outputs.backend_all }}
documentation: ${{ steps.changes.outputs.documentation_all }}
release: ${{ steps.changes.outputs.release_all }}
frontend: ${{ steps.changes.outputs.frontend_all }}
helm: ${{ steps.changes.outputs.helm_all }}
e2e: ${{ steps.changes.outputs.e2e_all }}
Expand Down Expand Up @@ -124,7 +125,9 @@ jobs:
run: "ruff format --check --diff --exclude python_sdk ."

markdown-lint:
if: needs.files-changed.outputs.documentation == 'true'
if: |
needs.files-changed.outputs.documentation == 'true' ||
needs.files-changed.outputs.release == 'true'
needs: ["files-changed"]
runs-on: "ubuntu-latest"
timeout-minutes: 5
Expand All @@ -139,7 +142,6 @@ jobs:
config: .markdownlint.yaml
globs: |
**/*.{md,mdx}
!changelog/*.md
action-lint:
if: needs.files-changed.outputs.github_workflows == 'true'
Expand Down Expand Up @@ -200,7 +202,7 @@ jobs:
# with:
# submodules: true
# - name: "Install Invoke"
# run: "pip install toml invoke"
# run: "pip install invoke toml"

# - name: "Set environment variables"
# run: echo INFRAHUB_BUILD_NAME=infrahub-${{ runner.name }} >> $GITHUB_ENV
Expand Down Expand Up @@ -529,7 +531,7 @@ jobs:
- name: "Install dependencies"
run: npm install
- name: "Setup Python environment"
run: "pip install toml invoke"
run: "pip install invoke toml"
- name: "Build website"
run: "invoke docs.build"

Expand Down Expand Up @@ -568,7 +570,7 @@ jobs:
always() && !cancelled() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled') &&
needs.files-changed.outputs.documentation == 'true'
needs.files-changed.outputs.release == 'true'
needs: ["files-changed", "yaml-lint", "python-lint"]
runs-on: "ubuntu-22.04"
timeout-minutes: 5
Expand All @@ -586,7 +588,32 @@ jobs:
env:
VALE_VERSION: ${{ env.VALE_VERSION }}
- name: "Validate documentation style"
run: ./vale $(find . -type f \( -name "*.mdx" -o -name "*.md" \) -not -path "./docs/node_modules/*")
run: ./vale $(find ./docs -type f \( -name "*.mdx" -o -name "*.md" \) -not -path "./docs/node_modules/*")

validate-release-notes-style:
if: |
always() && !cancelled() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled') &&
needs.files-changed.outputs.release == 'true'
needs: ["files-changed", "yaml-lint", "python-lint"]
runs-on: "ubuntu-22.04"
timeout-minutes: 5
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
with:
submodules: true
# The official GitHub Action for Vale doesn't work, installing manually instead:
# https://github.com/errata-ai/vale-action/issues/103
- name: Download Vale
run: |
curl -sL "https://github.com/errata-ai/vale/releases/download/v${VALE_VERSION}/vale_${VALE_VERSION}_Linux_64-bit.tar.gz" -o vale.tar.gz
tar -xzf vale.tar.gz
env:
VALE_VERSION: ${{ env.VALE_VERSION }}
- name: "Validate release notes style"
run: ./vale $(find ./changelog ./docs/docs/release-notes/infrahub -type f \( -name '*.mdx' -o -name '*.md' \)) CHANGELOG.md

# ------------------------------------------ E2E Tests ------------------------------------------
E2E-testing-playwright:
Expand Down Expand Up @@ -636,7 +663,7 @@ jobs:
cache-dependency-path: frontend/app/package-lock.json

- name: Install Invoke
run: pip install toml invoke
run: pip install invoke toml

- name: Set job name
run: echo JOB_NAME="$GITHUB_JOB" >> $GITHUB_ENV
Expand Down Expand Up @@ -707,9 +734,9 @@ jobs:

- name: Add response delay if required
if: needs.files-changed.outputs.e2e_tests == 'true'
run: echo "INFRAHUB_MISC_RESPONSE_DELAY=1" >> $GITHUB_ENV && invoke dev.start
run: echo "INFRAHUB_MISC_RESPONSE_DELAY=0" >> $GITHUB_ENV && invoke dev.start
env:
INFRAHUB_MISC_RESPONSE_DELAY: 1
INFRAHUB_MISC_RESPONSE_DELAY: 0

- name: Set infrahub address
if: needs.files-changed.outputs.e2e_tests == 'true'
Expand Down Expand Up @@ -807,7 +834,7 @@ jobs:

- name: Install Invoke
run: |
pip install toml invoke
pip install invoke toml
- name: Set job name
run: echo JOB_NAME="$GITHUB_JOB" >> $GITHUB_ENV
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/publish-helm-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ jobs:
- name: Install Helm
uses: azure/[email protected]

- name: Install Helm Push Plugin
run: helm plugin install https://github.com/chartmuseum/helm-push

- name: Determine Chart Version
id: version
run: |
Expand All @@ -61,9 +58,6 @@ jobs:
--username '${{ secrets.HARBOR_USERNAME }}'
--password '${{ secrets.HARBOR_PASSWORD }}'
- name: Add Helm repository
run: helm repo add opsmill https://${{ vars.HARBOR_HOST }}/chartrepo/opsmill

- name: Package Helm Chart
run: |
helm package --dependency-update ./helm --version ${{ steps.version.outputs.version }}
Expand All @@ -73,12 +67,5 @@ jobs:
run: |
helm push infrahub-${{ steps.version.outputs.version }}.tgz oci://${{ vars.HARBOR_HOST }}/opsmill/chart
- name: Push Helm Chart to traditional repository
if: ${{ inputs.publish }}
run: >
helm cm-push -f infrahub-${{ steps.version.outputs.version }}.tgz opsmill
--username '${{ secrets.HARBOR_USERNAME }}'
--password '${{ secrets.HARBOR_PASSWORD }}'
- name: Cleanup
run: rm -f infrahub-${{ steps.version.outputs.version }}.tgz
14 changes: 13 additions & 1 deletion .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
name: Publish Infrahub-Server Package

on:
workflow_dispatch:
inputs:
runs-on:
description: "The OS to run the job on"
required: false
default: "ubuntu-22.04"
type: string
publish:
type: boolean
description: Whether to publish the package to Pypi
required: false
default: false
workflow_call:
inputs:
runs-on:
Expand All @@ -12,7 +24,7 @@ on:
type: string
publish:
type: boolean
description: Wether to publish the package to Pypi
description: Whether to publish the package to Pypi
required: false
default: false

Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,10 @@ jobs:
secrets: inherit
with:
publish: true

update-submodule:
needs: check_release
uses: ./.github/workflows/update-submodule.yml
secrets: inherit
with:
version: ${{ github.ref_name }}
71 changes: 71 additions & 0 deletions .github/workflows/trigger-submodule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
# yamllint disable rule:truthy rule:line-length
name: Handle Submodule Trigger

on:
repository_dispatch:
types:
- trigger-submodule-update

jobs:
update-dependencies:
strategy:
matrix:
branch-name:
- stable
- develop
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: "${{ matrix.branch-name }}"
submodules: recursive

- name: Set branch name
id: set-branch-name
run: |
SUBMODULE_PATH="python_sdk"
SDK_VERSION="${{ github.event.client_payload.version }}"
BRANCH_NAME="${{ matrix.branch-name}}-${SUBMODULE_PATH}-${SDK_VERSION}"
echo "SUBMODULE_PATH=$SUBMODULE_PATH" >> $GITHUB_ENV
echo "SDK_VERSION=$SDK_VERSION" >> $GITHUB_ENV
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
- name: Use the version from the client payload to update the submodule
run: |
echo "Updating submodule to version: ${{ env.SDK_VERSION }}"
echo "Branch name: ${{ env.BRANCH_NAME }}"
# Navigate to the submodule and update it to the specified version
cd ${{ env.SUBMODULE_PATH }}
git fetch --tags
git checkout ${{ env.SDK_VERSION }}
cd -
- name: Prepare the branch for the update
id: prepare-branch
run: |
echo "Checking if branch ${{ env.BRANCH_NAME }} exists..."
BRANCH_EXISTS=$(git ls-remote --heads origin ${{ env.BRANCH_NAME }} | wc -l)
echo "BRANCH_EXISTS=$BRANCH_EXISTS" >> $GITHUB_ENV
- name: Commit and push changes with github-actions-x/commit
uses: github-actions-x/[email protected]
with:
github-token: ${{ secrets.GH_UPDATE_PACKAGE_OTTO }}
push-branch: ${{ env.BRANCH_NAME }}
commit-message: "chore: update submodule ${{ env.SUBMODULE_PATH }} to version ${{ env.SDK_VERSION }}"
files: ${{ env.SUBMODULE_PATH }}/
name: opsmill-bot
email: [email protected]
rebase: ${{ env.BRANCH_EXISTS == 1 }}

- name: Create a pull request
run: |
echo ${{ secrets.GH_UPDATE_PACKAGE_OTTO }} | gh auth login --with-token
gh pr create \
--title "Update ${{ env.SUBMODULE_PATH }} to version ${{ env.SDK_VERSION }} against ${{ matrix.branch-name}}" \
--body "This PR updates the submodule ${{ env.SUBMODULE_PATH }} to version ${{ env.SDK_VERSION }}." \
--base ${{ matrix.branch-name}} \
--head ${{ env.BRANCH_NAME }}
6 changes: 3 additions & 3 deletions .github/workflows/update-compose-file-and-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ jobs:
run: "poetry install --all-extras"

- name: "Update Docker Env variable in docker-compose.yml file"
run: "poetry run invoke dev.gen-config-env -u"
run: "poetry run invoke release.gen-config-env -u"
- name: "Update Infrahub Image Version in docker-compose.yml file"
run: "poetry run invoke dev.update-docker-compose"
run: "poetry run invoke release.update-docker-compose"
- name: "Update AppVersion in helm/chart.yaml file"
run: "poetry run invoke dev.update-helm-chart"
run: "poetry run invoke release.update-helm-chart"
- name: Commit docker-compose.yml and helm
uses: github-actions-x/[email protected]
with:
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/update-submodule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
# yamllint disable rule:truthy rule:line-length
name: Trigger Submodule update

on:
workflow_dispatch:
inputs:
runs-on:
description: "The OS to run the job on"
required: false
default: "ubuntu-22.04"
type: string
version:
type: string
required: false
description: The string to extract semver from.
default: ''
workflow_call:
inputs:
runs-on:
description: "The OS to run the job on"
required: false
default: "ubuntu-22.04"
type: string
version:
type: string
required: false
description: The string to extract semver from.
default: ''

jobs:
trigger-submodule:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Trigger submodule update
run: |
curl -X POST \
-H 'Authorization: token ${{ secrets.GH_UPDATE_PACKAGE_OTTO }}' \
-H 'Accept: application/vnd.github.v3+json' \
'https://api.github.com/repos/${{ secrets.INFRAHUB_ENTERPRISE_REPOSITORY }}/dispatches' \
-d '{"event_type":"trigger-submodule-update","client_payload":{"version":"${{ inputs.version }}"}}'
3 changes: 3 additions & 0 deletions .vale.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ BasedOnStyles = Infrahub
;(import.*?\n) to ignore import statement in .mdx
;(```.*?```\n) to ignore code block in .mdx
BlockIgnores = (?s) *((import.*?\n)|(```.*?```\n))

[*]
BasedOnStyles = Infrahub
5 changes: 5 additions & 0 deletions .vale/styles/spelling-exceptions.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
agent
Alibaba
Ansible
append_git_suffix
APIs
artifact_definitions
artifact_name
Expand All @@ -12,6 +13,7 @@ class_name
CloudFormation
codespace
codespaces
combobox
config
Config
content_type
Expand Down Expand Up @@ -106,13 +108,16 @@ subnet
template_path
toml
Towncrier
towncrier
uncheck
uniqueness_constraints
userinfo
validator
upsert
Upserting
upserting
uuid
UUID
validators
Version Control
Vitest
Expand Down
Loading

0 comments on commit 636f64e

Please sign in to comment.