sls-packaging icon indicating copy to clipboard operation
sls-packaging copied to clipboard

Overriding init.sh results in two init.sh headers in the sls.tgz

Open brahms opened this issue 5 years ago • 5 comments

What happened?

In an sls repo create a service directory with a file named service/bin/init.sh.

run ./gradlew distTar

Find that the resulting tar has two init.sh files in the tar.

$ tree service/
service/
└── bin
    ├── health-server.py
    ├── init.sh

tar tf build/distributions/....sls.tgz | grep init.sh
.../service/bin/init.sh
.../service/bin/init.sh

What did you want to happen?

I would expect that I would have only one init.sh file in the resulting tar, the one that I put in the folder service/bin/init.sh in the git repo.

I think this plugin should intelligently disable the createInitScript task if the file exists, or the createInitScript task should intelligently use the one on disk rather then creating it.

brahms avatar Jan 13 '20 22:01 brahms

Why do you want to overwrite the init.sh?

ferozco avatar Jan 13 '20 22:01 ferozco

The reason we override init.sh is so that we can install and apollo manage a java based dropwizard CLI. The custom init.sh script starts up a python service that gets launched instead and gives green/red status back to Apollo so it think's its running. This allows the CLI to be Apollo managed.

brahms avatar Jan 14 '20 00:01 brahms

If we don't fix this, I just resort to hacking my way around the plugin using tasks.createInitScript.enabled = false

brahms avatar Jan 14 '20 00:01 brahms

I don't think its desirable to support custom init.sh and I think there are a couple options you could try instead. For example, could you convert the CLI into to a server which exposes endpoints you can call (perhaps even use witchcraft) instead of wrapping it?

ferozco avatar Jan 14 '20 02:01 ferozco

Then the plugin should not allow an invalid tar with two headers to be created by validating that. Either way there probably should be a code change here.

brahms avatar Jan 14 '20 15:01 brahms