Skip to content

Commit

Permalink
Add telcov10n config for project2. (#59714)
Browse files Browse the repository at this point in the history
Signed-off-by: Semih Kisa <[email protected]>
  • Loading branch information
semihkisa authored Dec 11, 2024
1 parent fb2f06d commit a9c685e
Show file tree
Hide file tree
Showing 14 changed files with 327 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
build_root:
image_stream_tag:
name: release
namespace: openshift
tag: golang-1.20
resources:
'*':
limits:
memory: 4Gi
requests:
cpu: 100m
memory: 200Mi
tests:
- as: eco-ci-cd
cluster: build05
cron: 00 12 * * 1
steps:
env:
DCI_PIPELINE_FILES: du-deployment.yml
DU_PROFILE: lb
ECO_GOTESTS_CONTAINER: NOT_REQUIRED
EDU_CLUSTER: cloudransno-site3
GITLAB_BRANCH: dev
OCP_VERSION: "4.16"
SITE_NAME: cloudransno-site3
SPIRENT_PORT: "41"
STAMP: tb1slcm1
ZTP_SITES_LIST: cloudransno-site3
workflow: telcov10n-slcm-gitlab-project2
zz_generated_metadata:
branch: main
org: openshift-kni
repo: eco-ci-cd
variant: slcm-gitlab-project2-site3
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,74 @@ periodics:
- name: result-aggregator
secret:
secretName: result-aggregator
- agent: kubernetes
cluster: build05
cron: 00 12 * * 1
decorate: true
decoration_config:
skip_cloning: true
extra_refs:
- base_ref: main
org: openshift-kni
repo: eco-ci-cd
labels:
ci-operator.openshift.io/cluster: build05
ci-operator.openshift.io/variant: slcm-gitlab-project2-site3
ci.openshift.io/generator: prowgen
pj-rehearse.openshift.io/can-be-rehearsed: "true"
name: periodic-ci-openshift-kni-eco-ci-cd-main-slcm-gitlab-project2-site3-eco-ci-cd
reporter_config:
slack:
channel: '#eco-ci-cd-notifications'
job_states_to_report:
- failure
- error
- success
- aborted
report_template: '{{if eq .Status.State "success"}} :slack-green: Job *{{.Spec.Job}}*
ended with *{{.Status.State}}*. <{{.Status.URL}}|View logs> {{else}} :failed:
Job *{{.Spec.Job}}* ended with *{{.Status.State}}*. <{{.Status.URL}}|View
logs> {{end}}'
spec:
containers:
- args:
- --gcs-upload-secret=/secrets/gcs/service-account.json
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
- --report-credentials-file=/etc/report/credentials
- --target=eco-ci-cd
- --variant=slcm-gitlab-project2-site3
command:
- ci-operator
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources:
requests:
cpu: 10m
volumeMounts:
- mountPath: /secrets/gcs
name: gcs-credentials
readOnly: true
- mountPath: /secrets/manifest-tool
name: manifest-tool-local-pusher
readOnly: true
- mountPath: /etc/pull-secret
name: pull-secret
readOnly: true
- mountPath: /etc/report
name: result-aggregator
readOnly: true
serviceAccountName: ci-operator
volumes:
- name: manifest-tool-local-pusher
secret:
secretName: manifest-tool-local-pusher
- name: pull-secret
secret:
secretName: registry-pull-credentials
- name: result-aggregator
secret:
secretName: result-aggregator
- agent: kubernetes
cluster: build05
cron: 00 13 * * 1
Expand Down
2 changes: 1 addition & 1 deletion ci-operator/step-registry/telcov10n/OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ approvers:
- natifridman
- shaior
- ccardenosa
- cplacani
- cplacani
1 change: 0 additions & 1 deletion ci-operator/step-registry/telcov10n/slcm/OWNERS

This file was deleted.

6 changes: 6 additions & 0 deletions ci-operator/step-registry/telcov10n/slcm/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
approvers:
- natifridman
- shaior
- ccardenosa
- cplacani
- semihkisa
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"path": "telcov10n/slcm/gitlab-project2/telcov10n-slcm-gitlab-project2-workflow.yaml",
"owners": {
"approvers": [
"natifridman",
"shaior",
"ccardenosa",
"cplacani",
"semihkisa"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
workflow:
as: telcov10n-slcm-gitlab-project2
steps:
# pre:
# - ref: telco5g-jobs-router
# - ref: telco5g-cluster-setup
test:
- ref: telcov10n-slcm-gitlab-project2-tests
env:
DEBUG_MODE: false
RUN_EDU_TESTS: true
EDU_PTP: true
# post:
# - ref: telco5g-log-gather
# - chain: gather
# - ref: telco5g-release-cluster
documentation: |-
Run telco QE-SLCM eDU tests.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
approvers:
- natifridman
- shaior
- ccardenosa
- cplacani
- semihkisa
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#!/bin/bash

set -e
set -o pipefail


CREDENTIALS_PATH=/var/run/project-02
CI_PROJECT_ID=`cat $CREDENTIALS_PATH/ci-project-id/CI_PROJECT_ID`
DCI_REMOTE_CI=`cat $CREDENTIALS_PATH/dci-remote-ci/DCI_REMOTE_CI`
ECO_VALIDATION_CONTAINER=`cat $CREDENTIALS_PATH/eco-validation-container/ECO_VALIDATION_CONTAINER`
ECO_GOTESTS_CONTAINER=`cat $CREDENTIALS_PATH/eco-gotests-container/ECO_GOTESTS_CONTAINER`
GITLAB_TOKEN=`cat $CREDENTIALS_PATH/gitlab-token/GITLAB_TOKEN`
GITLAB_URL=`cat $CREDENTIALS_PATH/gitlab-url/GITLAB_URL`
GITLAB_API_TOKEN=`cat $CREDENTIALS_PATH/gitlab-api-token/GITLAB_API_TOKEN`


echo "Start"
echo "SITE_NAME $SITE_NAME"
echo "GITLAB_BRANCH $GITLAB_BRANCH"

# TRIGGER PIPELINE
#

response=$(curl -X POST \
-s \
--fail \
-F token="$GITLAB_TOKEN" \
-F "ref=$GITLAB_BRANCH" \
-F "variables[DU_PROFILE]=$DU_PROFILE" \
-F "variables[SITE_NAME]=$SITE_NAME" \
-F "variables[DCI_REMOTE_CI]=$DCI_REMOTE_CI" \
-F "variables[RUN_EDU_TESTS]=true" \
-F "variables[STAMP]=$STAMP" \
-F "variables[OCP_VERSION]=$OCP_VERSION" \
-F "variables[SPIRENT_PORT]=$SPIRENT_PORT" \
-F "variables[EDU_PTP]=$EDU_PTP" \
-F "variables[DEBUG_MODE]=$DEBUG_MODE" \
-F "variables[DCI_PIPELINE_FILES]=$DCI_PIPELINE_FILES" \
-F "variables[ECO_VALIDATION_CONTAINER]=$ECO_VALIDATION_CONTAINER" \
-F "variables[ECO_GOTESTS_CONTAINER]=$ECO_GOTESTS_CONTAINER" \
$GITLAB_URL/api/v4/projects/$CI_PROJECT_ID/trigger/pipeline)

echo "response:"
echo $response

PIPELINE_ID=$(echo $response | jq -r '.id')

echo "PIPELINE_ID:"
echo $PIPELINE_ID

sleep 5

# POLLING LOOP FOR PIPELINE STATUS
#

# URL of the API endpoint
API_URL="$GITLAB_URL/api/v4/projects/$CI_PROJECT_ID/pipelines/$PIPELINE_ID"

# Function to check the status field in the JSON response
check_status() {
response=$(curl -s --header "PRIVATE-TOKEN:$GITLAB_API_TOKEN" $API_URL)
status=$(echo $response | jq -r '.status')

echo "Status: $status"

if [[ "$status" == "success" || "$status" == "failed" ]]; then
# Exit the loop if status is success or failure
return 0
else
# Continue the loop otherwise
return 1
fi
}

# Maximum number of retries (18 hours)
MAX_RETRIES=6480

# Initialize retry counter
retry_count=0

# Loop until the status is success or failed, or until retries are exhausted
while [[ "$retry_count" -lt "$MAX_RETRIES" ]]; do
if check_status; then
echo "Exiting loop. Status is $status."
break
else
echo "Status is not success or failed, checking again..."
retry_count=$((retry_count + 1))
echo "Retry count: $retry_count/$MAX_RETRIES"
# Wait for 10 seconds before making the next API call
sleep 10
fi
done

return_code=0

if [[ "$retry_count" -eq "$MAX_RETRIES" ]]; then
echo "Maximum retries reached. Exiting loop."
return_code=1
fi

if [[ "$status" == "failed" ]]; then
echo "Pipeline failed."
return_code=1
fi

if [[ "$status" == "success" ]]; then
echo "Pipeline success."
fi

exit $return_code
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"path": "telcov10n/slcm/gitlab-project2/tests/telcov10n-slcm-gitlab-project2-tests-ref.yaml",
"owners": {
"approvers": [
"natifridman",
"shaior",
"ccardenosa",
"cplacani",
"semihkisa"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
ref:
as: telcov10n-slcm-gitlab-project2-tests
from_image:
namespace: ci
name: telco-bastion
tag: latest
commands: telcov10n-slcm-gitlab-project2-tests-commands.sh
timeout: 4h
resources:
requests:
cpu: 100m
memory: 200Mi
env:
- name: ZTP_SITES_LIST
- name: DCI_PIPELINE_FILES
- name: DEBUG_MODE
- name: DU_PROFILE
- name: ECO_GOTESTS_CONTAINER
- name: EDU_CLUSTER
- name: EDU_PTP
- name: GITLAB_BRANCH
- name: OCP_VERSION
- name: RUN_EDU_TESTS
- name: SITE_NAME
- name: SPIRENT_PORT
- name: STAMP
- name: CREDENTIALS_PATH
default: /var/run/project-02
credentials:
- namespace: test-credentials
name: slcm-project-02-ci-project-id
mount_path: /var/run/project-02/ci-project-id
- namespace: test-credentials
name: slcm-project-02-dci-remote-ci
mount_path: /var/run/project-02/dci-remote-ci
- namespace: test-credentials
name: slcm-project-02-eco-validation-container
mount_path: /var/run/project-02/eco-validation-container
- namespace: test-credentials
name: slcm-project-02-eco-gotests-container
mount_path: /var/run/project-02/eco-gotests-container
- namespace: test-credentials
name: slcm-project-02-gitlab-token
mount_path: /var/run/project-02/gitlab-token
- namespace: test-credentials
name: slcm-project-02-gitlab-url
mount_path: /var/run/project-02/gitlab-url
- namespace: test-credentials
name: slcm-project-02-gitlab-api-token
mount_path: /var/run/project-02/gitlab-api-token
documentation: |-
Run telco QE-SLCM eDU tests.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"natifridman",
"shaior",
"ccardenosa",
"cplacani"
"cplacani",
"semihkisa"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"natifridman",
"shaior",
"ccardenosa",
"cplacani"
"cplacani",
"semihkisa"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"natifridman",
"shaior",
"ccardenosa",
"cplacani"
"cplacani",
"semihkisa"
]
}
}

0 comments on commit a9c685e

Please sign in to comment.