Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
3 changes: 2 additions & 1 deletion .github/workflows/build-samples-json.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: Trigger Docs Samples Rebuild

on:
push:
branches: main
branches:
- main
paths:
- 'samples/**'

Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/check-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,14 @@ jobs:
- name: Run Checks
id: checks
run: |
eval "$(curl -fsSL s.defang.io/install)"
./scripts/check-sample-files.sh > checklist.txt
./scripts/check-modified-samples.sh > modified.txt
echo "@@ MODIFIED @@"
cat modified.txt

# TODO: Uncomment the following lines to validate the Compose files
# once we figure out how to prevent it from erroring on warnings.
# - name: Validate Compose Files with Defang CLI
# run: |
# eval "$(curl -fsSL s.defang.io/install)"
# cat modified.txt | xargs -n1 defang compose config -C > /dev/null
- name: Validate Compose Files with Defang CLI
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lionello not sure we need this: it's currently checked by the deploy_changed_samples. Though... that one is erroring with:

2025/06/16 17:11:08 Deployer 0: failed to run test crew-django-redis-postgres: failed to load configs for test crew-django-redis-postgres: failed to load project: validating /home/runner/work/samples/samples/samples/crew-django-redis-postgres/compose.yaml: services.embedding Additional property provider is not allowed

So if this one takes into account the new provider property, then maybe we switch it?

run: |
cat modified.txt | xargs --no-run-if-empty -n1 defang compose config -C

- name: Add checklist to PR description
uses: actions/github-script@v5
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/publish-sample-template.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
name: Publish Sample Template

on:
push:
push:
branches:
- main
paths:
- 'samples/**'
- 'scripts/template-manager.js'
- 'scripts/check-modified-samples.sh'

jobs:
publish_samples:
runs-on: ubuntu-latest
permissions:
permissions:
contents: write
pull-requests: write
steps:
Expand Down
2 changes: 1 addition & 1 deletion samples/nextjs/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ RUN npm run build
EXPOSE 3000

# Start the app
CMD ["npm", "start"]
CMD ["npm", "start"]
2 changes: 1 addition & 1 deletion samples/nextjs/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"start": "exec next start",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lionello why exec? That's not standard.

"lint": "next lint"
},
"dependencies": {
Expand Down
6 changes: 3 additions & 3 deletions samples/nextjs/compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
app:
restart: unless-stopped
# domainname: mydomain.com # if you want to use your own domain
# domainname: demo.example.com # Uncomment to set a specific domain name for the service
build:
context: ./app
dockerfile: Dockerfile
Expand All @@ -17,5 +17,5 @@ services:
deploy:
resources:
reservations:
cpus: '0.50'
memory: 512M
cpus: '0.25'
memory: 256M
1 change: 1 addition & 0 deletions tools/testing/deployer/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ func (d *CliDeployer) Cleanup(ctx context.Context) error {
}

func (d *CliDeployer) RunCommand(ctx context.Context, opt func(*exec.Cmd), command string, args ...string) (*exec.Cmd, error) {
log.Printf("Running command in dir %q: %q %q", d.WorkDir, command, args)
cmd := exec.CommandContext(ctx, command, args...)
cmd.Env = d.EnvVars
if d.WorkDir != "" {
Expand Down
4 changes: 2 additions & 2 deletions tools/testing/test/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ func Run(ctx context.Context, test TestInfo) (*ItemResult, error) {
// declare variable for url
var url string

// Regular expression to capture an "https://" URL that follows "will be available at:"
re := regexp.MustCompile(`will be available at:\s*.*?(https://[^\s]+)`)
// Regular expression to capture an "https://" URL that follows "DEPLOYMENT_COMPLETED"
re := regexp.MustCompile(`DEPLOYMENT_COMPLETED\s*((?:https?://)?[^\s]+)`)

// Find the first match in the output string
match := re.FindStringSubmatch(outputStr)
Expand Down
Loading