Skip to content

Commit

Permalink
chore: add dmt
Browse files Browse the repository at this point in the history
Signed-off-by: Kirill Kramorov <kirill.kramorov@flant.com>
  • Loading branch information
Kirill Kramorov committed Dec 19, 2024
1 parent 4248d9f commit 0b15efd
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 220 deletions.
4 changes: 2 additions & 2 deletions .github/workflow_templates/build-and-test_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ jobs:
- pull_request_info
{!{ tmpl.Exec "tests_webhooks_template" (slice $ctx) | strings.Indent 4 }!}

tests_python_webhooks:
tests_dmt_lint:
if: ${{ needs.pull_request_info.outputs.changes_not_markdown == 'true' }}
name: Tests python webhooks
name: Tests DMT lint
needs:
- git_info
- pull_request_info
Expand Down
4 changes: 2 additions & 2 deletions .github/workflow_templates/build-and-test_pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ jobs:
- git_info
{!{ tmpl.Exec "tests_webhooks_template" (slice $ctx) | strings.Indent 4 }!}

tests_python_webhooks:
tests_dmt_lint:
if: ${{ needs.pull_request_info.outputs.changes_not_markdown == 'true' }}
name: Tests python webhooks
name: Tests DMT lint
needs:
- git_info
{!{ tmpl.Exec "tests_dmt_lint" (slice $ctx) | strings.Indent 4 }!}
Expand Down
13 changes: 2 additions & 11 deletions .github/workflow_templates/build-and-test_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,11 @@ jobs:
{!{ tmpl.Exec "update_comment_on_finish" (slice "job,one-line" $jobNames.tests_python_webhooks) | strings.Indent 6 }!}

{!{ $jobNames = coll.Merge $jobNames (dict "tests_dmt_lint" "DMT lint") }!}
tests_python_webhooks:
tests_dmt_lint:
name: {!{ $jobNames.tests_dmt_lint }!}
needs:
- git_info
{!{ tmpl.Exec "tests_webhooks_template" (slice $ctx) | strings.Indent 4 }!}
{!{ tmpl.Exec "tests_dmt_lint" (slice $ctx) | strings.Indent 4 }!}
{!{ tmpl.Exec "update_comment_on_finish" (slice "job,one-line" $jobNames.tests_dmt_lint) | strings.Indent 6 }!}

{!{ $jobNames = coll.Merge $jobNames (dict "matrix_tests" "Matrix tests") }!}
Expand All @@ -250,15 +250,6 @@ tests_python_webhooks:
{!{ tmpl.Exec "tests_before_build_template" (slice $ctx "matrix") | strings.Indent 4 }!}
{!{ tmpl.Exec "update_comment_on_finish" (slice "job,one-line" $jobNames.matrix_tests) | strings.Indent 6 }!}

{!{ $jobNames = coll.Merge $jobNames (dict "dmt_lint" "DMT Lint") }!}
dmt_lint:
if: ${{ needs.pull_request_info.outputs.changes_not_markdown == 'true' }}
name: DMT Lint
needs:
- git_info
{!{ tmpl.Exec "tests_before_build_template" (slice $ctx "dmtlint") | strings.Indent 4 }!}
{!{ tmpl.Exec "update_comment_on_finish" (slice "job,one-line" $jobNames.matrix_tests) | strings.Indent 6 }!}

{!{ $jobNames = coll.Merge $jobNames (dict "dhctl_tests" "Dhctl Tests") }!}
dhctl_tests:
name: {!{ $jobNames.dhctl_tests }!}
Expand Down
81 changes: 13 additions & 68 deletions .github/workflows/build-and-test_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1065,14 +1065,14 @@ jobs:
make tests-webhooks
# </template: tests_webhooks_template>

matrix_tests:
tests_dmt_lint:
if: ${{ needs.pull_request_info.outputs.changes_not_markdown == 'true' }}
name: Matrix tests
name: Tests DMT lint
needs:
- git_info
- pull_request_info
- git_info
- pull_request_info

# <template: tests_before_build_template>
# <template: tests_dmt_lint>
runs-on: [self-hosted, regular]
steps:

Expand All @@ -1091,72 +1091,17 @@ jobs:
fetch-depth: 0
ref: ${{ needs.pull_request_info.outputs.ref }}
# </template: checkout_full_step>

# <template: login_dev_registry_step>
- name: Check dev registry credentials
id: check_dev_registry
env:
HOST: ${{secrets.DECKHOUSE_DEV_REGISTRY_HOST}}
run: |
if [[ -n $HOST ]]; then
echo "has_credentials=true" >> $GITHUB_OUTPUT
echo "web_registry_path=${{secrets.DECKHOUSE_DEV_REGISTRY_HOST }}/deckhouse/site" >> $GITHUB_OUTPUT
fi
- name: Login to dev registry
uses: docker/login-action@v2.1.0
if: ${{ steps.check_dev_registry.outputs.has_credentials == 'true' }}
with:
registry: ${{ secrets.DECKHOUSE_DEV_REGISTRY_HOST }}
username: ${{ secrets.DECKHOUSE_DEV_REGISTRY_USER }}
password: ${{ secrets.DECKHOUSE_DEV_REGISTRY_PASSWORD }}
logout: false
# </template: login_dev_registry_step>

# <template: login_rw_registry_step>
- name: Check rw registry credentials
id: check_rw_registry
env:
HOST: ${{secrets.DECKHOUSE_REGISTRY_HOST}}
run: |
if [[ -n $HOST ]]; then
echo "has_credentials=true" >> $GITHUB_OUTPUT
echo "web_registry_path=${{secrets.DECKHOUSE_REGISTRY_HOST }}/deckhouse/site" >> $GITHUB_OUTPUT
fi
- name: Login to rw registry
uses: docker/login-action@v2.1.0
if: ${{ steps.check_rw_registry.outputs.has_credentials == 'true' }}
with:
registry: ${{ secrets.DECKHOUSE_REGISTRY_HOST }}
username: ${{ secrets.DECKHOUSE_REGISTRY_USER }}
password: ${{ secrets.DECKHOUSE_REGISTRY_PASSWORD }}
logout: false
- name: Login to Github Container Registry
uses: docker/login-action@v2.1.0
if: ${{ steps.check_rw_registry.outputs.has_credentials != 'true' }}
with:
registry: ghcr.io
username: ${{ secrets.GHCR_IO_REGISTRY_USER }}
password: ${{ secrets.GHCR_IO_REGISTRY_PASSWORD }}
logout: false
# </template: login_rw_registry_step>
- name: Run tests
env:
TESTS_IMAGE_NAME: "registry.deckhouse.io/base_images/golang:1.23.1-bullseye@sha256:a24507d1a36fce86431198a979435dadb187e8d0ce0b5c181f46d6788d84a40f"
- name: DMT lint
run: |
# Print image name in uppercase to prevent hiding non-secret registry host stored in secret.
echo "Tests image name: '${TESTS_IMAGE_NAME}'" | tr '[:lower:]' '[:upper:]'
echo "⚓️ 📥 [$(date -u)] Pull 'tests' image..."
docker pull ${TESTS_IMAGE_NAME}
echo "⚓️ 🏎 [$(date -u)] Run tests..."
docker run -w /deckhouse -v ${{github.workspace}}:/deckhouse -e "TERM=xterm-256color" -v ~/go-pkg-cache:/go/pkg -v ~/deckhouse-bin-cache:/deckhouse/bin ${TESTS_IMAGE_NAME} make tests-matrix
# </template: tests_before_build_template>
make dmt-lint
# </template: tests_dmt_lint>

dmt_lint:
matrix_tests:
if: ${{ needs.pull_request_info.outputs.changes_not_markdown == 'true' }}
name: DMT Lint
name: Matrix tests
needs:
- git_info
- pull_request_info
- git_info
- pull_request_info

# <template: tests_before_build_template>
runs-on: [self-hosted, regular]
Expand Down Expand Up @@ -1234,7 +1179,7 @@ jobs:
echo "⚓️ 📥 [$(date -u)] Pull 'tests' image..."
docker pull ${TESTS_IMAGE_NAME}
echo "⚓️ 🏎 [$(date -u)] Run tests..."
docker run -w /deckhouse -v ${{github.workspace}}:/deckhouse -e "TERM=xterm-256color" -v ~/go-pkg-cache:/go/pkg --user $(id -u):$(id -g) ${TESTS_IMAGE_NAME} make dmt-lint
docker run -w /deckhouse -v ${{github.workspace}}:/deckhouse -e "TERM=xterm-256color" -v ~/go-pkg-cache:/go/pkg -v ~/deckhouse-bin-cache:/deckhouse/bin ${TESTS_IMAGE_NAME} make tests-matrix
# </template: tests_before_build_template>

dhctl_tests:
Expand Down
79 changes: 12 additions & 67 deletions .github/workflows/build-and-test_pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -785,12 +785,13 @@ jobs:
make tests-webhooks
# </template: tests_webhooks_template>

matrix_tests:
name: Matrix tests
tests_dmt_lint:
if: ${{ needs.pull_request_info.outputs.changes_not_markdown == 'true' }}
name: Tests DMT lint
needs:
- git_info
- git_info

# <template: tests_before_build_template>
# <template: tests_dmt_lint>
runs-on: [self-hosted, regular]
steps:

Expand All @@ -808,71 +809,15 @@ jobs:
with:
fetch-depth: 0
# </template: checkout_full_step>

# <template: login_dev_registry_step>
- name: Check dev registry credentials
id: check_dev_registry
env:
HOST: ${{secrets.DECKHOUSE_DEV_REGISTRY_HOST}}
run: |
if [[ -n $HOST ]]; then
echo "has_credentials=true" >> $GITHUB_OUTPUT
echo "web_registry_path=${{secrets.DECKHOUSE_DEV_REGISTRY_HOST }}/deckhouse/site" >> $GITHUB_OUTPUT
fi
- name: Login to dev registry
uses: docker/login-action@v2.1.0
if: ${{ steps.check_dev_registry.outputs.has_credentials == 'true' }}
with:
registry: ${{ secrets.DECKHOUSE_DEV_REGISTRY_HOST }}
username: ${{ secrets.DECKHOUSE_DEV_REGISTRY_USER }}
password: ${{ secrets.DECKHOUSE_DEV_REGISTRY_PASSWORD }}
logout: false
# </template: login_dev_registry_step>

# <template: login_rw_registry_step>
- name: Check rw registry credentials
id: check_rw_registry
env:
HOST: ${{secrets.DECKHOUSE_REGISTRY_HOST}}
run: |
if [[ -n $HOST ]]; then
echo "has_credentials=true" >> $GITHUB_OUTPUT
echo "web_registry_path=${{secrets.DECKHOUSE_REGISTRY_HOST }}/deckhouse/site" >> $GITHUB_OUTPUT
fi
- name: Login to rw registry
uses: docker/login-action@v2.1.0
if: ${{ steps.check_rw_registry.outputs.has_credentials == 'true' }}
with:
registry: ${{ secrets.DECKHOUSE_REGISTRY_HOST }}
username: ${{ secrets.DECKHOUSE_REGISTRY_USER }}
password: ${{ secrets.DECKHOUSE_REGISTRY_PASSWORD }}
logout: false
- name: Login to Github Container Registry
uses: docker/login-action@v2.1.0
if: ${{ steps.check_rw_registry.outputs.has_credentials != 'true' }}
with:
registry: ghcr.io
username: ${{ secrets.GHCR_IO_REGISTRY_USER }}
password: ${{ secrets.GHCR_IO_REGISTRY_PASSWORD }}
logout: false
# </template: login_rw_registry_step>
- name: Run tests
env:
TESTS_IMAGE_NAME: "registry.deckhouse.io/base_images/golang:1.23.1-bullseye@sha256:a24507d1a36fce86431198a979435dadb187e8d0ce0b5c181f46d6788d84a40f"
- name: DMT lint
run: |
# Print image name in uppercase to prevent hiding non-secret registry host stored in secret.
echo "Tests image name: '${TESTS_IMAGE_NAME}'" | tr '[:lower:]' '[:upper:]'
echo "⚓️ 📥 [$(date -u)] Pull 'tests' image..."
docker pull ${TESTS_IMAGE_NAME}
echo "⚓️ 🏎 [$(date -u)] Run tests..."
docker run -w /deckhouse -v ${{github.workspace}}:/deckhouse -e "TERM=xterm-256color" -v ~/go-pkg-cache:/go/pkg -v ~/deckhouse-bin-cache:/deckhouse/bin ${TESTS_IMAGE_NAME} make tests-matrix
# </template: tests_before_build_template>
make dmt-lint
# </template: tests_dmt_lint>

dmt_lint:
if: ${{ needs.pull_request_info.outputs.changes_not_markdown == 'true' }}
name: DMT Lint
matrix_tests:
name: Matrix tests
needs:
- git_info
- git_info

# <template: tests_before_build_template>
runs-on: [self-hosted, regular]
Expand Down Expand Up @@ -949,7 +894,7 @@ jobs:
echo "⚓️ 📥 [$(date -u)] Pull 'tests' image..."
docker pull ${TESTS_IMAGE_NAME}
echo "⚓️ 🏎 [$(date -u)] Run tests..."
docker run -w /deckhouse -v ${{github.workspace}}:/deckhouse -e "TERM=xterm-256color" -v ~/go-pkg-cache:/go/pkg --user $(id -u):$(id -g) ${TESTS_IMAGE_NAME} make dmt-lint
docker run -w /deckhouse -v ${{github.workspace}}:/deckhouse -e "TERM=xterm-256color" -v ~/go-pkg-cache:/go/pkg -v ~/deckhouse-bin-cache:/deckhouse/bin ${TESTS_IMAGE_NAME} make tests-matrix
# </template: tests_before_build_template>

dhctl_tests:
Expand Down
84 changes: 14 additions & 70 deletions .github/workflows/build-and-test_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2989,12 +2989,12 @@ jobs:
# </template: update_comment_on_finish>


matrix_tests:
name: Matrix tests
needs:
- git_info
tests_dmt_lint:
name: DMT lint
needs:
- git_info

# <template: tests_before_build_template>
# <template: tests_dmt_lint>
runs-on: [self-hosted, regular]
steps:

Expand All @@ -3012,65 +3012,10 @@ jobs:
with:
fetch-depth: 0
# </template: checkout_full_step>

# <template: login_dev_registry_step>
- name: Check dev registry credentials
id: check_dev_registry
env:
HOST: ${{secrets.DECKHOUSE_DEV_REGISTRY_HOST}}
run: |
if [[ -n $HOST ]]; then
echo "has_credentials=true" >> $GITHUB_OUTPUT
echo "web_registry_path=${{secrets.DECKHOUSE_DEV_REGISTRY_HOST }}/deckhouse/site" >> $GITHUB_OUTPUT
fi
- name: Login to dev registry
uses: docker/login-action@v2.1.0
if: ${{ steps.check_dev_registry.outputs.has_credentials == 'true' }}
with:
registry: ${{ secrets.DECKHOUSE_DEV_REGISTRY_HOST }}
username: ${{ secrets.DECKHOUSE_DEV_REGISTRY_USER }}
password: ${{ secrets.DECKHOUSE_DEV_REGISTRY_PASSWORD }}
logout: false
# </template: login_dev_registry_step>

# <template: login_rw_registry_step>
- name: Check rw registry credentials
id: check_rw_registry
env:
HOST: ${{secrets.DECKHOUSE_REGISTRY_HOST}}
run: |
if [[ -n $HOST ]]; then
echo "has_credentials=true" >> $GITHUB_OUTPUT
echo "web_registry_path=${{secrets.DECKHOUSE_REGISTRY_HOST }}/deckhouse/site" >> $GITHUB_OUTPUT
fi
- name: Login to rw registry
uses: docker/login-action@v2.1.0
if: ${{ steps.check_rw_registry.outputs.has_credentials == 'true' }}
with:
registry: ${{ secrets.DECKHOUSE_REGISTRY_HOST }}
username: ${{ secrets.DECKHOUSE_REGISTRY_USER }}
password: ${{ secrets.DECKHOUSE_REGISTRY_PASSWORD }}
logout: false
- name: Login to Github Container Registry
uses: docker/login-action@v2.1.0
if: ${{ steps.check_rw_registry.outputs.has_credentials != 'true' }}
with:
registry: ghcr.io
username: ${{ secrets.GHCR_IO_REGISTRY_USER }}
password: ${{ secrets.GHCR_IO_REGISTRY_PASSWORD }}
logout: false
# </template: login_rw_registry_step>
- name: Run tests
env:
TESTS_IMAGE_NAME: "registry.deckhouse.io/base_images/golang:1.23.1-bullseye@sha256:a24507d1a36fce86431198a979435dadb187e8d0ce0b5c181f46d6788d84a40f"
- name: DMT lint
run: |
# Print image name in uppercase to prevent hiding non-secret registry host stored in secret.
echo "Tests image name: '${TESTS_IMAGE_NAME}'" | tr '[:lower:]' '[:upper:]'
echo "⚓️ 📥 [$(date -u)] Pull 'tests' image..."
docker pull ${TESTS_IMAGE_NAME}
echo "⚓️ 🏎 [$(date -u)] Run tests..."
docker run -w /deckhouse -v ${{github.workspace}}:/deckhouse -e "TERM=xterm-256color" -v ~/go-pkg-cache:/go/pkg -v ~/deckhouse-bin-cache:/deckhouse/bin ${TESTS_IMAGE_NAME} make tests-matrix
# </template: tests_before_build_template>
make dmt-lint
# </template: tests_dmt_lint>
# <template: update_comment_on_finish>
- name: Update comment on finish
id: update_comment_on_finish
Expand All @@ -3085,7 +3030,7 @@ jobs:
retries: 3
script: |
const statusConfig = 'job,one-line';
const name = 'Matrix tests';
const name = 'DMT lint';
const needsContext = JSON.parse(process.env.NEEDS_CONTEXT);
const jobContext = JSON.parse(process.env.JOB_CONTEXT);
const stepsContext = JSON.parse(process.env.STEPS_CONTEXT);
Expand All @@ -3104,11 +3049,10 @@ jobs:
# </template: update_comment_on_finish>


dmt_lint:
if: ${{ needs.pull_request_info.outputs.changes_not_markdown == 'true' }}
name: DMT Lint
matrix_tests:
name: Matrix tests
needs:
- git_info
- git_info

# <template: tests_before_build_template>
runs-on: [self-hosted, regular]
Expand Down Expand Up @@ -3185,7 +3129,7 @@ jobs:
echo "⚓️ 📥 [$(date -u)] Pull 'tests' image..."
docker pull ${TESTS_IMAGE_NAME}
echo "⚓️ 🏎 [$(date -u)] Run tests..."
docker run -w /deckhouse -v ${{github.workspace}}:/deckhouse -e "TERM=xterm-256color" -v ~/go-pkg-cache:/go/pkg --user $(id -u):$(id -g) ${TESTS_IMAGE_NAME} make dmt-lint
docker run -w /deckhouse -v ${{github.workspace}}:/deckhouse -e "TERM=xterm-256color" -v ~/go-pkg-cache:/go/pkg -v ~/deckhouse-bin-cache:/deckhouse/bin ${TESTS_IMAGE_NAME} make tests-matrix
# </template: tests_before_build_template>
# <template: update_comment_on_finish>
- name: Update comment on finish
Expand Down Expand Up @@ -4150,7 +4094,7 @@ jobs:
runs-on: ubuntu-latest
env:
JOB_NAMES: |
{"build_be":"Build BE","build_ce":"Build CE","build_ee":"Build EE","build_fe":"Build FE","build_se":"Build SE","build_se_plus":"Build SE-plus","deploy_latest_web_doc_prod_sel":"(Prod) Deploy latest doc","deploy_latest_web_site_prod_sel":"(Prod) Deploy latest site","dhctl_tests":"Dhctl Tests","dmt_lint":"DMT Lint","doc_web_build":"Doc web build","go_generate":"Go Generate","golangci_lint":"GolangCI Lint","main_web_build":"Main web build","matrix_tests":"Matrix tests","openapi_test_cases":"OpenAPI Test Cases","tests":"Tests","tests_python_webhooks":"Tests python webhooks","validators":"Validators","web_links_test":"Web links test","workflow_render":"Render workflow"}
{"build_be":"Build BE","build_ce":"Build CE","build_ee":"Build EE","build_fe":"Build FE","build_se":"Build SE","build_se_plus":"Build SE-plus","deploy_latest_web_doc_prod_sel":"(Prod) Deploy latest doc","deploy_latest_web_site_prod_sel":"(Prod) Deploy latest site","dhctl_tests":"Dhctl Tests","doc_web_build":"Doc web build","go_generate":"Go Generate","golangci_lint":"GolangCI Lint","main_web_build":"Main web build","matrix_tests":"Matrix tests","openapi_test_cases":"OpenAPI Test Cases","tests":"Tests","tests_dmt_lint":"DMT lint","tests_python_webhooks":"Tests python webhooks","validators":"Validators","web_links_test":"Web links test","workflow_render":"Render workflow"}
steps:

# <template: checkout_step>
Expand Down

0 comments on commit 0b15efd

Please sign in to comment.