Run a script in a worker container from an external feed

Hi all,

Apologies if this question has been answered before, I combed the forums and couldn’t see anything specific to my issue, nor did my Google-Fu return anything useful.

Hi all,

Pre-apologies if this does not fit this sub.

What I am trying to do:

  • I am using hosted Octopus Deploy. I need to run an AWS CloudFormation job from a Octopus worker. The job is written in NodeJS.

How I am trying to do it:

  • I am trying to use a dynamic Ubuntu 18.04 worker node that is offered on the hosted Octopus Deploy variant.
  • I am trying to get the Ubuntu worker node to spin up a custom Alpine container from AWS ECR that contains all dependencies for the deployment. (I don’t want to have to install all dependencies on the worker directly per deployment).
  • I am trying to run a script in a GitHub repository on the Alpine container.

What is happening:

  • The Ubuntu worker node gets the Alpine container and the GitHub repository containing the script successfully.
  • The GitHub repository is unzipped to /home/Octopus/work/xxxxxxxxx-xxxx-50 (notice the 50 at the end). This is the current working directory for this step.
  • The Ubuntu worker then spins up the Alpine container successfully, but mounts the wrong directory. It mounts /home/Octopus/work/xxxxxxxxx-xxxx-51 (notice the working directory has changed 51).
  • The script attempts to execute an fails with standard_init_linux.go:211: exec user process caused "no such file or directory" which appears to be a Docker error message. A verbose message states that Process /bin/bash in /home/Octopus/work/xxxxxxxxx-xxxx-51 exited with code 1 `

What I have already tried:

  • Running the same steps above but directory on the Ubuntu worker. It is successful as the working directory is not changing from 50 to 51.
  • Moving the package to /home/Octopus (as this directory is mounted within the Alpine container), then using an inline script (i.e. copy/pasted code directly into the step rather than an external script from GitHub) to call the script that was moved to /home/Octopus. This fails as the inline script in the step is being placed into working directory 50 then 51 is being mounted to the container.
  • Simply running an inline script within a container. Also fails with the same issue of the wrong working directory.

Any help to be able to even run a Hello World script from within my Alpine container will be greatly appreciated!!!

Hey @platform_admin,

Thanks for reaching out.

Would it be okay if I logged into your cloud instance to take a look at your deployment process and logs?

I assume the instance is the same as the domain for your email address?

If that is okay, can you please tell me which project to look in to find this information in?

Please let me know.

Thanks,
Jeremy

Hi @jeremy.miller !

Sincerely appreciate the assistance! You are more than welcome to login as required to take a look. You are correct in thinking my email domain is the same for the account.

The Project is called Tests in the Default Project Group in the Playground space.

There are 31 different attempts to deploy this in various ways. The current one uses 3 different types of script execution (deployment 0.0.31) as an example. However, I have tried many different ways, including manually downloading the repo with an Invoke-WebRequest and moving it to a few different locations (working directory and /home/Octopus).

Interesting Deployments

Deployment 0.0.31 has 3 steps, test inline powershell script, test inline bash script, and test external feed powershell script. The powershell script from the external feed is in the root directory of the external feeds repository.

Deployment 0.0.27 I believe is trying to run a script from an external github feed.

Deployment 0.0.25 uses the same process as 0.0.27 and is able to find the script. The failure there is I never passed any parameters to it, so it was an expected failure.

Thanks again for all your help!
Steve

Hi @platform_admin,

Sorry I didn’t catch it in your first post, but upon going through our execution containers documentation it looks like images based on Alpine are not allowed for execution containers: Execution containers for workers - Octopus Deploy

I’m not sure if this is the error we’d see as this is the first time I’ve run into it, but do you have an image that isnt Alpine that we can test with to see if the same behavior occurs?

Please let me know what you think.

Thanks,
Jeremy

Hi @jeremy.miller ,

Thank you so much for the feedback. I would hazard a bet that you are correct on this as the container does not include any dotNet runtimes. I will try with a custom Ubuntu container, and if that does not work, I will build one from the worker-tools Dockerfile supplied by Octopus.

I did not realise dotNet was required, and hadn’t seen the content of the link you gave, sorry!

Hi again @jeremy.miller ,

After rebuilding the container with a minimal ubuntu 18.04 image, the problem has been resolved.

Thank you for your assistance.

Hey @platform_admin,

You’re very welcome!

I’m glad to hear it’s working for you, thank you for the update and resolution.

I hope you have a great rest of your week and please let us know if you run into any bumps in the future.

Best,
Jeremy

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.