Add a script or a command to run with Skaffold dev deployment to a Kubernetes cluster

1/2/2020

I would like to run a command to clone a script from a remote repository before running skaffold dev I need to either somehow inject a git clone command or put the git clone command and the corresponding arguments in a shell script and run the shell script with Skaffold.

From the Skaffold workflow point of view, this step should be run before build. I am using Jib for the build phase and it appears that Jib state does not give me any ability to run a script before the actual build. I don't know if I can add a new phase to the Skaffold life cycle like pre-build. One solution came to my mind is to use custom build instead of Jib and put all pre-build commands as well as the jib related commands in a single script to run. This approach probably works, but won't be very convenient. I was wondering if there is a better approach to do this with Skaffold.

build:
  artifacts:
    - image: gcr.io/k8s-skaffold/example
      custom:
        buildCommand: ./prebuild-and-build.sh
-- Ali
kubernetes
skaffold

0 Answers