Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👻 fix dockerfile to use release image #87

Closed
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: tackle2-addon-analyzer CI

on:
workflow_dispatch:
push:
pull_request:

Expand Down Expand Up @@ -28,3 +29,4 @@ jobs:
uses: konveyor/ci/.github/workflows/global-ci.yml@main
with:
component_name: tackle2-addon-analyzer
api_tests_ref: release-0.3
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM quay.io/konveyor/windup-shim:latest as shim
FROM quay.io/konveyor/windup-shim:release-0.3 as shim

FROM registry.access.redhat.com/ubi9/go-toolset:latest as addon
ENV GOPATH=$APP_ROOT
COPY --chown=1001:0 . .
RUN make cmd
RUN make build

FROM quay.io/konveyor/analyzer-lsp:latest
FROM quay.io/konveyor/analyzer-lsp:release-0.3
USER root
RUN echo -e "[centos9]" \
"\nname = centos9" \
Expand Down
28 changes: 21 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
GOBIN ?= ${GOPATH}/bin
IMG ?= quay.io/konveyor/tackle2-addon-analyzer:latest
CMD ?= bin/addon
AddonDir ?= /tmp/addon
GOPATH ?= $(HOME)/go
GOBIN ?= $(GOPATH)/bin
IMG ?= quay.io/konveyor/tackle2-addon-analyzer:latest
CMD ?= bin/addon
AddonDir ?= /tmp/addon
GOIMPORTS = $(GOBIN)/goimports

PKG = ./cmd/... \
./builder/...

PKGDIR = $(subst /...,,$(PKG))


cmd: fmt vet
go build -ldflags="-w -s" -o ${CMD} github.com/konveyor/tackle2-addon-analyzer/cmd

build:
go build -ldflags="-w -s" -o ${CMD} github.com/konveyor/tackle2-addon-analyzer/cmd

image-docker:
docker build -t ${IMG} .

Expand All @@ -17,9 +28,12 @@ run: cmd
$(eval cmd := $(abspath ${CMD}))
cd ${AddonDir};${cmd}

fmt:
go fmt ./...
fmt: $(GOIMPORTS)
$(GOIMPORTS) -w $(PKGDIR)

vet:
go vet ./...
go vet $(PKG)

# Ensure goimports installed.
$(GOIMPORTS):
go install golang.org/x/tools/cmd/goimports@latest
5 changes: 3 additions & 2 deletions builder/deps.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package builder

import (
"io"
"os"

output "github.com/konveyor/analyzer-lsp/output/v1/konveyor"
"github.com/konveyor/tackle2-hub/api"
"gopkg.in/yaml.v2"
"io"
"os"
)

// Deps builds dependencies.
Expand Down
7 changes: 4 additions & 3 deletions builder/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ package builder

import (
"fmt"
"io"
"net/url"
"os"

output "github.com/konveyor/analyzer-lsp/output/v1/konveyor"
hub "github.com/konveyor/tackle2-hub/addon"
"github.com/konveyor/tackle2-hub/api"
"go.lsp.dev/uri"
"gopkg.in/yaml.v2"
"io"
"k8s.io/utils/pointer"
"net/url"
"os"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion cmd/analyzer.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package main

import (
"path"

"github.com/konveyor/tackle2-addon-analyzer/builder"
"github.com/konveyor/tackle2-addon/command"
"path"
)

type RuleError = builder.RuleError
Expand Down
3 changes: 2 additions & 1 deletion cmd/cmd_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package main

import (
"github.com/onsi/gomega"
"testing"

"github.com/onsi/gomega"
)

func TestRuleSelector(t *testing.T) {
Expand Down
40 changes: 28 additions & 12 deletions cmd/rules.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package main

import (
"os"
"path"
"regexp"
"strconv"
"strings"

"github.com/konveyor/analyzer-lsp/parser"
"github.com/konveyor/tackle2-addon/command"
"github.com/konveyor/tackle2-addon/repository"
"github.com/konveyor/tackle2-hub/api"
"github.com/konveyor/tackle2-hub/nas"
"github.com/rogpeppe/go-internal/semver"
"os"
"path"
"regexp"
"strconv"
"strings"
)

type History = map[uint]byte
Expand Down Expand Up @@ -85,13 +86,13 @@ func (r *Rules) addFiles() (err error) {
}
for _, ent := range entries {
if ent.Name() == parser.RULE_SET_GOLDEN_FILE_NAME {
r.rules = append(r.rules, ruleDir)
r.append(ruleDir)
return
}
}
for _, ent := range entries {
p := path.Join(ruleDir, ent.Name())
r.rules = append(r.rules, p)
r.append(p)
}
return
}
Expand Down Expand Up @@ -183,11 +184,11 @@ func (r *Rules) addRules(ruleset *api.RuleSet) (err error) {
break
}
if n == 1 {
r.rules = append(r.rules, path)
r.append(path)
}
}
if n > 1 {
r.rules = append(r.rules, ruleDir)
r.append(ruleDir)
}
return
}
Expand Down Expand Up @@ -222,7 +223,7 @@ func (r *Rules) addRuleSetRepository(ruleset *api.RuleSet) (err error) {
return
}
ruleDir := path.Join(rootDir, ruleset.Repository.Path)
r.rules = append(r.rules, ruleDir)
r.append(ruleDir)
return
}

Expand Down Expand Up @@ -254,7 +255,7 @@ func (r *Rules) addRepository() (err error) {
return
}
ruleDir := path.Join(rootDir, r.Repository.Path)
r.rules = append(r.rules, ruleDir)
r.append(ruleDir)
return
}

Expand Down Expand Up @@ -288,11 +289,26 @@ func (r *Rules) convert() (err error) {
return
}
if len(converted) > 0 {
r.rules = append(r.rules, output)
r.append(output)
}
return
}

// append path.
func (r *Rules) append(p string) {
for i := range r.rules {
if r.rules[i] == p {
return
}
}
switch strings.ToUpper(path.Ext(p)) {
case "",
".YAML",
".YML":
r.rules = append(r.rules, p)
}
}

// Labels collection.
type Labels struct {
Included []string `json:"included,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions cmd/scope.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package main

import (
"github.com/konveyor/tackle2-addon/command"
"strings"

"github.com/konveyor/tackle2-addon/command"
)

// Scope settings.
Expand All @@ -28,7 +29,6 @@ func (r *Scope) AddOptions(options *command.Options) (err error) {
return
}

//
// incidentSelector returns an incident selector.
// The injected `!package` matches incidents without a package variable.
func (r *Scope) incidentSelector() (selector string) {
Expand Down
9 changes: 5 additions & 4 deletions cmd/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ package main

import (
"errors"
"github.com/konveyor/analyzer-lsp/provider"
hub "github.com/konveyor/tackle2-hub/addon"
"github.com/konveyor/tackle2-hub/api"
"gopkg.in/yaml.v2"
"io"
"os"
"path"
"strconv"
"strings"

"github.com/konveyor/analyzer-lsp/provider"
hub "github.com/konveyor/tackle2-hub/addon"
"github.com/konveyor/tackle2-hub/api"
"gopkg.in/yaml.v2"
)

// Settings - provider settings file.
Expand Down
5 changes: 3 additions & 2 deletions cmd/tagger.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package main

import (
"github.com/konveyor/tackle2-addon/command"
"github.com/konveyor/tackle2-hub/api"
"math/rand"
"regexp"

"github.com/konveyor/tackle2-addon/command"
"github.com/konveyor/tackle2-hub/api"
)

var TagExp = regexp.MustCompile("(.+)(=)(.+)")
Expand Down
Loading
Loading