Skip to content

Commit

Permalink
🐛 fix volumes in shared containers, update demo output for new rulese…
Browse files Browse the repository at this point in the history
…ts, switch back to using latest rulesets

Signed-off-by: Pranav Gaikwad <[email protected]>
  • Loading branch information
pranavgaikwad committed Apr 24, 2024
1 parent a3de93b commit 43efbfd
Show file tree
Hide file tree
Showing 5 changed files with 507 additions and 183 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/multi-arch-image-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,8 @@ jobs:
image_name: "kantra"
containerfile: "./Dockerfile"
architectures: '[ "amd64", "arm64" ]'
pre_build_cmd: |
TAG=${GITHUB_REF_NAME/main/latest}
sed -i "s,FROM quay.io/konveyor/windup-shim\:latest,FROM quay.io/konveyor/windup-shim:${TAG}," Dockerfile
sed -i "s,FROM quay.io/konveyor/static-report\:latest,FROM quay.io/konveyor/static-report:${TAG}," Dockerfile
sed -i "s,FROM quay.io/konveyor/analyzer-lsp\:latest,FROM quay.io/konveyor/analyzer-lsp:${TAG}," Dockerfile
extra-args: |
--build-arg VERSION=${{ github.ref == 'refs/heads/main' && 'latest' || github.ref_name }} --build-arg BUILD_COMMIT=${{ github.sha }}
--build-arg RULESETS_REF=${{ github.ref_name }} --build-arg VERSION=${{ github.ref_name == 'main' && 'latest' || github.ref_name }} --build-arg BUILD_COMMIT=${{ github.sha }}
secrets:
registry_username: ${{ secrets.QUAY_PUBLISH_ROBOT }}
registry_password: ${{ secrets.QUAY_PUBLISH_TOKEN }}
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
FROM quay.io/konveyor/windup-shim:latest as shim
ARG VERSION=latest
FROM quay.io/konveyor/windup-shim:${VERSION} as shim

FROM registry.access.redhat.com/ubi9-minimal as rulesets

ARG RULESETS_REF=main
RUN microdnf -y install git &&\
git clone --branch v0.4.0-alpha.1 https://github.com/konveyor/rulesets &&\
git clone https://github.com/konveyor/rulesets -b ${RULESETS_REF} &&\
git clone https://github.com/windup/windup-rulesets -b 6.3.1.Final

FROM quay.io/konveyor/static-report:latest as static-report
FROM quay.io/konveyor/static-report:${VERSION} as static-report

# Build the manager binary
FROM golang:1.21 as builder
Expand All @@ -25,13 +27,13 @@ COPY cmd/ cmd/
COPY pkg/ pkg/

# Build
ARG VERSION
ARG VERSION=latest
ARG BUILD_COMMIT
RUN CGO_ENABLED=0 GOOS=linux go build --ldflags="-X 'github.com/konveyor-ecosystem/kantra/cmd.Version=$VERSION' -X 'github.com/konveyor-ecosystem/kantra/cmd.BuildCommit=$BUILD_COMMIT'" -a -o kantra main.go
RUN CGO_ENABLED=0 GOOS=darwin go build --ldflags="-X 'github.com/konveyor-ecosystem/kantra/cmd.Version=$VERSION' -X 'github.com/konveyor-ecosystem/kantra/cmd.BuildCommit=$BUILD_COMMIT'" -a -o darwin-kantra main.go
RUN CGO_ENABLED=0 GOOS=windows go build --ldflags="-X 'github.com/konveyor-ecosystem/kantra/cmd.Version=$VERSION' -X 'github.com/konveyor-ecosystem/kantra/cmd.BuildCommit=$BUILD_COMMIT'" -a -o windows-kantra main.go

FROM quay.io/konveyor/analyzer-lsp:latest
FROM quay.io/konveyor/analyzer-lsp:${VERSION}

RUN mkdir /opt/rulesets /opt/rulesets/input /opt/rulesets/convert /opt/openrewrite /opt/input /opt/input/rules /opt/input/rules/custom /opt/output /opt/xmlrules /opt/shimoutput /tmp/source-app /tmp/source-app/input

Expand Down
4 changes: 2 additions & 2 deletions cmd/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ func (a *analyzeCommand) RunProviders(ctx context.Context, networkName string, v
}
volumes := map[string]string{
// application source code
a.input: SourceMountPath,
volName: SourceMountPath,
}
// this will make more sense when we have more than 2 supported providers
var providerImage string
Expand Down Expand Up @@ -836,7 +836,7 @@ func (a *analyzeCommand) RunProviders(ctx context.Context, networkName string, v
func (a *analyzeCommand) RunAnalysis(ctx context.Context, xmlOutputDir string, volName string, providers []string, ports map[string]int) error {
volumes := map[string]string{
// application source code
a.input: SourceMountPath,
volName: SourceMountPath,
// output directory
a.output: OutputPath,
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func (c *container) Run(ctx context.Context, opts ...Option) error {
for sourcePath, destPath := range c.volumes {
args = append(args, "-v")
if os == "linux" {
args = append(args, fmt.Sprintf("%s:%s:Z",
args = append(args, fmt.Sprintf("%s:%s:z",
filepath.Clean(sourcePath), path.Clean(destPath)))
} else {
args = append(args, fmt.Sprintf("%s:%s",
Expand Down
Loading

0 comments on commit 43efbfd

Please sign in to comment.