schemaVersion: 2.1.0
metadata:
  name: ng-python-stress-test-sqib
  namespace: user1-codeready
attributes:
  .che/che-theia-plugins.yaml: |
    - id: sonarsource/sonarlint-vscode/latest
      override:
        sidecar:
          env:
            - value: /public-certs/ca-certs.ca-bundle.crt
              name: PIP_CERT
            - value: >-
                https://jfrog.uk.ngridtools.com/artifactory/api/pypi/public-proxy-pypi/simple
              name: PIP_INDEX-URL
            - value: /public-certs/ca-certs.ca-bundle.crt
              name: SSL_CERT_FILE
    - id: redhat/dependency-analytics/latest
      override:
        sidecar:
          env:
            - value: /public-certs/ca-certs.ca-bundle.crt
              name: PIP_CERT
            - value: >-
                https://jfrog.uk.ngridtools.com/artifactory/api/pypi/public-proxy-pypi/simple
              name: PIP_INDEX-URL
            - value: /public-certs/ca-certs.ca-bundle.crt
              name: SSL_CERT_FILE
        preferences:
          python.pythonPath: /projects/python-project/.venv/bin/python
    - id: ms-python/python/latest
      override:
        sidecar:
          env:
            - value: >-
                https://jfrog.uk.ngridtools.com/artifactory/api/pypi/public-proxy-pypi/simple
              name: PIP_INDEX-URL
            - value: /public-certs/ca-certs.ca-bundle.crt
              name: SSL_CERT_FILE
            - value: /public-certs/ca-certs.ca-bundle.crt
              name: PIP_CERT
          memoryLimit: 1Gi
          cpuLimit: 1500m
        preferences:
          python.globalModuleInstallation: true
  .vscode/extensions.json: |-
    {
      "recommendations": [
        "sonarsource/sonarlint-vscode",
        "redhat/dependency-analytics",
        "ms-python/python"
      ]
    }
  .vscode/launch.json: |
    {
      "version": "0.2.0",
      "configurations": [
        {
          "name": "Python: Current File",
          "type": "python",
          "request": "launch",
          "program": "${file}",
          "console": "internalConsole"
        }
      ]
    }
  controller.devfile.io/devworkspace-config:
    name: devworkspace-config
    namespace: openshift-workspaces
  controller.devfile.io/storage-type: per-workspace
  dw.metadata.annotations:
    che.eclipse.org/che-editor: eclipse/che-theia/latest
    che.eclipse.org/last-updated-timestamp: '2022-12-01T14:29:54.108Z'
    controller.devfile.io/devworkspace_id_override: workspaceuddv4wjnmicqxgys
  metadata-name-field: name
projects:
  - attributes:
      source-origin: startPoint
    git:
      checkoutFrom:
        revision: develop
      remotes:
        origin: 'ssh://git@bitbucket-ssh.uk.ngridtools.com:7999/efd/bulk-dispatch-optimiser.git'
    name: python-project
components:
  - attributes:
      app.kubernetes.io/name: python
      che-theia.eclipse.org/vscode-extensions:
        - 'http://plugin-registry.openshift-workspaces.svc:8080/resources/github_com/redhat-developer/devspaces-vscode-extensions/releases/download/v8521e74/vscode-sonarlint-1.20.1.vsix'
        - 'http://plugin-registry.openshift-workspaces.svc:8080/resources/github_com/fabric8-analytics/fabric8-analytics-vscode-extension/releases/download/0_3_6/fabric8-analytics-0.3.6.vsix'
        - 'http://plugin-registry.openshift-workspaces.svc:8080/resources/github_com/microsoft/vscode-python/releases/download/2020_7_94776/ms-python-release.vsix'
        - 'http://plugin-registry.openshift-workspaces.svc:8080/resources/github_com/redhat-developer/devspaces-vscode-extensions/releases/download/v2cebc1e/typescript-language-features-1.49.3.vsix'
      che-theia.eclipse.org/vscode-preferences:
        python.globalModuleInstallation: true
        python.pythonPath: /projects/python-project/.venv/bin/python
    container:
      args:
        - sh
        - '-c'
        - '${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}'
      cpuLimit: 2000m
      cpuRequest: 500m
      env:
        - name: PIP_CERT
          value: /public-certs/ca-certs.ca-bundle.crt
        - name: PIP_INDEX-URL
          value: 'https://jfrog.uk.ngridtools.com/artifactory/api/pypi/public-proxy-pypi/simple'
        - name: SSL_CERT_FILE
          value: /public-certs/ca-certs.ca-bundle.crt
        - name: PLUGIN_REMOTE_ENDPOINT_EXECUTABLE
          value: /remote-endpoint/plugin-remote-endpoint
        - name: THEIA_PLUGINS
          value: 'local-dir:///plugins/sidecars/python'
        - name: CHE_DASHBOARD_URL
          value: 'https://codeready-openshift-workspaces.apps.devops02.devops.balancing.nationalgrideso.com'
        - name: CHE_PLUGIN_REGISTRY_URL
          value: 'https://codeready-openshift-workspaces.apps.devops02.devops.balancing.nationalgrideso.com/plugin-registry/v3'
        - name: CHE_PLUGIN_REGISTRY_INTERNAL_URL
          value: 'http://plugin-registry.openshift-workspaces.svc:8080/v3'
      image: 'registry.redhat.io/codeready-workspaces/plugin-java8-rhel8@sha256:81548d8559fdc3ba3e2b1ec398f3bd94728e8e4037a4c3a180177f20c9704db9'
      memoryLimit: 8Gi
      mountSources: true
      sourceMapping: /projects
      volumeMounts:
        - name: venv
          path: /home/jboss/.venv
        - name: m2
          path: /home/user/.m2
        - name: remote-endpoint
          path: /remote-endpoint
        - name: plugins
          path: /plugins
    name: python
  - container:
      env:
        - name: PIP_CERT
          value: /public-certs/ca-certs.ca-bundle.crt
        - name: SSL_CERT_FILE
          value: /public-certs/ca-certs.ca-bundle.crt
        - name: PIP_INDEX-URL
          value: 'https://jfrog.uk.ngridtools.com/artifactory/api/pypi/public-proxy-pypi/simple'
        - name: CHE_DASHBOARD_URL
          value: 'https://codeready-openshift-workspaces.apps.devops02.devops.balancing.nationalgrideso.com'
        - name: CHE_PLUGIN_REGISTRY_URL
          value: 'https://codeready-openshift-workspaces.apps.devops02.devops.balancing.nationalgrideso.com/plugin-registry/v3'
        - name: CHE_PLUGIN_REGISTRY_INTERNAL_URL
          value: 'http://plugin-registry.openshift-workspaces.svc:8080/v3'
      image: 'registry.redhat.io/codeready-workspaces/plugin-java8-rhel8@sha256:81548d8559fdc3ba3e2b1ec398f3bd94728e8e4037a4c3a180177f20c9704db9'
      memoryLimit: 512Mi
      mountSources: true
      sourceMapping: /projects
    name: trufflehog
  - name: venv
    volume: {}
  - name: m2
    volume: {}
commands:
  - exec:
      commandLine: 'mkdir -p /tmp/trufflehog && python -m venv /tmp/trufflehog/.venv && source /tmp/trufflehog/.venv/bin/activate && pip install truffleHog && trufflehog file://${PROJECTS_ROOT}/python-project  | tee ${PROJECTS_ROOT}/python-project/scratchpad-truffle-report.json'
      component: trufflehog
      label: Run truffleHog
      workingDir: '${PROJECTS_ROOT}/python-project'
    id: run-trufflehog
  - exec:
      commandLine: python -m venv .venv && chmod +x k8s/sandbox/sandbox-init.sh && . .venv/bin/activate && pip install -r requirements/dev.txt && deactivate
      component: python
      label: 0. Initialize
      workingDir: '${PROJECTS_ROOT}/python-project'
    id: initialize
  - exec:
      commandLine: . .venv/bin/activate && cd bdo_server && python main.py
      component: python
      label: 1. Run BDO Server
      workingDir: '${PROJECTS_ROOT}/python-project'
    id: run-bdo-server
  - exec:
      commandLine: bash k8s/sandbox/sandbox-init.sh
      component: python
      label: 2. Build image
      workingDir: '${PROJECTS_ROOT}/python-project'
    id: build-image
  - exec:
      commandLine: oc apply -k k8s/sandbox/deploy-components
      component: python
      label: 3. Deploy application
      workingDir: '${PROJECTS_ROOT}/python-project'
    id: deploy-application
  - exec:
      commandLine: oc get route --selector app=bdo-server --selector=env=sandbox
      component: python
      label: 4. Get Routes to deployments
      workingDir: '${PROJECTS_ROOT}/python-project'
    id: get-routes-to-deployments
  - exec:
      commandLine: oc delete -k k8s/sandbox/deploy-components
      component: python
      label: 5. Clean up application
      workingDir: '${PROJECTS_ROOT}/python-project'
    id: clean-up-application
