diff --git a/.github/charts-values-update-config.yaml b/.github/charts-values-update-config.yaml new file mode 100644 index 00000000..116276f6 --- /dev/null +++ b/.github/charts-values-update-config.yaml @@ -0,0 +1,8 @@ +--- +charts: + - name: qubership-logging-operator + chart_file: charts/qubership-logging-operator/Chart.yaml + values_file: charts/qubership-logging-operator/values.yaml + image: + - ghcr.io/netcracker/qubership-logging-operator:${release} + - ghcr.io/netcracker/qubership-logging-integration-tests:${release} diff --git a/.github/versions.yaml b/.github/versions.yaml new file mode 100644 index 00000000..ba2906d0 --- /dev/null +++ b/.github/versions.yaml @@ -0,0 +1 @@ +main diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0d059f0a..21b85e83 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -6,7 +6,7 @@ on: branches: - '**' paths-ignore: - - '.github/**' + # - '.github/**' - 'docs/**' - 'CODE-OF-CONDUCT.md' - 'CONTRIBUTING.md' @@ -17,7 +17,7 @@ on: branches: - '**' paths-ignore: - - '.github/**' + # - '.github/**' - 'docs/**' - 'CODE-OF-CONDUCT.md' - 'CONTRIBUTING.md' diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 8202c177..1813ec31 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -1,630 +1,40 @@ --- -name: Test Logging Installation - +name: Run Logging Pipeline on: workflow_dispatch: {} pull_request: - branches: - - main - -env: - kind_version: v0.27.0 - opensearch_namespace: opensearch - opensearch_version: release-2025.2-1.14.4 - namespace: logging - max_attempts: 50 - delay: 10 + types: [opened, synchronize, reopened] + branches: [main] + paths-ignore: + # - '.github/**' + - 'docs/**' + - 'CODE-OF-CONDUCT.md' + - 'CONTRIBUTING.md' + - 'LICENSE' + - 'README.md' + - 'SECURITY.md' +permissions: + contents: read jobs: - integration_tests: - name: Run Integration Tests + Wait-for-images: runs-on: ubuntu-latest - timeout-minutes: 20 + outputs: + conclusion: ${{ steps.wait.outputs.conclusion }} steps: - - name: Checkout code - uses: actions/checkout@v5 - with: - path: qubership-logging-operator - - - name: Set up kind - run: | - curl -sLo ./kind https://kind.sigs.k8s.io/dl/${{ env.kind_version }}/kind-linux-amd64 - chmod +x ./kind - sudo mv ./kind /usr/local/bin/ - kind create cluster - docker exec kind-control-plane bash -c "mkdir -p /var/log/audit && chown 1000:1000 /var/log/audit && echo 'Created /var/log/audit with the permissions:'; ls -ld /var/log/audit" - - name: Set tag and repository owner - run: | - echo "TAG=${GITHUB_SHA:0:11}" >> $GITHUB_ENV - echo "REPOSITORY_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build qubership-logging-operator - uses: docker/build-push-action@v6 - with: - load: true - no-cache: true - context: ./qubership-logging-operator - file: ./qubership-logging-operator/Dockerfile - platforms: linux/amd64 - push: false - tags: ghcr.io/${{ env.REPOSITORY_OWNER }}/qubership-logging-operator:${{ env.TAG }} - - name: Build qubership-logging-integration-tests - uses: docker/build-push-action@v6 - with: - load: true - no-cache: true - context: ./qubership-logging-operator/test/robot-tests - file: ./qubership-logging-operator/test/robot-tests/Dockerfile - platforms: linux/amd64 - push: false - tags: ghcr.io/${{ env.REPOSITORY_OWNER }}/qubership-logging-integration-tests:${{ env.TAG }} - - - name: Load docker images in kind cluster - run: | - kind load docker-image ghcr.io/${{ env.REPOSITORY_OWNER }}/qubership-logging-operator:${{ env.TAG }} - kind load docker-image ghcr.io/${{ env.REPOSITORY_OWNER }}/qubership-logging-integration-tests:${{ env.TAG }} - - - name: Install helm - run: | - curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash - - - name: Install required CRDs - run: | - kubectl apply -f https://raw.githubusercontent.com/Netcracker/qubership-monitoring-operator/refs/heads/main/charts/qubership-monitoring-operator/charts/grafana-operator/crds/integreatly.org_grafanadashboards.yaml - kubectl apply -f https://raw.githubusercontent.com/Netcracker/qubership-monitoring-operator/refs/heads/main/charts/qubership-monitoring-operator/charts/victoriametrics-operator/crds/monitoring.coreos.com_prometheusrules.yaml - kubectl apply -f https://raw.githubusercontent.com/Netcracker/qubership-monitoring-operator/refs/heads/main/charts/qubership-monitoring-operator/charts/victoriametrics-operator/crds/monitoring.coreos.com_servicemonitors.yaml - kubectl apply -f https://raw.githubusercontent.com/Netcracker/qubership-monitoring-operator/refs/heads/main/charts/qubership-monitoring-operator/charts/victoriametrics-operator/crds/monitoring.coreos.com_podmonitors.yaml - - - name: Checkout opensearch repo - uses: actions/checkout@v5 - with: - repository: Netcracker/qubership-opensearch - ref: ${{ env.opensearch_version }} - path: qubership-opensearch - - - name: Create values.yaml for opensearch - run: | - cat < opensearch_values.yaml - operator: - dockerImage: ghcr.io/netcracker/qubership-opensearch-operator:${{ env.opensearch_version }} - dashboards: - enabled: false - opensearch: - master: - enabled: true - replicas: 1 - persistence: - enabled: true - storageClass: "standard" - securityConfig: - authc: - basic: - username: "admin" - password: "admin" - tls: - enabled: false - monitoring: - enabled: false - dbaasAdapter: - enabled: false - curator: - enabled: false - username: "admin" - password: "admin" - EOF - shell: bash - - - name: Install opensearch - run: | - helm upgrade --install opensearch \ - --namespace=${{ env.opensearch_namespace }} \ - --create-namespace \ - ./qubership-opensearch/charts/helm/opensearch-service \ - -f ./opensearch_values.yaml - - - name: Check opensearch deployment status - run: | - echo "Checking status of opensearch-status-provisioner..." - attempt=1 - max_attempts=${{ env.max_attempts }} - while [[ $attempt -le $max_attempts ]]; do - problem_pods=$(kubectl get pods -n ${{ env.opensearch_namespace }} --no-headers 2>/dev/null | grep -E "ImagePullBackOff|ErrImagePull|InvalidImageName" || true) - if [[ -n "$problem_pods" ]]; then - echo -e "::error::❌ Some images cannot be pulled:\n$problem_pods" - exit 1 - fi - echo "Attempt $attempt/$max_attempts: Checking opensearch-status-provisioner pod status..." - phase=$(kubectl get pod -l name=opensearch-status-provisioner -n ${{ env.opensearch_namespace }} -o jsonpath='{.items[0].status.phase}' 2>/dev/null || echo "NotFound") - if [[ "$phase" == "Succeeded" ]]; then - echo "✅ Opensearch status provisioner job has succeeded." - break - elif [[ "$phase" == "Failed" || "$phase" == "Error" ]]; then - echo "::error::❌ Opensearch status provisioner job failed with status: $phase" - exit 1 - else - echo "Opensearch status provisioner job status: $phase. Retrying in ${{ env.delay }} seconds..." - kubectl get pods -n ${{ env.opensearch_namespace }} - sleep ${{ env.delay }} - ((attempt++)) - fi - done - if [[ "$phase" != "Succeeded" ]]; then - echo "::error::❌ Maximum attempts reached. Opensearch status provisioner job has not succeeded." - exit 1 - fi - shell: bash - - - name: Check opensearch cluster health - id: check_opensearch_health - run: | - cluster_status=$(kubectl exec -n ${{ env.opensearch_namespace }} opensearch-0 -- curl -s http://localhost:9200/_cluster/health?pretty -u admin:admin) - if [[ $(jq -r .status <<<"$cluster_status") = "yellow" ]]; then - echo "::error::❌ Opensearch cluster status is YELLOW. Check opensearch logs." - echo "status=❌failure" >> $GITHUB_OUTPUT - echo "cluster_status=$(echo $cluster_status | jq -c )" >> $GITHUB_OUTPUT && echo -e "Cluster status:\n$cluster_status" - exit 1 - elif [[ $(jq -r .status <<<"$cluster_status") = "red" ]]; then - echo "::error::❌ Opensearch cluster status is RED. Check opensearch logs." - echo "status=❌failure" >> $GITHUB_OUTPUT - echo "cluster_status=$(echo $cluster_status | jq -c )" >> $GITHUB_OUTPUT && echo -e "Cluster status:\n$cluster_status" - exit 1 - else - echo "✅ Opensearch cluster status is GREEN." - echo "status=✅success" >> $GITHUB_OUTPUT - echo "cluster_status=$(echo $cluster_status | jq -c )" >> $GITHUB_OUTPUT && echo -e "Cluster status:\n$cluster_status" - fi - shell: bash - - - name: Create values for logging operator installation - run: | - cat < logging_values.yaml - skipMetricsService: false - containerRuntimeType: containerd - operatorImage: ghcr.io/${{ env.REPOSITORY_OWNER }}/qubership-logging-operator:${{ env.TAG }} - graylog: - install: true - mongoStorageClassName: standard - graylogStorageClassName: standard - host: http://graylog.demo.qubership.org - initContainerDockerImage: alpine:3.17.2 - elasticsearchHost: http://admin:admin@opensearch.opensearch:9200 - indexShards: "1" - indexReplicas: "0" - cloudEventsReader: - dockerImage: ghcr.io/netcracker/qubership-kube-events-reader:main - fluentbit: - install: true - configmapReload: - dockerImage: ghcr.io/jimmidyson/configmap-reload:v0.13.1 - graylogHost: graylog-service - graylogPort: 12201 - fluentd: - install: false - integrationTests: - install: true - tags: smokeORlog-generator - image: ghcr.io/${{ env.REPOSITORY_OWNER }}/qubership-logging-integration-tests:${{ env.TAG }} - externalGraylogServer: "false" - graylogHost: graylog-service - graylogPort: 9000 - EOF - shell: bash - - - name: Install qubership logging operator - run: | - helm upgrade --install qubership-logging-operator \ - --namespace=${{ env.namespace }} \ - --create-namespace ./qubership-logging-operator/charts/qubership-logging-operator \ - -f ./logging_values.yaml - echo "Delaying ${{ env.delay }} seconds before checking logging-operator status..." - sleep ${{ env.delay }} - shell: bash - - - name: Checking logging operator status - run: | - echo "Checking status of logging-operator..." - attempt=1 - max_attempts=${{ env.max_attempts }} - while [[ $attempt -le $max_attempts ]]; do - problem_pods=$(kubectl get pods -n ${{ env.namespace }} 2>/dev/null | grep -E "ImagePullBackOff|ErrImagePull|InvalidImageName" || true) - if [[ -n "$problem_pods" ]]; then - echo -e "::error::❌ Some images cannot be pulled:\n$problem_pods" - exit 1 - fi - echo "Attempt $attempt/$max_attempts: Checking logging-operator pod status..." - pod=$(kubectl get pod -l name=logging-service-operator -n ${{ env.namespace }} -o jsonpath='{.items[0]}') - phase=$(echo "$pod" | jq -r '.status.phase') - ready=$(echo "$pod" | jq -r '.status.conditions[] | select(.type == "Ready") | .status') - scheduled=$(echo "$pod" | jq -r '.status.conditions[] | select(.type == "PodScheduled") | .status') - if [[ "$ready" == "True" ]]; then - echo "✅ Logging operator is ready." - break - elif [[ "$ready" == "False" && "$phase" == "Running" ]]; then - echo "Logging operator is not ready yet. Retrying in ${{ env.delay }} seconds..." - kubectl get pods -n ${{ env.namespace }} - sleep ${{ env.delay }} - ((attempt++)) - elif [[ "$phase" == "Pending" && "$scheduled" == "True" ]]; then - echo "Logging operator status: $phase. Retrying in ${{ env.delay }} seconds..." - kubectl get pods -n ${{ env.namespace }} - sleep ${{ env.delay }} - ((attempt++)) - else - pod_events=$(kubectl events -n ${{ env.namespace }} --for pod/"$(echo $pod | jq -r '.metadata.name')") - echo "::error::❌ Logging operator pod cannot start" - echo -e "Events for logging operator pod:\n$pod_events" - echo -e "Pods status in ${{ env.namespace }} namespace:\n$(kubectl get pods -n ${{ env.namespace }})" - exit 1 - fi - done - if [[ "$ready" != "True" ]]; then - echo "::error::❌ Maximum attempts reached. Logging operator is not ready." - exit 1 - fi - shell: bash - - - name: Checking graylog status - id: check_graylog - run: | - echo "Waiting 10 seconds before checking graylog status..." - sleep ${{ env.delay }} - echo "Checking status of graylog..." - attempt=1 - max_attempts=${{ env.max_attempts }} - while [[ $attempt -le $max_attempts ]]; do - problem_pods=$(kubectl get pods -n ${{ env.namespace }} 2>/dev/null | grep -E "ImagePullBackOff|ErrImagePull|InvalidImageName" || true) - if [[ -n "$problem_pods" ]]; then - echo -e "::error::❌ Some images cannot be pulled:\n$problem_pods" - exit 1 - fi - echo "Attempt $attempt/$max_attempts: Checking graylog pod status..." - pod=$(kubectl get pod -l name=graylog -n ${{ env.namespace }} -o jsonpath='{.items[0]}') - phase=$(echo "$pod" | jq -r '.status.phase') - ready=$(echo "$pod" | jq -r '.status.conditions[] | select(.type == "Ready") | .status') - scheduled=$(echo "$pod" | jq -r '.status.conditions[] | select(.type == "PodScheduled") | .status') - if [[ "$ready" == "True" ]]; then - echo "✅ Graylog is ready." - echo "status=✅success" >> $GITHUB_OUTPUT - echo "details=Graylog image: $(echo "$pod" | jq -r '.spec.containers[1].image')" >> $GITHUB_OUTPUT - break - elif [[ "$ready" == "False" && "$phase" == "Running" ]]; then - echo "Graylog is not ready yet. Retrying in ${{ env.delay }} seconds..." - kubectl get pods -n ${{ env.namespace }} - sleep ${{ env.delay }} - ((attempt++)) - elif [[ "$phase" == "Pending" && "$scheduled" == "True" ]]; then - echo "Graylog status: $phase. Retrying in ${{ env.delay }} seconds..." - kubectl get pods -n ${{ env.namespace }} - sleep ${{ env.delay }} - ((attempt++)) - else - pod_events=$(kubectl events -n ${{ env.namespace }} --for pod/"$(echo $pod | jq -r '.metadata.name')") - echo "::error::❌ Graylog pod cannot start" - echo -e "Events for graylog pod:\n$pod_events" - echo -e "Pods status in ${{ env.namespace }} namespace:\n$(kubectl get pods -n ${{ env.namespace }})" - exit 1 - fi - done - if [[ "$ready" != "True" ]]; then - echo "::error::❌ Maximum attempts reached. Graylog is not ready." - exit 1 - fi - shell: bash - - - name: Check integration tests pod status - run: | - echo "Checking status of integration tests pod..." - attempt=1 - max_attempts=${{ env.max_attempts }} - while [[ $attempt -le $max_attempts ]]; do - problem_pods=$(kubectl get pods -n ${{ env.namespace }} 2>/dev/null| grep -E "ImagePullBackOff|ErrImagePull|InvalidImageName" || true) - if [[ -n "$problem_pods" ]]; then - echo -e "::error::❌ Some images cannot be pulled:\n$problem_pods" - exit 1 - fi - echo "Attempt $attempt/$max_attempts: Checking integration-tests pod status..." - pod=$(kubectl get pod -l name=logging-integration-tests-runner -n ${{ env.namespace }} -o jsonpath='{.items[0]}') - phase=$(echo "$pod" | jq -r '.status.phase') - ready=$(echo "$pod" | jq -r '.status.conditions[] | select(.type == "Ready") | .status') - scheduled=$(echo "$pod" | jq -r '.status.conditions[] | select(.type == "PodScheduled") | .status') - if [[ "$ready" == "True" ]]; then - echo "✅Integration tests pod is ready." - break - elif [[ "$ready" == "False" && "$phase" == "Running" ]]; then - echo "Integration tests pod is not ready yet. Retrying in ${{ env.delay }} seconds..." - sleep ${{ env.delay }} - ((attempt++)) - elif [[ "$phase" == "Pending" && "$scheduled" == "True" ]]; then - echo "Integration tests pod status: $phase. Retrying in ${{ env.delay }} seconds..." - kubectl get pods -n ${{ env.namespace }} - sleep ${{ env.delay }} - ((attempt++)) - else - kubectl get pods -n ${{ env.namespace }} - pod_events=$(kubectl events -n ${{ env.namespace }} --for pod/"$(echo $pod | jq -r '.metadata.name')") - echo "::error::❌ Integration tests pod cannot start" - echo -e "Events for integration tests pod:\n$pod_events" - echo -e "Pods status in ${{ env.namespace }} namespace:\n$(kubectl get pods -n ${{ env.namespace }})" - exit 1 - fi - done - if [[ "$ready" != "True" ]]; then - echo "::error::❌ Maximum attempts reached. Integration tests pod is not ready." - exit 1 - fi - shell: bash - - - name: Check integration tests results - id: check_integration_tests - run: | - echo "Checking integration tests results..." - attempt=1 - max_attempts=${{ env.max_attempts }} - - # ======================= - # Smoke test - # ======================= - smoke_result="" - while [[ $attempt -le $max_attempts ]]; do - echo "Attempt $attempt/$max_attempts: Running smoke tests..." - logs=$(kubectl logs -l name=logging-integration-tests-runner -n ${{ env.namespace }} --tail=-1) - smoke_stats=$(awk '/^Tests\.Smoke\s+\|\s+(PASS|FAIL|SKIP)\s+\|$/{flag=1} /^([=]{78,})$/{if(flag){flag=0}} flag && /[0-9]+ tests, [0-9]+ passed, [0-9]+ failed(, [0-9]+ skipped)?/' <<< "$logs") - if [[ -n "$smoke_stats" ]]; then - read total passed failed skipped <<< $(echo "$smoke_stats" | awk '{gsub(",", "", $0); print $1, $3, $5, $7}') - echo "smoke_total=$total" >> $GITHUB_OUTPUT - echo "smoke_passed=$passed" >> $GITHUB_OUTPUT - echo "smoke_failed=$failed" >> $GITHUB_OUTPUT - echo "smoke_skipped=${skipped:-0}" >> $GITHUB_OUTPUT - fi - if [[ -n $(echo "$logs" | grep -E "Tests\.Smoke\s+\|\s+PASS\s+\|") ]]; then - echo "✅ Smoke test passed." - echo "smoke_status=✅passed" >> $GITHUB_OUTPUT - smoke_result="passed" - break - elif [[ -n $(echo "$logs" | grep -E "Tests\.Smoke\s+\|\s+FAIL\s+\|") ]]; then - echo "smoke_skipped=${skipped:-0}" >> $GITHUB_OUTPUT - if [[ -n $(echo "$logs" | grep -E "Keyword 'Check Indexer Cluster Status' failed[[:alnum:][:space:]:\.]+yellow != green") && "$failed" == "1" ]]; then - warning=$(echo "$logs" | grep "yellow != green") - echo "::group::⚠️Smoke test completed with 1 warning:" - echo -e "$warning\n===========================" - echo -e "Total: $total\nFailed: $failed\nSkipped: ${skipped:-0}\nPassed: $passed" - echo "::endgroup::" - echo "smoke_status=⚠️warning" >> $GITHUB_OUTPUT - echo "warning=$warning" >> $GITHUB_OUTPUT - smoke_result="warning" - else - echo "Smoke test completed with $failed failures. Check integration tests logs." - echo "smoke_status=❌failure" >> $GITHUB_OUTPUT - echo "details=Check logs in uploaded artifacts" >> $GITHUB_OUTPUT - smoke_result="failure" - fi - break - else - echo "Smoke test is not completed yet. Retrying in ${{ env.delay }} seconds..." - sleep ${{ env.delay }} - ((attempt++)) - fi - done - TEST_RESULTS_SMOKE=$(echo "$logs" | awk '/^={78,}$/ && prev ~ /^Tests\.Smoke\s+$/ {flag=1} flag; /^={78,}$/ && prev ~ /^[0-9]+ tests,/ {flag=0} {prev=$0}') - cat <> $GITHUB_OUTPUT - smoke_test_results<> $GITHUB_OUTPUT - echo "details=Check logs in uploaded artifacts" >> $GITHUB_OUTPUT - exit 1 - fi - - # ======================= - # Log Generator - # ======================= - attempt=1 - log_gen_result="" - while [[ $attempt -le $max_attempts ]]; do - echo "Attempt $attempt/$max_attempts: Checking logs parsing..." - logs=$(kubectl logs -l name=logging-integration-tests-runner -n ${{ env.namespace }} --tail=-1) - - log_gen_stats=$(awk '/^Tests\.Log Generator\s+\|\s+(PASS|FAIL|SKIP)\s+\|$/{flag=1} /^([=]{78,})$/{if(flag){flag=0}} flag && /[0-9]+ tests, [0-9]+ passed, [0-9]+ failed(, [0-9]+ skipped)?/' <<< "$logs") - - if [[ -n $(echo "$logs" | grep -E "^Tests\.Log Generator\s+\|\s+PASS\s+\|$") ]]; then - echo "✅ Logs are successfully parsed and queried from Graylog." - echo "log_gen_status=✅passed" >> $GITHUB_OUTPUT - log_gen_result="pass" - break - elif [[ -n $(echo "$logs" | grep -E "^Tests\.Log Generator\s+\|\s+FAIL\s+\|$") ]]; then - echo "::error::❌ Log Generator test failed. Check integration tests logs." - echo "log_gen_status=❌failure" >> $GITHUB_OUTPUT - echo "details=Check logs in uploaded artifacts" >> $GITHUB_OUTPUT - log_gen_result="failure" - break - else - echo "Log Generator test is not completed yet. Retrying in ${{ env.delay }} seconds..." - sleep ${{ env.delay }} - ((attempt++)) - fi - done - LOG_GEN_TEST_RESULTS=$(echo "$logs" | awk '/^={78,}$/ && prev ~ /^Tests\.Log Generator\s+$/ {flag=1} flag; /^={78,}$/ && prev ~ /^[0-9]+ tests,/ {flag=0} {prev=$0}') - cat <> $GITHUB_OUTPUT - log_gen_test_results<> $GITHUB_OUTPUT - echo "log_gen_passed=$passed" >> $GITHUB_OUTPUT - echo "log_gen_failed=$failed" >> $GITHUB_OUTPUT - echo "log_gen_skipped=${skipped:-0}" >> $GITHUB_OUTPUT - if [[ "$log_gen_result" == "failure" ]]; then - exit 1 - fi - else - echo "Logs parsing test timed out. Check integration tests logs." - echo "log_gen_status=❌failure" >> $GITHUB_OUTPUT - exit 1 - fi - echo "status=✅passed" >> $GITHUB_OUTPUT - shell: bash - - - name: Save opensearch artifacts - if: always() - id: opensearch_artifacts - run: | - mkdir -p "artifacts/${{ env.opensearch_namespace }}" - pods=$(kubectl get pods -n ${{ env.opensearch_namespace }} -o wide) - echo "$pods" > artifacts/${{ env.opensearch_namespace }}/pods.txt - PODS_TABLE=$(kubectl get pods -n ${{ env.opensearch_namespace }} -o wide) - cat <> $GITHUB_OUTPUT - opensearch_pods< artifacts/${{ env.opensearch_namespace }}/events.txt - kubectl get pods -n "${{ env.opensearch_namespace }}" -o jsonpath='{range .items[*]}{.metadata.name}{" "}{.spec.containers[*].name}{"\n"}{end}' | while read -r pod containers; do - for container in $containers; do - echo "Fetching logs in ${{ env.opensearch_namespace }} namespace for pod: $pod, container: $container" - if logs=$(kubectl logs -n "${{ env.opensearch_namespace }}" "$pod" -c "$container" 2>&1); then - echo "$logs" > "artifacts/${{ env.opensearch_namespace }}/$pod-$container.log" - else - echo "Could not fetch logs for $pod/$container: $logs" >&2 - fi - if logs=$(kubectl logs -n "${{ env.opensearch_namespace }}" "$pod" -c "$container" --previous 2>&1); then - echo "$logs" > "artifacts/${{ env.opensearch_namespace }}/$pod-$container-previous.log" - else - : - fi - done - done - shell: bash - - - name: Save logging artifacts - id: logging_artifacts - if: always() - run: | - mkdir -p "artifacts/${{ env.namespace }}" - pods=$(kubectl get pods -n ${{ env.namespace }} -o wide) - echo "$pods" > artifacts/${{ env.namespace }}/pods.txt - PODS_TABLE=$(kubectl get pods -n ${{ env.namespace }} -o wide) - cat <> $GITHUB_OUTPUT - logging_pods< artifacts/${{ env.namespace }}/events.txt - kubectl get configmap logging-fluentbit -n "${{ env.namespace }}" -o yaml > artifacts/${{ env.namespace }}/logging-fluentbit.yaml - kubectl get pods -n "${{ env.namespace }}" -o jsonpath='{range .items[*]}{.metadata.name}{" "}{.spec.containers[*].name}{"\n"}{end}' | while read -r pod containers; do - for container in $containers; do - echo "Fetching logs in ${{ env.namespace }} namespace for pod: $pod, container: $container" - if logs=$(kubectl logs -n "${{ env.namespace }}" "$pod" -c "$container" 2>&1); then - echo "$logs" > "artifacts/${{ env.namespace }}/$pod-$container.log" - else - echo "Could not fetch logs for $pod/$container: $logs" >&2 - fi - if logs=$(kubectl logs -n "${{ env.namespace }}" "$pod" -c "$container" --previous 2>&1); then - echo "$logs" > "artifacts/${{ env.namespace }}/$pod-$container-previous.log" - else - : - fi - done - done - shell: bash - - - name: Generate artifact name - if: always() - env: - HEAD_REF: ${{ github.head_ref || github.ref_name }} - run: | - # ▶️ Generate artifact name - release_name=$(echo "$HEAD_REF" | tr '/' '_' || echo "") - ARTIFACT_NAME="${{ github.job }}_${{ env.namespace }}_${release_name}_artifacts_$(date -u +'%Y%m%d%H%M%S')" - echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV - shell: bash - - - name: Upload artifacts - uses: actions/upload-artifact@v5 - if: always() - with: - name: ${{ env.ARTIFACT_NAME }} - path: artifacts/ - - - name: Cleanup - run: | - kind delete cluster - - - name: Generate Status Summary - if: always() - run: | - echo "## Install opensearch" >> $GITHUB_STEP_SUMMARY - echo "Check opensearch cluster health: ${{ steps.check_opensearch_health.outputs.status || '❓unknown' }}" >> $GITHUB_STEP_SUMMARY - echo -e "Opensearch version: ${{ env.opensearch_version }}" >> $GITHUB_STEP_SUMMARY - echo "Cluster status:" >> $GITHUB_STEP_SUMMARY - echo '```json' >> $GITHUB_STEP_SUMMARY - echo '${{ steps.check_opensearch_health.outputs.cluster_status }}' | jq . >> $GITHUB_STEP_SUMMARY || echo '❓unknown' >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - echo 'Pods running in opensearch namespace:' >> $GITHUB_STEP_SUMMARY - echo '```sh' >> $GITHUB_STEP_SUMMARY - echo "${{ steps.opensearch_artifacts.outputs.opensearch_pods || '❓unknown' }}" >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - - echo "## Install logging operator" >> $GITHUB_STEP_SUMMARY - echo "Check graylog status: ${{ steps.check_graylog.outputs.status || '❓unknown' }}" >> $GITHUB_STEP_SUMMARY - echo "${{ steps.check_graylog.outputs.details || '❓unknown' }}" >> $GITHUB_STEP_SUMMARY - echo 'Pods running in logging namespace:' >> $GITHUB_STEP_SUMMARY - echo '```sh' >> $GITHUB_STEP_SUMMARY - echo "${{ steps.logging_artifacts.outputs.logging_pods || '❓unknown' }}" >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - - echo "## Integration tests status" >> $GITHUB_STEP_SUMMARY - echo "Overall status: ${{ steps.check_integration_tests.outputs.status || '❓unknown' }}" >> $GITHUB_STEP_SUMMARY - - echo "### Smoke test" >> $GITHUB_STEP_SUMMARY - echo "status: ${{ steps.check_integration_tests.outputs.smoke_status || '❓unknown' }}" >> $GITHUB_STEP_SUMMARY - if [ -n "${{ steps.check_integration_tests.outputs.warning }}" ]; then - echo "warning: ${{ steps.check_integration_tests.outputs.warning }}" >> $GITHUB_STEP_SUMMARY - fi - echo '```' >> $GITHUB_STEP_SUMMARY - echo "Total tests: ${{ steps.check_integration_tests.outputs.smoke_total || '❓unknown' }}" >> $GITHUB_STEP_SUMMARY - echo "Failed tests: ${{ steps.check_integration_tests.outputs.smoke_failed || '❓unknown' }}" >> $GITHUB_STEP_SUMMARY - echo "Skipped tests: ${{ steps.check_integration_tests.outputs.smoke_skipped || '❓unknown' }}" >> $GITHUB_STEP_SUMMARY - echo "Passed tests: ${{ steps.check_integration_tests.outputs.smoke_passed || '❓unknown' }}" >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - - echo "### Logs parsing test" >> $GITHUB_STEP_SUMMARY - echo "status: ${{ steps.check_integration_tests.outputs.log_gen_status || '❓unknown' }}" >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - echo "Total tests: ${{ steps.check_integration_tests.outputs.log_gen_total || '❓unknown' }}" >> $GITHUB_STEP_SUMMARY - echo "Failed tests: ${{ steps.check_integration_tests.outputs.log_gen_failed || '❓unknown' }}" >> $GITHUB_STEP_SUMMARY - echo "Skipped tests: ${{ steps.check_integration_tests.outputs.log_gen_skipped || '❓unknown' }}" >> $GITHUB_STEP_SUMMARY - echo "Passed tests: ${{ steps.check_integration_tests.outputs.log_gen_passed || '❓unknown' }}" >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - - echo "
" >> $GITHUB_STEP_SUMMARY - echo "🔍 See smoke test logs" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo '```sh' >> $GITHUB_STEP_SUMMARY - echo "${{ steps.check_integration_tests.outputs.smoke_test_results || '❓unknown' }}" >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - echo "
" >> $GITHUB_STEP_SUMMARY - - echo "
" >> $GITHUB_STEP_SUMMARY - echo "🔍 See logs parsing test logs" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo '```sh' >> $GITHUB_STEP_SUMMARY - echo "${{ steps.check_integration_tests.outputs.log_gen_test_results || '❓unknown' }}" >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - echo "
" >> $GITHUB_STEP_SUMMARY + - name: Wait for build.yaml to complete + uses: netcracker/qubership-workflow-hub/actions/wait-for-workflow@main + id: wait + with: + workflow: build.yaml + token: ${{ secrets.GITHUB_TOKEN }} + poll-interval: 20 + Logging-Pipeline: + needs: Wait-for-images + if: ${{ needs.Wait-for-images.outputs.conclusion }} == 'success' + uses: Netcracker/qubership-test-pipelines/.github/workflows/logging.yaml@feat/logging-integration-tests + with: + service_branch: '${{ github.head_ref || github.ref_name }}' + versions_file: '.github/versions.yaml' + pipeline_branch: 'feat/logging-integration-tests' # this value must match the value after '@' in 'uses' + opensearch_version: 'main'