Skip to content
Draft
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
156 changes: 69 additions & 87 deletions .github/workflows/consul.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v5.1.0
with:
ref: ${{ inputs.pipeline_branch }}
repository: netcracker/qubership-test-pipelines
repository: Netcracker/qubership-test-pipelines
path: qubership-test-pipelines
persist-credentials: false

Expand Down Expand Up @@ -135,6 +135,14 @@ jobs:
matrix:
test: ${{ fromJson(needs.prepare.outputs.matrix) }}
name: ${{ matrix.test.name }}
env:
MATRIX_JSON: ${{ toJson(matrix.test) }}
CHECK_TESTS: true
NAMESPACE: consul
TEST_COMPLETION_MAX_RETRIES: 1
TEST_COMPLETION_RETRY_INTERVAL: 10s
SERVICE_READY_MAX_RETRIES: 100
SERVICE_READY_RETRY_INTERVAL: 10s
steps:
# == 01 Start ======= Common pre-steps for all tests =======
- name: Print job parameters
Expand All @@ -148,7 +156,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v5.1.0
with:
ref: ${{ inputs.pipeline_branch }}
repository: netcracker/qubership-test-pipelines
repository: Netcracker/qubership-test-pipelines
path: qubership-test-pipelines
persist-credentials: false

Expand All @@ -158,7 +166,7 @@ jobs:

# == Start Monitoring installation =======
- name: Install Monitoring
if: matrix.test.monitoring == true
if: matrix.test.install.monitoring == true
uses: ./qubership-test-pipelines/actions/shared/helm_deploy
with:
path_to_template: templates/monitoring/vm_without_tests.yml
Expand All @@ -170,62 +178,38 @@ jobs:
restricted: false

- name: Get Installed Monitoring CR name
if: matrix.test.monitoring == true
if: matrix.test.install.monitoring == true
uses: ./qubership-test-pipelines/actions/shared/get_crds
id: install_monitoring_get_crds
with:
crd_location: Netcracker/qubership-monitoring-operator/charts/qubership-monitoring-operator/crds

- name: Verify Monitoring installation
if: matrix.test.monitoring == true
if: matrix.test.install.monitoring == true
uses: ./qubership-test-pipelines/actions/shared/verify_installation
with:
namespace: monitoring
test_completion_max_retries: 40
test_completion_retry_interval: 10s
service_ready_max_retries: 80
service_ready_retry_interval: 10s
artifact_name: Install_Monitoring_${{ matrix.test.artifact_name }}
artifact_name: ${{ matrix.test.install.artifact_name }}_monitoring
monitoring_pipeline: true
crd_list: ${{ steps.install_monitoring_get_crds.outputs.crd_names }}
check_tests: true
repository_name: Netcracker/qubership-monitoring-operator
# == End Monitoring installation =======

# == Start ======= Specific steps for TLS =======
- name: TLS specific step
if: matrix.test.tls == true
run: |
echo "::group::Describe nodes"
kubectl describe nodes
echo "::endgroup::"
echo "::group::Install cert-manager"
helm repo add jetstack https://charts.jetstack.io --force-update
helm upgrade --install cert-manager jetstack/cert-manager --namespace cert-manager \
--create-namespace --version v1.16.3 --set prometheus.enabled=true --set crds.enabled=true
echo "::endgroup::"
echo "::group::Create cert-manager entities"
kubectl apply -f qubership-test-pipelines/resources/test-issuer.yaml
sleep 10s
kubectl apply -f qubership-test-pipelines/resources/test-certificate.yaml
sleep 10s
kubectl apply -f qubership-test-pipelines/resources/test-clusterissuer.yaml
echo "::endgroup::"
echo "::group::Get cert-manager resources"
kubectl get pods -n cert-manager
kubectl get secrets -n cert-manager
kubectl get certificates -A
echo "::endgroup::"
echo "::group::Get clusterissuer"
kubectl get clusterissuer
kubectl get clusterissuer test-clusterissuer -o yaml
echo "::endgroup::"
# == End ======= Specific steps for TLS =======
- name: Setup TLS
if: matrix.test.install.tls == true
uses: ./qubership-test-pipelines/actions/shared/setup_tls
# == End ======= Specific steps for TLS =======

# == Start ======= Specific steps for S3 =======
- name: Create S3 bucket
id: create_bucket
if: matrix.test.s3 == true
if: matrix.test.install.s3 == true || matrix.test.upgrade.s3 == true
uses: ./qubership-test-pipelines/actions/shared/setup_s3_bucket
with:
aws_access_key_id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
Expand All @@ -234,48 +218,45 @@ jobs:
prefix: consul

- name: Add s3 secrets to template (clean install)
if: matrix.test.s3 == true
if: matrix.test.install.s3 == true
# zizmor: ignore[template-injection]
run: |
echo "::group::Add secrets to template"
# ▶️ Add s3 secrets to template
python qubership-test-pipelines/scripts/update_yaml.py \
--file='qubership-test-pipelines/templates/consul-service/consul_clean_all_on_sc_drd_s3_tls.yml' \
--file='qubership-test-pipelines/${{ matrix.test.install.template }}' \
--path='backupDaemon/s3/keyId' \
--value='${{ secrets.AWS_S3_ACCESS_KEY_ID }}' \
&& python qubership-test-pipelines/scripts/update_yaml.py \
--file='qubership-test-pipelines/templates/consul-service/consul_clean_all_on_sc_drd_s3_tls.yml' \
--file='qubership-test-pipelines/${{ matrix.test.install.template }}' \
--path='backupDaemon/s3/keySecret' \
--value='${{ secrets.AWS_S3_ACCESS_KEY_SECRET }}' \
&& python qubership-test-pipelines/scripts/update_yaml.py \
--file='qubership-test-pipelines/templates/consul-service/consul_clean_all_on_sc_drd_s3_tls.yml' \
--file='qubership-test-pipelines/${{ matrix.test.install.template }}' \
--path='backupDaemon/s3/bucket' \
--value="${{ steps.create_bucket.outputs.bucket_name }}"
# == End ======= Specific steps for S3 =======

# == Start ======= Specific steps for Allure report =======
- name: Add s3 backet for Allure report
if: matrix.test.allure == true
run: >-
python qubership-test-pipelines/scripts/update_yaml.py
--file='qubership-test-pipelines/${{ matrix.test.template }}'
--path='integrationTests/atpReport/atpStorage/username'
--value='${{ secrets.AWS_S3_ACCESS_KEY_ID }}'
&& python qubership-test-pipelines/scripts/update_yaml.py
--file='qubership-test-pipelines/${{ matrix.test.template }}'
--path='integrationTests/atpReport/atpStorage/password'
--value='${{ secrets.AWS_S3_ACCESS_KEY_SECRET }}'
# == End ======= Specific steps for Allure report =======
- name: Add s3 bucket for Allure report
if: matrix.test.install.allure == true
run: |
python qubership-test-pipelines/scripts/update_yaml.py \
--file='qubership-test-pipelines/${{ matrix.test.install.template }}' \
--path='integrationTests/atpReport/atpStorage/username' \
--value='${{secrets.AWS_S3_ACCESS_KEY_ID}}' \
&& python qubership-test-pipelines/scripts/update_yaml.py \
--file='qubership-test-pipelines/${{ matrix.test.install.template }}' \
--path='integrationTests/atpReport/atpStorage/password' \
--value='${{secrets.AWS_S3_ACCESS_KEY_SECRET}}'

- name: Print clean install deployment parameters
run: cat qubership-test-pipelines/${{ matrix.test.template }}
run: cat qubership-test-pipelines/${{ matrix.test.install.template }}

# == 02 Start ======= Common steps for all tests =======
- name: Install Consul [${{ matrix.test.install_version }}]
- name: Install Consul [${{ matrix.test.install.version }}]
uses: ./qubership-test-pipelines/actions/shared/helm_deploy
id: consul_install
with:
path_to_template: ${{ matrix.test.template }}
service_branch: ${{ matrix.test.install_version }}
path_to_template: ${{ matrix.test.install.template }}
service_branch: ${{ matrix.test.install.version }}
service_name: consul
repository_name: ${{ inputs.repository_name }}
path_to_chart: charts/helm/consul-service
Expand All @@ -285,20 +266,20 @@ jobs:
- name: Verify Consul installation
uses: ./qubership-test-pipelines/actions/shared/verify_installation
with:
check_tests: true
namespace: consul
test_completion_max_retries: 50
test_completion_retry_interval: 10s
service_ready_max_retries: 50
service_ready_retry_interval: 10s
check_tests: ${{ env.CHECK_TESTS }}
namespace: ${{ env.NAMESPACE }}
test_completion_max_retries: ${{ env.TEST_COMPLETION_MAX_RETRIES }}
test_completion_retry_interval: ${{ env.TEST_COMPLETION_RETRY_INTERVAL }}
service_ready_max_retries: ${{ env.SERVICE_READY_MAX_RETRIES }}
service_ready_retry_interval: ${{ env.SERVICE_READY_RETRY_INTERVAL }}

- name: Collect Diagnostics Consul installation
if: ${{ !cancelled() && steps.consul_install.conclusion != 'skipped' }}
uses: ./qubership-test-pipelines/actions/shared/collect_diag_info
with:
namespace: consul
artifact_name: Installation_${{ matrix.test.artifact_name }}
service_branch: ${{ matrix.test.install_version }}
artifact_name: ${{ matrix.test.install.artifact_name }}
service_branch: ${{ matrix.test.install.version }}

- name: Delete status-provisioner job
shell: bash
Expand All @@ -307,36 +288,36 @@ jobs:

# == Start ======= Specific steps for S3 =======
- name: Add s3 secrets to template (upgrade)
if: matrix.test.sequence == 'upgrade' && matrix.test.s3 == true
if: matrix.test.sequence == 'upgrade' && matrix.test.upgrade.s3 == true
shell: bash
# zizmor: ignore[template-injection]
run: |
python qubership-test-pipelines/scripts/update_yaml.py \
--file='qubership-test-pipelines/templates/consul-service/consul_clean_all_on_sc_drd_s3.yml' \
--file='qubership-test-pipelines/${{ matrix.test.upgrade.template }}' \
--path='backupDaemon/s3/keyId' \
--value='${{ secrets.AWS_S3_ACCESS_KEY_ID }}' \
--value='${{secrets.AWS_S3_ACCESS_KEY_ID}}' \
&& python qubership-test-pipelines/scripts/update_yaml.py \
--file='qubership-test-pipelines/templates/consul-service/consul_clean_all_on_sc_drd_s3.yml' \
--file='qubership-test-pipelines/${{ matrix.test.upgrade.template }}' \
--path='backupDaemon/s3/keySecret' \
--value='${{ secrets.AWS_S3_ACCESS_KEY_SECRET }}' \
--value='${{secrets.AWS_S3_ACCESS_KEY_SECRET}}' \
&& python qubership-test-pipelines/scripts/update_yaml.py \
--file='qubership-test-pipelines/templates/consul-service/consul_clean_all_on_sc_drd_s3.yml' \
--file='qubership-test-pipelines/${{ matrix.test.upgrade.template }}' \
--path='backupDaemon/s3/bucket' \
--value="${{ steps.create_bucket.outputs.bucket_name }}"

- name: Print upgrade deployment parameters
if: matrix.test.sequence == 'upgrade' && matrix.test.s3 == true
run: cat qubership-test-pipelines/${{ matrix.test.upgrade_template }}
if: matrix.test.sequence == 'upgrade' && matrix.test.upgrade.s3 == true
run: cat qubership-test-pipelines/${{ matrix.test.upgrade.template }}
# == End ======= Specific steps for S3 =======

# == Start ======= Specific steps for upgrade tests =======
- name: Upgrade to [${{ matrix.test.upgrade_version }}]
- name: Upgrade to [${{ matrix.test.upgrade.version }}]
if: matrix.test.sequence == 'upgrade'
uses: ./qubership-test-pipelines/actions/shared/helm_deploy
id: consul_upgrade
with:
path_to_template: ${{ matrix.test.upgrade_template }}
service_branch: ${{ matrix.test.upgrade_version }}
path_to_template: ${{ matrix.test.upgrade.template }}
service_branch: ${{ matrix.test.upgrade.version }}
deploy_mode: upgrade
service_name: consul
repository_name: ${{ inputs.repository_name }}
Expand All @@ -352,25 +333,25 @@ jobs:
if: matrix.test.sequence == 'upgrade'
uses: ./qubership-test-pipelines/actions/shared/verify_installation
with:
check_tests: true
namespace: consul
test_completion_max_retries: 50
test_completion_retry_interval: 10s
service_ready_max_retries: 50
service_ready_retry_interval: 10s
check_tests: ${{ env.CHECK_TESTS }}
namespace: ${{ env.NAMESPACE }}
test_completion_max_retries: ${{ env.TEST_COMPLETION_MAX_RETRIES }}
test_completion_retry_interval: ${{ env.TEST_COMPLETION_RETRY_INTERVAL }}
service_ready_max_retries: ${{ env.SERVICE_READY_MAX_RETRIES }}
service_ready_retry_interval: ${{ env.SERVICE_READY_RETRY_INTERVAL }}

- name: Collect Diagnostics Consul upgrade
if: ${{ !cancelled() && steps.consul_upgrade.conclusion != 'skipped' }}
uses: ./qubership-test-pipelines/actions/shared/collect_diag_info
with:
namespace: consul
artifact_name: Upgrade_${{ matrix.test.artifact_name }}
service_branch: ${{ matrix.test.upgrade_version }}
artifact_name: ${{ matrix.test.upgrade.artifact_name }}
service_branch: ${{ matrix.test.upgrade.version }}
# == End ======= Specific steps for upgrade tests =======

# == Start ======= Specific steps for S3 =======
- name: Delete S3 bucket
if: always() && matrix.test.s3 == true
if: always() && (matrix.test.install.s3 == true || matrix.test.upgrade.s3 == true)
uses: ./qubership-test-pipelines/actions/shared/cleanup_s3_bucket
with:
aws_access_key_id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
Expand All @@ -388,9 +369,10 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v5.1.0
with:
ref: ${{ inputs.pipeline_branch }}
repository: netcracker/qubership-test-pipelines
repository: Netcracker/qubership-test-pipelines
path: qubership-test-pipelines
persist-credentials: false

- name: Check job status
uses: ./qubership-test-pipelines/actions/shared/check_job_status
with:
Expand Down
48 changes: 48 additions & 0 deletions actions/shared/setup_tls/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Setup TLS
description: Installs cert-manager and creates test issuer/certificate for TLS testing
runs:
using: composite
steps:
- name: Describe nodes
shell: bash
run: |
echo "::group::Describe nodes"
kubectl describe nodes
echo "::endgroup::"

- name: Install cert-manager
shell: bash
run: |
echo "::group::Install cert-manager"
helm repo add jetstack https://charts.jetstack.io --force-update
helm upgrade --install cert-manager jetstack/cert-manager --namespace cert-manager \
--create-namespace --version v1.16.3 --set prometheus.enabled=true --set crds.enabled=true
echo "::endgroup::"

- name: Create cert-manager entities
shell: bash
run: |
echo "::group::Create cert-manager entities"
kubectl apply -f qubership-test-pipelines/resources/test-issuer.yaml
sleep 10s
kubectl apply -f qubership-test-pipelines/resources/test-certificate.yaml
sleep 10s
kubectl apply -f qubership-test-pipelines/resources/test-clusterissuer.yaml
echo "::endgroup::"

- name: Get cert-manager resources
shell: bash
run: |
echo "::group::Get cert-manager resources"
kubectl get pods -n cert-manager
kubectl get secrets -n cert-manager
kubectl get certificates -A
echo "::endgroup::"

- name: Get clusterissuer
shell: bash
run: |
echo "::group::Get clusterissuer"
kubectl get clusterissuer
kubectl get clusterissuer test-clusterissuer -o yaml
echo "::endgroup::"
Loading
Loading