No container mounting host path found (OD-1998)
Dylan Vos opened 1 year ago

I've got below .onedev-buildspec.yml - but I am running into a strange issue - I've got multiple Jobs - one for each kind of files change - the Typescript and Javascript ones run without issues - but my new Dependencies one throws a weird error on my PreDeploy step: No container mounting host path found: please make sure to use bind mount to launch OneDev server/agent The only difference between the PreDeploy step of this job in-regard to the other ones - is that it uses a different container node:latest as I need NPM here.

Any idea why only this one throws an error?

version: 25
jobs:
  - name: Automations - Dependencies
    steps:
      - !CheckoutStep
        name: Checkout
        cloneCredential: !DefaultCredential {}
        withLfs: false
        withSubmodules: false
        condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
      - !CommandStep
        name: PreDeploy
        runInContainer: true
        image: node:latest
        interpreter: !DefaultInterpreter
          commands:
            - mkdir dependencies
            - cd dependencies
            - if ! [ -f ../.build/automations-handle-dependencies-pre-deploy.js ]; then
            -   echo "Could not find required script '../.build/automations-handle-dependencies-pre-deploy.js'!"~
            -   exit 1
            - fi
            - ../.build/automations-handle-dependencies-pre-deploy.js
            - ""
            - npm install --omit=dev
        useTTY: true
        condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
      - !CommandStep
        name: Deploy
        runInContainer: true
        image: drinternet/rsync:v1.4.3
        interpreter: !DefaultInterpreter
          commands:
            - echo "Starting Agent '@project_name@-@build_number@-@commit_hash@'"
            - source agent-start "@project_name@-@build_number@-@commit_hash@"
            - ""
            - echo "Adding Hosts"
            - hosts-add "@secret:Vos_IoT_Center-Openhab_Known_Hosts@"
            - ""
            - echo "Adding Key"
            - echo "@secret:Vos_IoT_Center-Openhab_SSH_Key@" | agent-add "@project_name@-@build_number@-@commit_hash@"
            - ""
            - ssh openhab@@@property:deploy_host@ "rm -rf /mnt/data/@project_name@/openhab/conf/automation/js/node_modules"
            - echo "Running RSync"
            - rsync \
            - "\t-avm \\"
            - "\tdependencies/node_modules/ \\"
            - "\topenhab@@@property:deploy_host@:/mnt/data/@project_name@/openhab/conf/automation/js/node_modules/"
            - ""
            - echo "Stopping Agent '@project_name@-@build_number@-@commit_hash@'"
            - agent-stop "@project_name@-@build_number@-@commit_hash@"
        useTTY: true
        condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
      - !CommandStep
        name: PostDeploy
        runInContainer: true
        image: bash:latest
        interpreter: !DefaultInterpreter
          commands:
            - echo "@commit_hash@" > shared/last_job_commit_hash
        useTTY: true
        condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
    triggers:
      - !BranchUpdateTrigger
        branches: master
        paths: src/openhab/automation/js/package.json src/openhab/automation/ts/package.json
    retryCondition: never
    maxRetries: 3
    retryDelay: 30
    caches:
      - key: shared_between_job_runs_for_automations_javascript
        path: shared
    timeout: 3600
  - name: Automations - JavaScript
    steps:
      - !CheckoutStep
        name: Checkout
        cloneCredential: !DefaultCredential {}
        withLfs: false
        withSubmodules: false
        condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
      - !CommandStep
        name: PreDeploy
        runInContainer: true
        image: bitnami/git:latest
        interpreter: !DefaultInterpreter
          commands:
            - .build/automations-pre-deploy-step.sh \
            - src/openhab/automation/js \
            - /mnt/data/@project_name@/openhab/conf/automation/js
        useTTY: true
        condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
      - !CommandStep
        name: Deploy
        runInContainer: true
        image: drinternet/rsync:v1.4.3
        interpreter: !DefaultInterpreter
          commands:
            - echo "Starting Agent '@project_name@-@build_number@-@commit_hash@'"
            - source agent-start "@project_name@-@build_number@-@commit_hash@"
            - ""
            - echo "Adding Hosts"
            - hosts-add "@secret:Vos_IoT_Center-Openhab_Known_Hosts@"
            - ""
            - echo "Adding Key"
            - echo "@secret:Vos_IoT_Center-Openhab_SSH_Key@" | agent-add "@project_name@-@build_number@-@commit_hash@"
            - ""
            - if ! [ -f .build/automations-deploy-remove-old-files.sh ]; then
            -   echo "Could not find required script '.build/automations-deploy-remove-old-files.sh'!"~
            -   exit 1
            - fi
            - .build/automations-deploy-remove-old-files.sh @property:deploy_host@
            - ""
            - echo "Running RSync"
            - rsync \
            - "\t-avm \\"
            - "\t--include='*/' \\"
            - "\t--include='*.js' \\"
            - "\t--exclude='*' \\"
            - "\tsrc/openhab/automation/js/ \\"
            - "\topenhab@@@property:deploy_host@:/mnt/data/@project_name@/openhab/conf/automation/js/"
            - ""
            - echo "Stopping Agent '@project_name@-@build_number@-@commit_hash@'"
            - agent-stop "@project_name@-@build_number@-@commit_hash@"
        useTTY: true
        condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
      - !CommandStep
        name: PostDeploy
        runInContainer: true
        image: bash:latest
        interpreter: !DefaultInterpreter
          commands:
            - echo "@commit_hash@" > shared/last_job_commit_hash
        useTTY: true
        condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
    triggers:
      - !BranchUpdateTrigger
        branches: master
        paths: src/openhab/automation/js/*.js src/openhab/automation/js/**/*.js
    retryCondition: never
    maxRetries: 3
    retryDelay: 30
    caches:
      - key: shared_between_job_runs_for_automations_javascript
        path: shared
    timeout: 3600
  - name: Automations - TypeScript
    steps:
      - !CheckoutStep
        name: Checkout
        cloneCredential: !DefaultCredential {}
        withLfs: false
        withSubmodules: false
        condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
      - !CommandStep
        name: PreDeploy
        runInContainer: true
        image: bitnami/git:latest
        interpreter: !DefaultInterpreter
          commands:
            - .build/automations-pre-deploy-step.sh \
            - src/openhab/automation/ts \
            - /mnt/data/@project_name@/openhab/conf/automation/js \
            - -e 's/\.ts/\.js/' \
            - -e 's/\/src\//\//'
        useTTY: true
        condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
      - !CommandStep
        name: Build
        runInContainer: true
        image: node:21-alpine
        interpreter: !DefaultInterpreter
          commands:
            - cd src/openhab/automation/ts
            - npm ci
            - npm run build
        useTTY: true
        condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
      - !CommandStep
        name: Deploy
        runInContainer: true
        image: drinternet/rsync:v1.4.3
        interpreter: !DefaultInterpreter
          commands:
            - echo "Starting Agent '@project_name@-@build_number@-@commit_hash@'"
            - source agent-start "@project_name@-@build_number@-@commit_hash@"
            - ""
            - echo "Adding Hosts"
            - hosts-add "@secret:Vos_IoT_Center-Openhab_Known_Hosts@"
            - ""
            - echo "Adding Key"
            - echo "@secret:Vos_IoT_Center-Openhab_SSH_Key@" | agent-add "@project_name@-@build_number@-@commit_hash@"
            - ""
            - if ! [ -f .build/automations-deploy-remove-old-files.sh ]; then
            -   echo "Could not find required script '.build/automations-deploy-remove-old-files.sh'!"~
            -   exit 1
            - fi
            - .build/automations-deploy-remove-old-files.sh @property:deploy_host@
            - ""
            - echo "Running RSync"
            - rsync \
            - "\t-avmc \\"
            - "\t--include='*/' \\"
            - "\t--include='*.js' \\"
            - "\t--exclude='*' \\"
            - "\tsrc/openhab/automation/ts/out/ \\"
            - "\topenhab@@@property:deploy_host@:/mnt/data/@project_name@/openhab/conf/automation/js/"
            - ""
            - echo "Stopping Agent '@project_name@-@build_number@-@commit_hash@'"
            - agent-stop "@project_name@-@build_number@-@commit_hash@"
        useTTY: true
        condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
      - !CommandStep
        name: PostDeploy
        runInContainer: true
        image: bash:latest
        interpreter: !DefaultInterpreter
          commands:
            - echo "@commit_hash@" > shared/last_job_commit_hash
        useTTY: true
        condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
    triggers:
      - !BranchUpdateTrigger
        branches: master
        paths: src/openhab/automation/ts/*.ts src/openhab/automation/ts/**/*.ts
    retryCondition: never
    maxRetries: 3
    retryDelay: 30
    caches:
      - key: shared_between_job_runs_for_automations_typescript
        path: shared
    timeout: 3600
  • Dylan Vos commented 1 year ago

    Full stacktrace:

    
    
    13:10:54 Pending resource allocation...
    13:10:54 Executing job (executor: OneDev-Server, server: 172.25.0.3:5710, network: OneDev-Server-2-93-0)...
    13:10:54 Copying job dependencies...
    13:10:54 Running step "Checkout"...
    13:10:54 Checking out code...
    13:10:54 Switched to branch 'master'
    13:10:54 branch 'master' set up to track 'origin/master'.
    13:10:54 Step "Checkout" is successful (0 seconds)
    13:10:54 Running step "PreDeploy"...
    13:10:54 java.lang.IllegalStateException: No container mounting host path found: please make sure to use bind mount to launch OneDev server/agent
    	at io.onedev.agent.DockerExecutorUtils.getHostPath(DockerExecutorUtils.java:788)
    	at io.onedev.server.plugin.executor.serverdocker.ServerDockerExecutor.getHostPath(ServerDockerExecutor.java:665)
    	at io.onedev.server.plugin.executor.serverdocker.ServerDockerExecutor$1$1.runStepContainer(ServerDockerExecutor.java:364)
    	at io.onedev.server.plugin.executor.serverdocker.ServerDockerExecutor$1$1.lambda$doExecute$2(ServerDockerExecutor.java:455)
    	at io.onedev.agent.DockerExecutorUtils.callWithDockerConfig(DockerExecutorUtils.java:486)
    	at io.onedev.server.plugin.executor.serverdocker.ServerDockerExecutor$1$1.doExecute(ServerDockerExecutor.java:454)
    	at io.onedev.server.plugin.executor.serverdocker.ServerDockerExecutor$1$1.lambda$execute$1(ServerDockerExecutor.java:425)
    	at io.onedev.agent.ExecutorUtils.runStep(ExecutorUtils.java:100)
    	at io.onedev.server.plugin.executor.serverdocker.ServerDockerExecutor$1$1.execute(ServerDockerExecutor.java:422)
    	at io.onedev.k8shelper.LeafFacade.execute(LeafFacade.java:12)
    	at io.onedev.k8shelper.CompositeFacade.execute(CompositeFacade.java:35)
    	at io.onedev.server.plugin.executor.serverdocker.ServerDockerExecutor$1.run(ServerDockerExecutor.java:337)
    	at io.onedev.server.job.DefaultJobManager.runJob(DefaultJobManager.java:1362)
    	at io.onedev.server.plugin.executor.serverdocker.ServerDockerExecutor.lambda$execute$fee504de$1(ServerDockerExecutor.java:269)
    	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    	at com.hazelcast.executor.impl.DistributedExecutorService$Processor.run(DistributedExecutorService.java:276)
    	at com.hazelcast.internal.util.executor.CachedExecutorServiceDelegate$Worker.run(CachedExecutorServiceDelegate.java:217)
    	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    	at java.base/java.lang.Thread.run(Thread.java:829)
    	at com.hazelcast.internal.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:76)
    	at com.hazelcast.internal.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:111)
    13:10:54 Step "Deploy" is skipped
    13:10:54 Step "PostDeploy" is skipped
    13:10:56 Job finished
    
  • Dylan Vos commented 1 year ago

    And nevermind - recreating the OneDev container fixes it...

  • Dylan Vos changed state to 'Closed' 1 year ago
    Previous Value Current Value
    Open
    Closed
  • Dylan Vos commented 1 year ago

    Fixed by recreating the server container

issue 1/1
Type
Question
Priority
Normal
Assignee
Labels
No labels
Issue Votes (0)
Watchers (2)
Reference
OD-1998
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover