Loading .gitlab-ci.yml +81 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ stages: - lint - dev_deploy - dev_workflows - dev_cleanup - dev_merge - get_images - update_values Loading Loading @@ -176,6 +177,86 @@ dev_workflows_job: rules: - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' dev_cleanup_job: stage: dev_cleanup image: name: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/python-argocd:3.9 pull_policy: [always, if-not-present] variables: HELM_RELEASE_NAME: "test" HELM_NAMESPACE: "test" REMOTE_DEPLOY_DIR: "/home/ubuntu/etsi_installer" before_script: - mkdir -p ~/.ssh - chmod 700 ~/.ssh # Install SSH client - | if command -v apk >/dev/null 2>&1; then apk add --no-cache openssh-client elif command -v apt-get >/dev/null 2>&1; then apt-get update apt-get install -y --no-install-recommends openssh-client rm -rf /var/lib/apt/lists/* else echo "Unsupported container base image." exit 1 fi # Configure SSH private key - chmod 600 "$ETSI_SSH_KEY" # Add deployment server host key - ssh-keyscan -H "$DEPLOYMENT_SERVER_IP" >> ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts script: - | ssh \ -i "$ETSI_SSH_KEY" \ -o IdentitiesOnly=yes \ "$DEPLOYMENT_SERVER_USER@$DEPLOYMENT_SERVER_IP" " set -e echo 'Uninstalling Helm release...' helm uninstall '$HELM_RELEASE_NAME' \ --namespace '$HELM_NAMESPACE' \ --wait \ --timeout 10m \ || echo 'Helm release does not exist or was already removed.' echo 'Deleting PVCs from namespace...' kubectl delete pvc \ --all \ --namespace '$HELM_NAMESPACE' \ --ignore-not-found=true \ --wait=true \ --timeout=10m echo 'Deleting namespace...' kubectl delete namespace '$HELM_NAMESPACE' \ --ignore-not-found=true \ --wait=true \ --timeout=10m echo 'Removing copied Helm chart...' rm -rf '$REMOTE_DEPLOY_DIR' echo 'Cleanup completed successfully.' " dependencies: - dev_workflows_job rules: - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' when: always dev_merge: stage: dev_merge Loading Loading
.gitlab-ci.yml +81 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ stages: - lint - dev_deploy - dev_workflows - dev_cleanup - dev_merge - get_images - update_values Loading Loading @@ -176,6 +177,86 @@ dev_workflows_job: rules: - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' dev_cleanup_job: stage: dev_cleanup image: name: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/python-argocd:3.9 pull_policy: [always, if-not-present] variables: HELM_RELEASE_NAME: "test" HELM_NAMESPACE: "test" REMOTE_DEPLOY_DIR: "/home/ubuntu/etsi_installer" before_script: - mkdir -p ~/.ssh - chmod 700 ~/.ssh # Install SSH client - | if command -v apk >/dev/null 2>&1; then apk add --no-cache openssh-client elif command -v apt-get >/dev/null 2>&1; then apt-get update apt-get install -y --no-install-recommends openssh-client rm -rf /var/lib/apt/lists/* else echo "Unsupported container base image." exit 1 fi # Configure SSH private key - chmod 600 "$ETSI_SSH_KEY" # Add deployment server host key - ssh-keyscan -H "$DEPLOYMENT_SERVER_IP" >> ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts script: - | ssh \ -i "$ETSI_SSH_KEY" \ -o IdentitiesOnly=yes \ "$DEPLOYMENT_SERVER_USER@$DEPLOYMENT_SERVER_IP" " set -e echo 'Uninstalling Helm release...' helm uninstall '$HELM_RELEASE_NAME' \ --namespace '$HELM_NAMESPACE' \ --wait \ --timeout 10m \ || echo 'Helm release does not exist or was already removed.' echo 'Deleting PVCs from namespace...' kubectl delete pvc \ --all \ --namespace '$HELM_NAMESPACE' \ --ignore-not-found=true \ --wait=true \ --timeout=10m echo 'Deleting namespace...' kubectl delete namespace '$HELM_NAMESPACE' \ --ignore-not-found=true \ --wait=true \ --timeout=10m echo 'Removing copied Helm chart...' rm -rf '$REMOTE_DEPLOY_DIR' echo 'Cleanup completed successfully.' " dependencies: - dev_workflows_job rules: - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' when: always dev_merge: stage: dev_merge Loading