Skip to content

dummy #405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Closed

dummy #405

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
2 changes: 1 addition & 1 deletion ngencerf/start-template-v3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ cd ${service_ngencerf_docker_dir}
#docker compose run --rm --service-ports --entrypoint bash --name ${container_name} ngencerf-ui

if [[ "${service_build}" == "true" ]]; then
docker compose -f production-pw.yaml up --build -d
CACHE_BUST=$(date +%s) docker compose -f production-pw.yaml up --build -d
else
docker compose -f production-pw.yaml up -d
fi
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
source utils/load-env.sh
sed -i 's|\\\\|\\|g' inputs.sh
source inputs.sh

set -x
Expand Down
7 changes: 0 additions & 7 deletions utils/steps-v3/preprocessing/preprocessing.sh

This file was deleted.

9 changes: 0 additions & 9 deletions utils/steps-v3/preprocessing/process_inputs_sh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ fi

sed -i "s/__job_number__/${job_number}/g" resources/host/inputs.sh

# RUN IN CONTROLLER, SLURM PARTITION OR PBS QUEUE?
if [[ ${jobschedulertype} == "CONTROLLER" ]]; then
session_wrapper_dir=controller
else
session_wrapper_dir=partition
fi
echo "export session_wrapper_dir=${session_wrapper_dir}" >> resources/host/inputs.sh


# Paths to the scripts to kill the jobs
echo "export kill_ssh=${pw_job_dir}/kill_ssh.sh" >> resources/host/inputs.sh
echo "export kill_sh=${pw_job_dir}/kill.sh" >> resources/host/inputs.sh
Expand Down
2 changes: 0 additions & 2 deletions workflow/yamls/airflow-host/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ app:
jobs:
preprocessing:
steps:
- name: Preprocessing
run: ./utils/steps-v3/preprocessing/preprocessing.sh
- name: Validating Target Resource
run: ./utils/steps-v3/preprocessing/input_form_resource_wrapper.sh ${{ inputs.pwrl_host.resource.ip }}
- name: Process Inputs
Expand Down
12 changes: 0 additions & 12 deletions workflow/yamls/h2o-3/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ app:
jobs:
preprocessing:
steps:
- name: Preprocessing
run: ./utils/steps-v3/preprocessing/preprocessing.sh
- name: Validating Target Resource
run: ./utils/steps-v3/preprocessing/input_form_resource_wrapper.sh ${{ inputs.pwrl_host.resource.ip }}
- name: Process Inputs
Expand Down Expand Up @@ -144,16 +142,6 @@ jobs:
slug: "${{ needs.create_session.outputs.slug }}"
target: ${{ inputs.pwrl_host.resource.id }}
name: ${{ sessions.session }}
- name: Create service.json File
run: |
cat <<EOF > service.json
{
"URL": "/me",
"PORT": "${{ needs.create_session.outputs.local_port }}",
"SLUG": "${{ needs.create_session.outputs.slug }}\"",
"JOB_STATUS": "Running"
}
EOF

'on':
execute:
Expand Down
12 changes: 0 additions & 12 deletions workflow/yamls/h2o-3/noaa-v3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ app:
jobs:
preprocessing:
steps:
- name: Preprocessing
run: ./utils/steps-v3/preprocessing/preprocessing.sh
- name: Validating Target Resource
run: ./utils/steps-v3/preprocessing/input_form_resource_wrapper.sh ${{ inputs.pwrl_host.resource.ip }}
- name: Process Inputs
Expand Down Expand Up @@ -144,16 +142,6 @@ jobs:
slug: "${{ needs.create_session.outputs.slug }}"
target: ${{ inputs.pwrl_host.resource.id }}
name: ${{ sessions.session }}
- name: Create service.json File
run: |
cat <<EOF > service.json
{
"URL": "/me",
"PORT": "${{ needs.create_session.outputs.local_port }}",
"SLUG": "${{ needs.create_session.outputs.slug }}\"",
"JOB_STATUS": "Running"
}
EOF

'on':
execute:
Expand Down
2 changes: 0 additions & 2 deletions workflow/yamls/juice-server/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ app:
jobs:
preprocessing:
steps:
- name: Preprocessing
run: ./utils/steps-v3/preprocessing/preprocessing.sh
- name: Validating Target Resource
run: ./utils/steps-v3/preprocessing/input_form_resource_wrapper.sh ${{ inputs.pwrl_host.resource.ip }}
- name: Process Inputs
Expand Down
2 changes: 0 additions & 2 deletions workflow/yamls/jupyter-docker/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ app:
jobs:
preprocessing:
steps:
- name: Preprocessing
run: ./utils/steps-v3/preprocessing/preprocessing.sh
- name: Validating Target Resource
run: ./utils/steps-v3/preprocessing/input_form_resource_wrapper.sh ${{ inputs.pwrl_host.resource.ip }}
- name: Process Inputs
Expand Down
2 changes: 0 additions & 2 deletions workflow/yamls/jupyter-host/emed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ app:
jobs:
preprocessing:
steps:
- name: Preprocessing
run: ./utils/steps-v3/preprocessing/preprocessing.sh
- name: Validating Target Resource
run: ./utils/steps-v3/preprocessing/input_form_resource_wrapper.sh ${{ inputs.pwrl_host.resource.ip }}
- name: Process Inputs
Expand Down
2 changes: 0 additions & 2 deletions workflow/yamls/jupyter-host/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ app:
jobs:
preprocessing:
steps:
- name: Preprocessing
run: ./utils/steps-v3/preprocessing/preprocessing.sh
- name: Validating Target Resource
run: ./utils/steps-v3/preprocessing/input_form_resource_wrapper.sh ${{ inputs.pwrl_host.resource.ip }}
- name: Process Inputs
Expand Down
2 changes: 0 additions & 2 deletions workflow/yamls/jupyter-host/noaa-v3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ app:
jobs:
preprocessing:
steps:
- name: Preprocessing
run: ./utils/steps-v3/preprocessing/preprocessing.sh
- name: Validating Target Resource
run: ./utils/steps-v3/preprocessing/input_form_resource_wrapper.sh ${{ inputs.pwrl_host.resource.ip }}
- name: Process Inputs
Expand Down
2 changes: 0 additions & 2 deletions workflow/yamls/jupyterhub-host/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ app:
jobs:
preprocessing:
steps:
- name: Preprocessing
run: ./utils/steps-v3/preprocessing/preprocessing.sh
- name: Validating Target Resource
run: ./utils/steps-v3/preprocessing/input_form_resource_wrapper.sh ${{ inputs.pwrl_host.resource.ip }}
- name: Process Inputs
Expand Down
2 changes: 0 additions & 2 deletions workflow/yamls/jupyterlab-host/emed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ app:
jobs:
preprocessing:
steps:
- name: Preprocessing
run: ./utils/steps-v3/preprocessing/preprocessing.sh
- name: Validating Target Resource
run: ./utils/steps-v3/preprocessing/input_form_resource_wrapper.sh ${{ inputs.pwrl_host.resource.ip }}
- name: Process Inputs
Expand Down
2 changes: 0 additions & 2 deletions workflow/yamls/jupyterlab-host/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ app:
jobs:
preprocessing:
steps:
- name: Preprocessing
run: ./utils/steps-v3/preprocessing/preprocessing.sh
- name: Validating Target Resource
run: ./utils/steps-v3/preprocessing/input_form_resource_wrapper.sh ${{ inputs.pwrl_host.resource.ip }}
- name: Process Inputs
Expand Down
4 changes: 1 addition & 3 deletions workflow/yamls/jupyterlab-host/noaa-v3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ app:

jobs:
preprocessing:
steps:
- name: Preprocessing
run: ./utils/steps-v3/preprocessing/preprocessing.sh
steps:
- name: Validating Target Resource
run: ./utils/steps-v3/preprocessing/input_form_resource_wrapper.sh ${{ inputs.pwrl_host.resource.ip }}
- name: Process Inputs
Expand Down
122 changes: 79 additions & 43 deletions workflow/yamls/k8s/jupyter/general.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
permissions:
- '*'

sessions:
expose:
session:
redirect: true


app:
target: inputs.pwrl_host.resource
target: inputs.cluster

jobs:
auth:
Expand All @@ -21,11 +21,41 @@ jobs:
run: |
job_number=$(pwd | rev | cut -d "/" -f1 | rev)
workflow_name=$(pwd | rev | cut -d "/" -f2 | rev)
app_name="${PW_USER}-${workflow_name}-${job_number}-$(date +%s)"
echo "app_name=${app_name}" | tee -a $OUTPUTS
app_name="${PW_USER}-${workflow_name}-${job_number}"
echo "app_name=${app_name}" | tee -a $OUTPUTS | tee -a OUTPUTS
- name: Creating Deployment and Service YAML
run: |
cat <<EOF > app.yaml

apiVersion: v1
kind: ConfigMap
metadata:
name: ${{ needs.k8s_deployment.outputs.app_name }}-cm
namespace: ${{ inputs.namespace }}
data:
config.conf: |
server {
listen 8889;
server_name _;
index index.html index.htm index.php;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,Keep-Alive,X-Requested-With,If-Modified-Since';
add_header X-Frame-Options "ALLOWALL";
client_max_body_size 1000M;
location / {
proxy_pass http://127.0.0.1:${{ inputs.k8sPort }}/me/session/${PW_USER}/${{ sessions.session }}/;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header Host \$http_host;
proxy_set_header X-NginX-Proxy true;
}
}

---

apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -46,6 +76,24 @@ jobs:
image: ${{ inputs.image }}
ports:
- containerPort: ${{ inputs.k8sPort }}

command: ["start-notebook.sh"]
args:
- "--ServerApp.trust_xheaders=True"
- "--ServerApp.allow_origin='*'"
- "--ServerApp.allow_remote_access=True"
- "--ServerApp.base_url='/me/session/${PW_USER}/${{ sessions.session }}/'"
- name: nginx
image: nginxinc/nginx-unprivileged:1.25.3
ports:
- containerPort: 8889
volumeMounts:
- name: ${{ needs.k8s_deployment.outputs.app_name }}-cm-volume
mountPath: /etc/nginx/conf.d
volumes:
- name: ${{ needs.k8s_deployment.outputs.app_name }}-cm-volume
configMap:
name: ${{ needs.k8s_deployment.outputs.app_name }}-cm
---
apiVersion: v1
kind: Service
Expand All @@ -57,53 +105,33 @@ jobs:
app: ${{ needs.k8s_deployment.outputs.app_name }}
ports:
- protocol: TCP
port: ${{ inputs.k8sPort }}
targetPort: ${{ inputs.k8sPort }}
type: LoadBalancer
port: 8889
targetPort: 8889
EOF

- name: Dry Run Deployment
run: |
echo "Performing dry run..."
kubectl apply -f app.yaml --dry-run=client
cleanup: |
touch cleanup.completed

- name: Apply Deployment and Service
run: kubectl apply -f app.yaml
cleanup: |
{
kubectl delete deployment ${{ needs.k8s_deployment.outputs.app_name }} -n ${{ inputs.namespace }} --wait=true --timeout=60s
} || {
kubectl delete deployment ${{ needs.k8s_deployment.outputs.app_name }} -n ${{ inputs.namespace }} --force
}
kubectl delete svc ${{ needs.k8s_deployment.outputs.app_name }}-lb -n ${{ inputs.namespace }}
kubectl delete -f app.yaml
touch cleanup.completed
- name: Wait for Deployment to be Ready
run: kubectl rollout status deployment/${{ needs.k8s_deployment.outputs.app_name }} -n ${{ inputs.namespace }}
env:
app_name: ${{ needs.k8s_deployment.outputs.app_name }}
namespace: ${{ inputs.namespace }}
run: kubectl wait --for=condition=available --timeout=120s deployment/${app_name} -n ${namespace}
- name: Wait for Pod to be Ready
run: |
echo "Waiting for pod to be ready..."
kubectl wait --for=condition=Ready pod -l app=${{ needs.k8s_deployment.outputs.app_name }} -n ${{ inputs.namespace }} --timeout=300s
jupyter_pod=$(kubectl get pods -n ${{ inputs.namespace }} -l app=${{ needs.k8s_deployment.outputs.app_name }} --field-selector=status.phase=Running -o jsonpath="{.items[0].metadata.name}")
echo "jupyter_pod=$jupyter_pod" | tee -a $OUTPUTS | tee -a OUTPUTS
- name: Wait for LoadBalancer Service to Get External IP
run: |
echo "Waiting for external IP..."
while true; do
ext_ip=$(kubectl get svc -n ${{ inputs.namespace }} ${{ needs.k8s_deployment.outputs.app_name }}-lb -o jsonpath="{.status.loadBalancer.ingress[0].ip}" 2>/dev/null)
if [[ -n "$ext_ip" && "$ext_ip" != "<none>" ]]; then
echo "External IP found: $ext_ip"
break
fi
sleep 5
done
echo "ext_ip=$ext_ip" | tee -a $OUTPUTS | tee -a OUTPUTS
- name: Stream Logs
run: |
touch ready_to_create_session
kubectl logs -f deployment/${{ needs.k8s_deployment.outputs.app_name }} -n ${{ inputs.namespace }}

create_session:
needs:
- auth
Expand All @@ -120,7 +148,11 @@ jobs:
fi
sleep 2 # Check every second
done
- name: Get URL
- name: Get Service Name
run: |
source OUTPUTS
echo "service_name=${app_name}-lb" | tee -a $OUTPUTS
- name: Get SLUG
run: |
source OUTPUTS
k8s_port="${{ inputs.k8sPort }}"
Expand All @@ -133,27 +165,31 @@ jobs:
fi
done
echo ${JUPYTER_URL}
SLUG=$(echo ${JUPYTER_URL} | sed "s#http://[0-9a-zA-Z.:]\+:${k8s_port}##")
JUPYTER_URL="http://${ext_ip}:${k8s_port}${SLUG}"
echo "JUPYTER_URL=${JUPYTER_URL}" | tee -a $OUTPUTS
slug=$(echo ${JUPYTER_URL} | sed "s#http://[0-9a-zA-Z.:]\+:${k8s_port}##" | sed "s|/me/session/${PW_USER}/${{ sessions.session }}/||g")
echo "slug=${slug}" | tee -a $OUTPUTS
- name: Expose port
uses: parallelworks/update-session
with:
name: ${{ sessions.expose }}
type: link
url: ${{ needs.create_session.outputs.JUPYTER_URL }}
remotePort: '8889'
name: ${{ sessions.session }}
slug: ${{ needs.create_session.outputs.slug }}
targetInfo:
name: ${{ inputs.cluster }}
namespace: ${{ inputs.namespace }}
resourceType: services
resourceName: ${{ needs.create_session.outputs.service_name }}


'on':
execute:
inputs:
cluster:
label: Kubernetes cluster
type: string
default: devinfra1
type: kubernetes-clusters
namespace:
type: string
default: pw-qa-test
label: Namespace
type: kubernetes-namespaces
clusterName: ${{ inputs.cluster }}
image:
label: Job image
type: string
Expand Down
2 changes: 0 additions & 2 deletions workflow/yamls/kasmvnc/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ app:
jobs:
preprocessing:
steps:
- name: Preprocessing
run: ./utils/steps-v3/preprocessing/preprocessing.sh
- name: Validating Target Resource
run: ./utils/steps-v3/preprocessing/input_form_resource_wrapper.sh ${{ inputs.pwrl_host.resource.ip }}
- name: Process Inputs
Expand Down
Loading