Change made to the listed files, to enable weaveworks-scope on Power(ppc64le)

1)backend/Dockerfile 2) probe/endpoint/dns_snooper.go
3) client/Dockerfile 4) docker/Dockerfile.cloud-agent
5) probe/process/walker_linux_test.go & 6) tools/lint

1)'backend/Dockerfile' : Conditional added so that the cross-compiling should
   be done on amd64. Also removed support for sh-lint for ppc64le for now.
   As the version for shfmt mentioned in the dockerfile is not available for
   ppc64le and the later version does't work fine with existing application.
2)'probe/endpoint/dns_snooper.go' : Renamed this file so as to reuse for ppc64le
   and added a build-constraint. Now this file will be build for amd64 on linux
   and ppc64le on linux.
3)'client/Dockerfile' : Modified the version of the base image for node from
   8.4.0 to 8.11, as this version supports multiarch.
4)'docker/Dockerfile.cloud-agent' : Modified the version of the base image for
   golang from 1.10.2-strech to 1.10.2, which supports multiarch.
5) 'probe/process/walker_linux_test.go' : Test fixed to run for ppc64le,
    modified the code to accept RSSBytes based on pageSize value per
    architecture, instead of hard-coded values.
6)'tools/lint' : Modified the file to skip the sh-lint implementation for ppc64le.

PR #3231
This commit is contained in:
meghalidhoble
2018-06-20 12:44:46 +05:30
parent 57a7e55355
commit 625998b91e
5 changed files with 34 additions and 11 deletions

View File

@@ -1,14 +1,30 @@
FROM golang:1.10.2-stretch
FROM golang:1.10.2
ENV SCOPE_SKIP_UI_ASSETS true
RUN apt-get update && \
apt-get install -y libpcap-dev time file shellcheck git gcc-arm-linux-gnueabihf curl build-essential python-pip && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN set -eux; \
export arch_val="$(dpkg --print-architecture)"; \
apt-get update && \
if [ "$arch_val" = "amd64" ]; then \
apt-get install -y libpcap-dev python-requests time file shellcheck git gcc-arm-linux-gnueabihf curl build-essential python-pip; \
else \
apt-get install -y libpcap-dev python-requests time file shellcheck git curl build-essential python-pip; \
fi; \
\
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN go clean -i net && \
go install -tags netgo std && \
go install -race -tags netgo std
RUN curl -fsSL -o shfmt https://github.com/mvdan/sh/releases/download/v1.3.0/shfmt_v1.3.0_linux_amd64 && \
chmod +x shfmt && \
mv shfmt /usr/bin
export arch_val="$(dpkg --print-architecture)"; \
if [ "$arch_val" != "ppc64el" ]; then \
go install -race -tags netgo std; \
fi;
RUN export arch_val="$(dpkg --print-architecture)"; \
if [ "$arch_val" = "amd64" ]; then \
curl -fsSL -o shfmt https://github.com/mvdan/sh/releases/download/v1.3.0/shfmt_v1.3.0_linux_amd64 && \
chmod +x shfmt && \
mv shfmt /usr/bin; \
fi;
# Skipped installing shfmt, as the version v1.3.0 isn't supported for ppc64le
# and the later version of shfmt doesn't work with the application well
RUN go get -tags netgo \
github.com/fzipp/gocyclo \
github.com/golang/lint/golint \

View File

@@ -1,4 +1,4 @@
FROM node:8.4.0
FROM node:8.11
WORKDIR /home/weave
COPY package.json yarn.lock /home/weave/
ENV NPM_CONFIG_LOGLEVEL=warn NPM_CONFIG_PROGRESS=false

View File

@@ -1,4 +1,4 @@
FROM alpine:3.5
FROM alpine:3.7
WORKDIR /home/weave
RUN apk add --update bash conntrack-tools iproute2 util-linux curl && \
rm -rf /var/cache/apk/*

View File

@@ -1,3 +1,7 @@
// +build linux,amd64 linux,ppc64le
// Build constraint to use this file for amd64 & ppc64le on Linux
package endpoint
import (

View File

@@ -1,6 +1,7 @@
package process_test
import (
"os"
"reflect"
"testing"
@@ -79,9 +80,11 @@ var mockFS = fs.Dir("",
func TestWalker(t *testing.T) {
fs_hook.Mock(mockFS)
defer fs_hook.Restore()
var pageSize uint64
pageSize = (uint64)(os.Getpagesize() * 2)
want := map[int]process.Process{
3: {PID: 3, PPID: 2, Name: "curl", Cmdline: "curl google.com", Threads: 1, RSSBytes: 8192, RSSBytesLimit: 2048, OpenFilesCount: 3, OpenFilesLimit: 32768},
3: {PID: 3, PPID: 2, Name: "curl", Cmdline: "curl google.com", Threads: 1, RSSBytes: pageSize, RSSBytesLimit: 2048, OpenFilesCount: 3, OpenFilesLimit: 32768},
2: {PID: 2, PPID: 1, Name: "bash", Cmdline: "bash", Threads: 1, OpenFilesCount: 2},
4: {PID: 4, PPID: 3, Name: "apache", Cmdline: "apache", Threads: 1, OpenFilesCount: 1},
1: {PID: 1, PPID: 0, Name: "init", Cmdline: "init", Threads: 1, OpenFilesCount: 0},