I have setup golangci-lint in my development enviroment with configuring makefile,
MakeFile
build: lint_provider
go build -o ${BINARY}
lint_provider:
golangci-lint run -c .golangci.yml
install: build
mkdir -p ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}...
mv ${BINARY} ~/terraform.d/plugins/....
bitbucket-pipelines.yml
pipelines:
default:
- step:
image:
hashicorp/terraform:latest
script:
- apk add go
- apk add make
- wget -0- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.44.2
- make install
- cd terraformprovider/examples/test
- ./testall.sh
this pipelining failed with
+ make install
golangci-lint run -c .golangci.yml
make: golangci-lint: No such file or directory
make: *** [Makefile:12: lint_provider] Error 127
Makefile : 12 is
golangci-lint run -c .golangci.yml
the same setup is working with the development environment
in the development environment, golangci-lint installed with
brew install golangci-lint
how do I execute golangci-lint with bitbucket pipeline environment?
Looks like golangci-lint isnt installed succesfully or installed in the directory outside of the PATH
By default this installer uses ./bin directory, so you can try ./bin/golangci-lint run -c .golangci.yml, or you can use BINDIR variable to set installation path.
Related
I'm trying to create a docker image on MacOS using the below command. Note docker build cannot run any command, I tried it with npm --version, and it couldn't find npm either.
% docker build -<<EOF
# syntax=docker/dockerfile:1
FROM ubuntu:20.04
COPY . /app
RUN make /app
CMD node /app/index.js
EOF
Here's the error message I'm getting:
[output clipped...]
=> ERROR [3/3] RUN make /app
------
> [3/3] RUN make /app:
#11 0.200 /bin/sh: 1: make: not found
------
executor failed running [/bin/sh -c make /app]: exit code: 127
However, make is already installed, via xcode-select:
% /bin/sh -c make /app
make: *** No targets specified and no makefile found. Stop.
Can anyone help me here please? Thanks!
Docker can't use software installed on the host. You need to install make in your Dockerfile like this
% docker build -<<EOF
# syntax=docker/dockerfile:1
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y build-essential
COPY . /app
RUN make /app
CMD node /app/index.js
EOF
Right now, I'm trying to integrate a GitHub Action that checks if some code on a pull request compiles properly (VEX Robotics for anyone interested). However, when it gets to running the make command, I get this error:
Building Project
make: Entering directory '/github/workspace/V5'
Adding timestamp [OK]
Creating cold package with libpros,okapilib [ERRORS]
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: unrecognized option '--gc-keep-exported'
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
make: *** [bin/cold.package.elf] Error 1
common.mk:200: recipe for target 'bin/cold.package.elf' failed
I'm extremely confused as to why this is occurring? --gc-keep-exported is a real option, and this code compiles perfectly on my local machine. I've tried changing the ubuntu version and updating the VEX SDK to see if it helps, but I keep on getting the same error. What should I do?
Code:
Dockerfile:
FROM ubuntu:18.04
RUN apt-get update
# Install GCC & Clang
RUN apt-get install build-essential -y
RUN apt-get install clang -y
# Install needed ARM deps
RUN apt-get install gcc-arm-none-eabi -y
RUN apt-get install binutils-arm-none-eabi -y
# Install 7z & cURL
RUN apt-get install p7zip-full -y
RUN apt-get install curl -y
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
entrypoint.sh:
echo "Downloading VEX SDK"
# Get VEX SDK and put it in ~/sdk
curl -L https://content.vexrobotics.com/vexcode/v5code/VEXcodeProV5_2_0_1.dmg -o _vexcode_.dmg
7z x _vexcode_.dmg || :
7z x Payload~ ./VEXcode\ Pro\ V5.app/Contents/Resources/sdk -osdk_temp || :
mkdir ~/sdk
mv sdk_temp/VEXcode\ Pro\ V5.app/Contents/Resources/sdk/* ~/sdk
rm -fR _vex*_ _vex*_.dmg sdk_temp/ Payload~
ls ~/sdk # ls just for testing
echo "Building Project"
# Now make the makefile in the set path
make --directory=$1
The reason this was happening was because I used an old version of gcc-arm-none-eabi. The version on apt is super outdated (v6.3.1 vs v10.2.1).
I was able to use the new version by downloading the tarball available on their site and using the direct paths to compile my code.
There is a newer GCC version available for a newer Ubuntu version, you could browse for another one, or be lazy and enjoy some malpractice with me:
FROM ubuntu:latest
I build a Go project and try to connect exist remote Oracle Database using go-oci8.
The environment is wsl2 on window 10. I'm using Oracle Instant Client 21.1.
My oci8.pc location:
/usr/lib/pkgconfig
My oci8.pc file:
prefix=/opt/oracle/instantclient_21_1
exec_prefix=${prefix}
libdir=${prefix}
includedir=${prefix}/sdk/include
glib_genmarshal=glib-genmarshal
gobject_query=gobject-query
glib_mkenums=glib-mkenums
Name: oci8
Description: oci8 library
Libs: -L${libdir} -lclntsh
Cflags: -I${includedir}
Version: 21.1
My Dockerfile:
# Dockerfile
FROM golang:latest AS builder
ENV GO111MODULE=on
# Download modules
WORKDIR $GOPATH/src/github.com/hadeshunter/todo
COPY go.mod go.sum ./
RUN go mod download
# Build
COPY . ./
RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix nocgo -o /todo .
# Run
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /todo ./
EXPOSE 5000
ENTRYPOINT ["./todo"]
My ~/.zshrc, I add
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/opt/oracle/instantclient_21_1:$LD_LIBRARY_PATH
I using command run
go run main.go
Everything is success. But when run build with docker
docker-compose build && docker-compose run --rm --service-ports todo
I get error:
# pkg-config --cflags -- oci8
Package oci8 was not found in the pkg-config search path.
Perhaps you should add the directory containing `oci8.pc'
to the PKG_CONFIG_PATH environment variable
No package 'oci8' found
pkg-config: exit status 1
ERROR: Service 'todo' failed to build : The command '/bin/sh -c CGO_ENABLED=1 GOOS=linux go build -a -installsuffix nocgo -o /todo .' returned a non-zero code: 2
Does anyone give me suggestion, pls?
I've posted this question already as an issue on the imagick git repository, but it has a very small user-base, so I'm hoping to get some help from here. I've been trying for a few days now to import https://github.com/gographics/imagick to Docker using the official goLang dockerfile for a project I'm working on, but have been unsuccessful. Since this package isn't popular, running apt-get won't work. I've (hesitantly) tried to just add the files to the container, but that didn't work. Here's the DockerFile I've built and the error it produces:
===DOCKERFILE===
# 1) Use the official go docker image built on debian.
FROM golang:latest
# 2) ENV VARS
ENV GOPATH $HOME/<PROJECT>
ENV PATH $HOME/<PROJECT>/bin:$PATH
# 3) Grab the source code and add it to the workspace.
ADD . /<GO>/src/<PROJECT>
ADD . /<GO>/gopkg.in
# Trying to add the files manually... Doesn't help.
ADD . /opt/local/share/doc/ImageMagick-6
# 4) Install revel and the revel CLI.
#(The commented out code is from previous attempts)
#RUN pkg-config --cflags --libs MagickWand
#RUN go get gopkg.in/gographics/imagick.v2/imagick
RUN go get github.com/revel/revel
RUN go get github.com/revel/cmd/revel
# 5) Does not work... Can't find the package.
#RUN apt-get install libmagickwand-dev
# 6) Get godeps from main repo
RUN go get github.com/tools/godep
# 7) Restore godep dependencies
WORKDIR /<GO>/src/<PROJECT>
RUN godep restore
# 8) Install Imagick
#RUN go build -tags no_pkgconfig gopkg.in/gographics/imagick.v2/imagick
# 9) Use the revel CLI to start up our application.
ENTRYPOINT revel run <PROJECT> dev 9000
# 10) Open up the port where the app is running.
EXPOSE 9000
===END DOCKERFILE===
This allows me to build the docker container, but when I try to run it, I get the following error in the logs of kinematic:
===DOCKER ERROR===
ERROR 2016/08/20 21:15:10 build.go:108: # pkg-config --cflags MagickWand MagickCore MagickWand MagickCore
pkg-config: exec: "pkg-config": executable file not found in $PATH
2016-08-20T21:15:10.081426584Z
ERROR 2016/08/20 21:15:10 build.go:308: Failed to parse build errors:
#pkg-config --cflags MagickWand MagickCore MagickWand MagickCore
pkg-config: exec: "pkg-config": executable file not found in $PATH
2016-08-20T21:15:10.082140143Z
===END DOCKER ERROR===
Most base images have package lists removed to avoid to reduce image size. Thus, in order to install something with apt-get, you first need to update the package lists and then install whatever package you wish. Then, after installing the package, remove all side-effects of running apt to avoid polluting the image with unneeded files (all that necessarily as a single RUN command).
The following Dockerfile should do the trick:
FROM golang:latest
RUN apt-get update \ # update package lists
&& apt-get install -y libmagickwand-dev \ # install the package
&& apt-get clean \ # clean package cache
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* # remove everything else
RUN go get gopkg.in/gographics/imagick.v2/imagick
Remember to add -y to apt-get install, because docker build is non-interactive.
I am trying to install doxygen in my CentOs 6.3 machine and I am getting this error. Any ideas??
[root#dell1 doxygen-1.8.3.1]# make install
/usr/bin/install -d /usr/local/bin
/usr/bin/install -d /usr/local/doc/doxygen
/usr/bin/install -m 755 bin/doxygen /usr/local/bin
/usr/bin/install -m 755 bin/doxytag /usr/local/bin
/usr/bin/install: cannot stat `bin/doxytag': No such file or directory
make: *** [install] Error 1
Bash isn't wrong in complaining:
/usr/bin/install: cannot stat `bin/doxytag': No such file or directory
It happens to be that the compiled file doxytag was not included in the downloaded tar file. So when you try to make, it couldn't find that file. To make it successfully, you have two options:
Compile the doxytag.py file from here and paste it to doxygen's bin directory
You can compile the python file doxytag.py from the above link using:
python -m compileall path_to_the_file/doxytag.py
It should generate a python compiled executable with .pyc extension. Now move this file to your doxygen-version folder. For example,
mv doxytag.pyc your_path/doxygen-1.8.5/bin/doxytag
Or alternatively download the doxytag from here
Now when you try to make, it will complete without any errors.
Comment out the line that requires doxytag file from the Makefile
You may read about the doxytag utility from https://www.star.bnl.gov/public/comp/sofi/doxygen/doxytag_usage.html.
If you do not really require this utility in your documentation, simply skip it by commenting out or deleting the line in the Makefile present in the doxygen-1.8.5(as per your version) directory by:
#$(INSTTOOL) -m 755 bin/doxytag $(INSTALL)/bin
And then run the make command.
The doxygen make is strange: "make install" will not invoke "make", so you need to do a
make
make install
to first generate the binaries and then install them.
A cannot stat error literally means the file(s) or directory does not exist - or you do not have the correct permissions. If you know where the directory is located - start looking there for permissions and file existence.
Try as a superuser.
sudo make install
First, you'll need to install some dependencies.
sudo apt install cmake
sudo apt install flex
sudo apt install bison
After that, execute the commands below; it'll probably work fine.
git clone https://github.com/doxygen/doxygen.git
cd doxygen
mkdir build
cd build
cmake -G "Unix Makefiles" ..
make
sudo make install