Git Product home page Git Product logo

crane-plugin-openshift's People

Contributors

djzager avatar jaydipgabani avatar jmontleon avatar nikita698 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

crane-plugin-openshift's Issues

Plugin crashes when transforming a BuildConfig with Spec.Strategy.DockerStrategy defined with Spec.Strategy.DockerStrategy.From not being defined

After running crane apply, if a BuildConfig exists with the DockerStrategy field but has no from field, the plugin crashes with the following output:

ERRO[0000] unable to run the plugin binary               pluginPath=/home/nikita/plugins/managed/default/OpenShiftPlugin
DEBU[0000] Plugin Log line: time="2022-05-18T15:26:36+03:00" level=info msg="found build config, processing"  pluginPath=/home/nikita/plugins/managed/default/OpenShiftPlugin
DEBU[0000] Plugin Log line: panic: runtime error: invalid memory address or nil pointer dereference  pluginPath=/home/nikita/plugins/managed/default/OpenShiftPlugin
DEBU[0000] Plugin Log line: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xb6e597]  pluginPath=/home/nikita/plugins/managed/default/OpenShiftPlugin
DEBU[0000] Plugin Log line:                              pluginPath=/home/nikita/plugins/managed/default/OpenShiftPlugin
DEBU[0000] Plugin Log line: goroutine 1 [running]:       pluginPath=/home/nikita/plugins/managed/default/OpenShiftPlugin
DEBU[0000] Plugin Log line: main.UpdateBuildConfig(0xc0002becc0, 0xc0002b9100, 0x0, 0x0, 0xc00013b7b0, 0xb, 0x2, 0xc00015fb88, 0x4f981a)  pluginPath=/home/nikita/plugins/managed/default/OpenShiftPlugin
DEBU[0000] Plugin Log line:     /home/runner/work/crane-plugin-openshift/crane-plugin-openshift/main/openshift.go:294 +0xcb7  pluginPath=/home/nikita/plugins/managed/default/OpenShiftPlugin
DEBU[0000] Plugin Log line: main.Run(0xc0002becc0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20, 0x30)  pluginPath=/home/nikita/plugins/managed/default/OpenShiftPlugin
DEBU[0000] Plugin Log line:     /home/runner/work/crane-plugin-openshift/crane-plugin-openshift/main/cmd.go:85 +0x4aa  pluginPath=/home/nikita/plugins/managed/default/OpenShiftPlugin
DEBU[0000] Plugin Log line: github.com/konveyor/crane-lib/transform/cli.(*customPlugin).Run(0xc0001ddab0, 0xc0002becc0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7f9c69d19700, ...)  pluginPath=/home/nikita/plugins/managed/default/OpenShiftPlugin
DEBU[0000] Plugin Log line:     /home/runner/go/pkg/mod/github.com/konveyor/[email protected]/transform/cli/cli.go:44 +0x8e  pluginPath=/home/nikita/plugins/managed/default/OpenShiftPlugin
DEBU[0000] Plugin Log line: github.com/konveyor/crane-lib/transform/cli.RunAndExit(0xd99ae0, 0xc0001ddab0)  pluginPath=/home/nikita/plugins/managed/default/OpenShiftPlugin
DEBU[0000] Plugin Log line:     /home/runner/go/pkg/mod/github.com/konveyor/[email protected]/transform/cli/cli.go:134 +0x545  pluginPath=/home/nikita/plugins/managed/default/OpenShiftPlugin
DEBU[0000] Plugin Log line: main.main()                  pluginPath=/home/nikita/plugins/managed/default/OpenShiftPlugin
DEBU[0000] Plugin Log line:     /home/runner/work/crane-plugin-openshift/crane-plugin-openshift/main/cmd.go:43 +0x2d6  pluginPath=/home/nikita/plugins/managed/default/OpenShiftPlugin
DEBU[0000] Plugin Log line:                              pluginPath=/home/nikita/plugins/managed/default/OpenShiftPlugin
ERRO[0000] error running the plugin command              pluginPath=/home/nikita/plugins/managed/default/OpenShiftPlugin
Error: error running the plugin command: unable to run the plugin binary, err: exit status 2

It can happen for example when the yaml of the BuildConfig looks like this:

spec:
   strategy:
      dockerStrategy: {}

or:

spec:
   strategy:
      dockerStrategy:
         dockerfilePath: Dockerfile
      type: Docker

The problem is in https://github.com/konveyor/crane-plugin-openshift/blob/b1f4f9be2b32f76b422360461de4c055e74d91b8/openshift.go#L294

There is no validation if the From field exists at all.

A simple workaround is adding the from field and giving it some object value, like "test: test".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.