Skip to content
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

undefined in docker-compose.devcontainer.build-*.yml #148

Closed
hankei6km opened this issue Jun 14, 2022 · 2 comments
Closed

undefined in docker-compose.devcontainer.build-*.yml #148

hankei6km opened this issue Jun 14, 2022 · 2 comments

Comments

@hankei6km
Copy link

I am trying with the following repository.

  • devcontainer.json use docker compose
  • A workflow is run with GitHub Actions

https://github.com/hankei6km/test-devcontainers-cli-compose

cli

Using @devcontainers/cli directly from within the workflow will succeed.

https://github.com/hankei6km/test-devcontainers-cli-compose/runs/6874333436?check_suite_focus=true

ci

Using devcontainers/ci@v0.2 will result in an error.

https://github.com/hankei6km/test-devcontainers-cli-compose/runs/6874333439?check_suite_focus=true

  [2196 ms] yaml.scanner.ScannerError: while scanning a simple key
    in "/tmp/docker-compose/docker-compose.devcontainer.build-1655184778637.yml", line 3, column 1
  could not find expected ':'
    in "/tmp/docker-compose/docker-compose.devcontainer.build-1655184778637.yml", line 4, column 17

undefined was included when docker-compose.devcontainer.build-1655184778637.yml was displayed

services:
  node:
undefined
      cache_from:
        - ghcr.io/hankei6km/h6-dev-containers:node

files

Below are the contents of the related files.

.devcontainer/devcontainer.json

{
  "name": "node",
  "dockerComposeFile": "docker-compose.yml",
  "service": "node",
  "remoteUser": "vscode",
  "workspaceFolder": "/home/vscode/workspace",
  "extensions": ["esbenp.prettier-vscode"],
  "settings": {
    "[typescript]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[json]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[javascript]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[jsonc]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[html]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
    }
  }
}

.devcontainer/docker-compose.yml

version: '3.8'

services:
  node:
    # image: 'ghcr.io/hankei6km/h6-dev-containers:node'
    build:
      context: .
      dockerfile: Dockerfile
    hostname: node
    user: vscode
    volumes:
      - ../:/home/vscode/workspace
    tty: true
  httpbin:
    image: 'kennethreitz/httpbin:latest'
    hostname: httpbin

.devcontainer/Dockerfile

FROM ghcr.io/hankei6km/h6-dev-containers:node

.github/workflows/test_chk.yaml

name: test_chk
on:
  push:
    branches:
      - '**'
    tags:
      - '!v*'
  workflow_dispatch:

jobs:
  jest:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Build and run dev container task
        uses: devcontainers/ci@v0.2
        continue-on-error: true
        with:
          imageName: ghcr.io/hankei6km/h6-dev-containers
          imageTag: node
          push: never
          runCmd: |
            npm install
            npm run test

      - name: Print failed files
        run: cat /tmp/docker-compose/docker-compose.devcontainer.build-*.yml
@simeon-walker
Copy link

I've just started seeing this after doing some changes that resulted in the container getting updated. Is there a resolution or workaround?

@hankei6km
Copy link
Author

devcontainers/ci latest version also works with Dev Containers using docker-compose.

https://github.com/hankei6km/test-devcontainers-cli-compose/actions/runs/3984321073/jobs/6830415764

Run devcontainers/ci@v0.2
Starting...
Warning: The `save-state` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
Installing @devcontainers/cli...
** Installing @devcontainers/cli
/usr/bin/bash -c npm install -g @devcontainers/cli@latest

added 3 packages, and audited 4 packages in 6s

found 0 vulnerabilities
Adding --cache-from ghcr.io/hankei6km/h6-dev-containers:node to build args
🏗️ build container
🏃 start container
🚀 Run command in container

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

No branches or pull requests

2 participants