go-semantic-release / semantic-release

📦🚀 semantic-release written in Go
https://go-semantic-release.xyz
MIT License
404 stars 43 forks source link

Plugins discovery behind proxy #107

Closed avillalain closed 3 years ago

avillalain commented 3 years ago

Hi

I'm wondering if there is a way to configure the execution to disable the plugin discoverability feature. Basically the environment where I'm running can't issue any outside calls to fetch packages, and I'm wondering as an alternative to be able to have a docker image with all plugins already packaged to be able to run it

christophwitzko commented 3 years ago

Hi @avillalain,

semantic-release is currently not working behind a proxy. There is an option to pre-download the required plugins called --download-plugins. You can use the following Dockerfile to build an image containing all required plugins:

FROM registry.gitlab.com/go-semantic-release/semantic-release:2.13.0

RUN semantic-release --download-plugins

I am also happy to add proxy support to semantic-release. I will have some time in the following weeks to look into that issue.

Best, Christoph

avillalain commented 3 years ago

Actually this might work, but I'm running a test, and I still see that it's trying to download plugins, even though I moved all plugins to the .semrel folder where the tool is installed, is there a set of env. variables that I need to set so that semantic-release do not check for plugins and use the ones already downloaded?

christophwitzko commented 3 years ago

Okay, that means probably that semantic-release downloads the wrong plugins. Make sure to set the correct provider, ci condition, etc plugin as CLI flags, e.g.: semantic-release --download-plugins --provider gitlab --ci-condition gitlab

avillalain commented 3 years ago

@christophwitzko even with the plugins downloaded the binary is trying to pull the list of plugins, is there a way to turn that off?

christophwitzko commented 3 years ago

Hmm, semantic-release only contacts the registry if the plugin was not found locally. 🤔 What plugins are you using for your setup? Can you post your semantic-release log output?

avillalain commented 3 years ago

@christophwitzko let me post what I did. First I executed the following command to download the plugins ./semantic-release --download-plugins --provider git --ci-condition default

That is running inside the following path /go, so basically semantic-release is installed in that folder. After that I initialized a separate git repository in the home directory with git init.

Then executed the following command: /go/semantic-release --changelog --prepend-changelog --provider git --dry

And this is the output I got

[go-semantic-release]: version: 2.13.0
[go-semantic-release]: Get "https://plugins.go-semantic-release.xyz/api/v1/plugins/condition-default.json": dial tcp: lookup plugins.go-semantic-release.xyz on 192.168.65.1:53: no such host

I also tried creating a soft link inside the git repository to the .semrel folder where all plugins are downloaded but no luck yet. Is the --prepend-changelog parameter requiring an additional plugin?

christophwitzko commented 3 years ago

Okay, thanks for sharing. The --prepend-changelog does not require a separate plugin. The download plugins command looks correct. Currently, semantic-release requires having the .semrel directory in the current working directory and I am not sure if soft-linking is enough. Can you try to copy the .semrel folder where you are executing semantic-release?

avillalain commented 3 years ago

@christophwitzko copying the folder worked perfectly. I thought of needing the .semrel in the working directory, but did not think that I needed to copy it directly. Thanks again, I'll see if this approach can work, I'm hoping to see if I can download the plugins first and that might be an alternative.