Skip to content

Modernize demo sample to Radius.* resource types and add Redis/Postgr… - #2645

Merged
willdavsmith merged 8 commits into
radius-project:edgefrom
zachcasper:edge
Aug 17, 2026
Merged

Modernize demo sample to Radius.* resource types and add Redis/Postgr…#2645
willdavsmith merged 8 commits into
radius-project:edgefrom
zachcasper:edge

Conversation

@zachcasper

Copy link
Copy Markdown
Contributor

Summary

Updates the demo sample to the current Radius.* resource types and adds two datastore variants that show how to connect the demo container to a managed cache and database.

Changes

  • samples/demo/app.bicep

    • Migrate from deprecated Applications.* (2023-10-01-preview) to Radius.* (2025-08-01-preview) resource types.
    • Split into a dedicated Radius.Core/applications resource plus a Radius.Compute/containers resource using the new nested containers map schema.
    • Derive environmentName from the Environment ID and suffix resource names (demo-${environmentName}) so multiple environments (dev/test/prod) can coexist in the same resource group without name collisions.
  • samples/demo/app-redis.bicep (new)

    • Demo container connected to a Radius.Data/redisCaches cache via a connections.redis link.
  • samples/demo/app-postgresql.bicep (new)

    • Demo container connected to a Radius.Data/postgreSqlDatabases database via a connections.postgresql link.
    • Admin password supplied through a @secure() parameter (never stored in the file).

Deploy

rad deploy samples/demo/app.bicep
rad deploy samples/demo/app-redis.bicep
rad deploy samples/demo/app-postgresql.bicep -p password=$(openssl rand -hex 16)

…eSQL variants

Signed-off-by: Zach Casper <zachcasper@microsoft.com>
Signed-off-by: Zach Casper <zachcasper@microsoft.com>
Signed-off-by: Zach Casper <zachcasper@microsoft.com>
Signed-off-by: Zach Casper <zachcasper@microsoft.com>
Signed-off-by: Zach Casper <zachcasper@microsoft.com>
Signed-off-by: Zach Casper <zachcasper@microsoft.com>
Signed-off-by: Zach Casper <zachcasper@microsoft.com>
@zachcasper
zachcasper marked this pull request as ready for review August 14, 2026 22:44
@zachcasper
zachcasper requested review from a team as code owners August 14, 2026 22:44
willdavsmith added a commit that referenced this pull request Aug 17, 2026
PR #2645 dropped the 'image' parameter from samples/demo/app.bicep, but the
demo entry in .github/workflows/test.yaml deploys with
'-p image=sampleregistry:5000/samples/demo' so the test exercises the
freshly-built image rather than the published ghcr.io one. ARM rejects -p for
an undeclared parameter, so the job would fail.

Restore the parameter (default-valued, so plain 'rad deploy' is unchanged) in
all three files instead of editing the workflow.
Comment thread .github/workflows/test.yaml
Comment thread .github/workflows/test.yaml
@willdavsmith
willdavsmith merged commit 77b996a into radius-project:edge Aug 17, 2026
13 checks passed
@zachcasper
zachcasper deleted the edge branch August 17, 2026 16:56
sk593 added a commit to radius-project/radius that referenced this pull request Aug 17, 2026
The modernized sample (radius-project/samples#2645) removed the inline redis
resource, so the demo app runs without a configured database and stores todo
items in memory. Its GET /api/todos responses now include the message
"No database is configured, items will be stored in memory." instead of null.
Update the three expected list-response bodies to assert that message; the
functional test deploy and pod validation already pass, this was the remaining
assertion failure.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: sk593 <shruthikumar@microsoft.com>
pujitha24 pushed a commit to pujitha24/radius that referenced this pull request Aug 18, 2026
…ple (radius-project#12697)

## Root cause

The repo-wide `Functional Tests - samples-noncloud` job is failing on
`main` since the samples repo was updated
[radius-project/samples#2645](radius-project/samples#2645)
("Modernize demo sample to Radius.* resource types").

radius CI checks out the samples repo at `refs/heads/edge`
(`.github/workflows/functional-test-noncloud.yaml`). That samples PR
merged into `edge`, so CI now pulls a modernized
`samples/demo/app.bicep` that:

- uses `Radius.Core/applications` + `Radius.Compute/containers` at
`2025-08-01-preview` (was `Applications.Core`),
- has **no** `application` parameter (only `environment`),
- names the app/container `demo-${environmentName}` → `demo-tutorial`
for the `tutorial` environment,
- removes the inline `Applications.Datastores/redisCaches` resource
(redis now lives in a separate `app-redis.bicep` this test does not
deploy).

The consuming `Test_FirstApplicationSample` still used the legacy
`Applications.Core` types and app name `demo`, and passed
`--application`, producing a deploy 404 (container created under
`Radius.Compute/containers/demo-tutorial`, app looked up under
`Applications.Core/applications/demo-tutorial`).

## Changes

**`testdata/tutorial-environment.bicep`**
- Modernized to `Radius.Core/environments@2025-08-01-preview` named
`tutorial` with `properties.providers.kubernetes.namespace: 'tutorial'`.
- Removed the redis recipe registration and the now-unused
`registry`/`version` params. `rad deploy` injects the default recipe
pack, which supplies the `Radius.Compute/containers` recipe, so no
explicit pack is needed.

**`tutorial_test.go` (`Test_FirstApplicationSample`)**
- Env-deploy executor no longer passes `registry`/`version` bicep
params.
- App-deploy step drops `.WithApplication(...)`; keeps
`.WithEnvironment("tutorial")`.
- Expected `RPResources` updated: application `demo-tutorial`
(`radius.core/applications`) and container `demo-tutorial`
(`radius.compute/containers`); removed the redis `db` expectation.
- Pod port-forward + K8s validation now target the `demo-tutorial`
resource selector in the environment namespace `tutorial` (recipe-driven
`Radius.Compute/containers` pods land in the env's Kubernetes namespace,
matching existing modern container tests).

This unblocks the repo-wide `samples-noncloud` functional test failure.

## Validation

- `go build ./test/...` passes.
- `go vet ./test/functional-portable/samples/...` passes.
- End-to-end run requires a kind cluster with Radius installed and
`RADIUS_SAMPLES_REPO_ROOT` pointing at a samples `edge` checkout; the
logic mirrors the modernized sample and existing modern
`Radius.Compute/containers` functional tests.

---------

Signed-off-by: sk593 <shruthikumar@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants