Skip to content

✨ : Pulling module from private Git instance #746

@nicjansma

Description

@nicjansma

Is your feature request related to a problem? Please describe.
I'd like to be able to pull a module definition from a private Git instance (HTTPS URL).

For example, I self-host Gitea and would like to use those URLs to deploy from.

This is similar to #270.

Describe the solution you'd like
While I can point Gaia at a private Git HTTPS URL, using the module definition does not work, nor does it pull the README.md.

When I click Refresh module definition, the logs show:

2023-04-17 09:18:22.238 ERROR 1 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException: Cannot invoke "io.gaia_app.registries.RegistryDetails.getProjectId()" because the return value of "io.gaia_app.modules.bo.TerraformModule.getRegistryDetails()" is null] with root cause

java.lang.NullPointerException: Cannot invoke "io.gaia_app.registries.RegistryDetails.getProjectId()" because the return value of "io.gaia_app.modules.bo.TerraformModule.getRegistryDetails()" is null
        at io.gaia_app.modules.controller.ModuleRestController.refreshModule(ModuleRestController.java:129) ~[classes!/:2.4.0]
        at io.gaia_app.modules.controller.ModuleRestController$$FastClassBySpringCGLIB$$bac1ac95.invoke(<generated>) ~[classes!/:2.4.0]
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.3.22.jar!/:5.3.22]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793) ~[spring-aop-5.3.22.jar!/:5.3.22]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.3.22.jar!/:5.3.22]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) ~[spring-aop-5.3.22.jar!/:5.3.22]
        at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:61) ~[spring-security-core-5.7.2.jar!/:5.7.2]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.22.jar!/:5.3.22]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763) ~[spring-aop-5.3.22.jar!/:5.3.22]
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708) ~[spring-aop-5.3.22.jar!/:5.3.22]
        at io.gaia_app.modules.controller.ModuleRestController$$EnhancerBySpringCGLIB$$af539453.refreshModule(<generated>) ~[classes!/:2.4.0]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]

This is ultimately because TerraformModule.getRegistryDetails() returns null because the ModuleServiceImpl.java only has support for the public Github and Gitlab instances:

public void updateRegistryDetails(TerraformModule module) {
RegistryType registryType;
if (module.getGitRepositoryUrl().contains("github")) {
registryType = RegistryType.GITHUB;
} else if (module.getGitRepositoryUrl().contains("gitlab")) {
registryType = RegistryType.GITLAB;
} else {
// could not match any registry type from the URL
return;
}

Describe alternatives you've considered
I was able to trick Gaia to use my module definition by pushing my *.tf and variables.tf to a public Github/Gitlab instance, using the Refresh module definition, then pointing it back to my private Git repo.

Obviously, this is not ideal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions