Update Code with Dev Spaces

This module walks through edit in web IDE → commit to Gitea → Tekton pipeline → new deployment, using Red Hat OpenShift Dev Spaces and the neuralbank-backend component.

Open the Component in Developer Hub

  1. Log in to Developer Hub.

  2. Find neuralbank-backend in the Catalog and open its page.

  3. Click Open in Dev Spaces (or the equivalent plugin action).

If the button is missing, copy the repository URL from Gitea and create a workspace in Dev Spaces manually.

Wait for the Workspace to Start

  1. Wait until DevWorkspace reaches Running state.

  2. Open the IDE in the browser.

The workspace uses the devfile.yaml generated by the template:

schemaVersion: 2.2.2
metadata:
  name: neuralbank-backend
components:
  - name: tools
    container:
      image: registry.redhat.io/devspaces/udi-rhel8:latest
      memoryLimit: 3Gi
      mountSources: true
commands:
  - id: build
    exec:
      component: tools
      commandLine: mvn -q package -DskipTests
      workingDir: ${PROJECT_SOURCE}
  - id: run
    exec:
      component: tools
      commandLine: mvn quarkus:dev
      workingDir: ${PROJECT_SOURCE}

Make a Code Change

In the IDE file explorer, find a REST resource class (e.g., CustomerResource.java).

Make a small, safe change:

  • Add a GET endpoint that returns an identifiable message (/api/hello-workshop)

  • Or change a response body to include a recognizable string

Avoid changing artifact names, Dockerfile, or pipeline paths unless the workshop instructs it.

Build Locally in the Workspace

cd /projects/neuralbank-backend
mvn -q package -DskipTests

Fix compile errors before continuing; the remote pipeline will fail the same way.

Commit and Push to Gitea

git status
git add <modified-files>
git commit -m "workshop: demo change from Dev Spaces"
git push origin main

Watch the Tekton Pipeline

  1. Go to OpenShift Console → Pipelines → PipelineRuns in project user1-neuralbank.

  2. Identify a new run triggered by the recent push.

The Gitea webhook uses an internal service URL to trigger the EventListener:

http://el-neuralbank-backend-listener.{user_name}-neuralbank.svc.cluster.local:8080

This avoids TLS certificate issues with self-signed cluster certificates.

Verify Deployment of the New Version

  1. Under Workloads → Pods, confirm the Deployment performed a rollout (new pods with a recent timestamp).

  2. Try the endpoints again:

API_KEY=$(oc get secret user1-neuralbank-backend-apikey \
  -n user1-neuralbank \
  -o jsonpath='\{.data.api_key}' | base64 -d)

curl -s -H "X-API-Key: $API_KEY" \
  "https://neuralbank-backend-user1-neuralbank.apps.cluster.example.com/api/hello-workshop"

You should see the change reflected in the response.

Summary

You demonstrated the full cycle Dev Spaces → Git → Tekton → OpenShift, aligned with GitOps and the component card in Developer Hub. Developers stay in a consistent environment while the platform applies standards and automation.