botkube icon indicating copy to clipboard operation
botkube copied to clipboard

Not able to run container on Ubuntu

Open nomanyaqubny-zz opened this issue 4 years ago • 4 comments

I followed the instructions at https://www.botkube.io/contribute/ and added a filter, which I can build and run locally without any problem. Thanks for the filter examples.

Now, when I create an image and install helm chart on a Ubuntu VM:

helm install --version v9.99.9-dev botkube --namespace botkube -f botkube-config.yaml --set image.repository=<my_account>/botkube --set image.tag=latest infracloudio/botkube

I get following error:

/go/bin/botkube: line 1: syntax error: unexpected "("

I am building the app and container on my machine: MBP Catalina 10.15.7; go 1.14.3 darwin/amd64

I had similar issue when I was creating a container in docker-desktop. But after setting env GOOS=linux GOARCH=amd64, my image runs fine in docker-desktop and GKE cluster.

But I cannot install the helm chart on AKS cluster having ubuntu VM.

The other settings other than GOOS and GOARCH which I have tried are GO111MODULE=on and CGO_ENABLED=0 in Makefile and Dockerfile.

nomanyaqubny-zz avatar Oct 19 '20 22:10 nomanyaqubny-zz

Hey @nomanyaqubny, Could you please share the content of botkube-config.yaml? Also, please hide any sensitive info like token before posting the content :)

PrasadG193 avatar Oct 20 '20 10:10 PrasadG193

communications:
  webhook:
    enabled: true
    url: 'https://api.mydomain.com/events'
config:
  # Cluster Setting to manage command execution access
  settings:
    # Set cluster name to differentiate incoming messages
    clustername: my-k8s-cluster
    # Kubectl executor configs
    kubectl:
      # Set true to enable kubectl commands execution
      enabled: false
    # Set true to enable config watcher
    configwatcher: true
    # Set false to disable upgrade notification
    upgradeNotifier: false
  ## Resources you want to watch
  resources:
    # - name: v1/pods # Name of the resource. Resource name must be in group/version/resource (G/V/R) format
    #   # resource name should be plural (e.g apps/v1/deployments, v1/pods)
    #   namespaces: # List of namespaces, "all" will watch all the namespaces
    #     include:
    #       - all
    #     ignore: # List of namespaces to be ignored (omitempty), used only with include: all
    #       - kube-system # example : include [all], ignore [x,y,z]
    #   events: # List of lifecycle events you want to receive, e.g create, update, delete, error OR all
    #     - all
    #   updateSetting:
    #     includeDiff: true
    #     fields:
    #       - metadata
    #       - spec
    #       - status
    # - name: apps/v1/statefulsets
    #   namespaces:
    #     include:
    #       - all
    #   events:
    #     - create
    #     - update
    #     - delete
    #     - error
    #   updateSetting:
    #     includeDiff: true
    #     fields:
    #       - metadata
    #       - spec
    #       - status
    # - name: v1/nodes
    #   namespaces:
    #     include:
    #       - all
    #     ignore:
    #       -
    #   events:
    #     - all
    # Custom resource example
    - name: helm.fluxcd.io/v1/helmreleases
      namespaces:
        include:
          - all
        ignore:
          - kube-system
      events:
        - all

nomanyaqubny-zz avatar Oct 20 '20 11:10 nomanyaqubny-zz

Do you see any panic/crash logs?

PrasadG193 avatar Oct 29 '20 04:10 PrasadG193

I've experienced the same issue when I tried to build linux/amd64 binary on macOS and run helm chart with my custom image. Same error I got in my logs: /go/bin/botkube: line 1: syntax error: unexpected "("

The problem was due to the specifying GOOS and GOARCH in wrong way (I've edited Makefile). Eventually, I reverted it back and just ran:

GOOS=linux GOARCH=amd64 make build
GOOS=linux GOARCH=amd64 make container-image

# then tagged and pushed my image to dockerhub
# and installed chart with that proper image
helm upgrade --install --version v9.99.9-dev botkube --namespace botkube \
--set config.communications....
--set config.settings.clustername=... \
--set config.settings.allowkubectl=true \
--set image.repository=... \
--set image.tag=latest \
 infracloudio/botkube

Hope this helps.

svitiashchuk avatar May 06 '21 22:05 svitiashchuk

Closing because of inactivity. I couldn't reproduce the issue locally, and as @svitiashchuk responded, probably it was caused by wrong GOOS and GOARCH. You can now use make containter-image-single target to build a single-arch image. Cheers!

pkosiec avatar Aug 25 '22 10:08 pkosiec