Giter VIP home page Giter VIP logo

circleci-demo-go's Introduction

CircleCI 2.0 Demo Application: Go (Golang) CircleCI Build Status MIT Licensed

This is an example application showcasing how to run Go on CircleCI 2.0.

You can follow along with this project by reading the following doc: https://circleci.com/docs/2.0/language-go/

circleci-demo-go's People

Contributors

felicianotech avatar keybits avatar lokst avatar ryan-wren avatar smaant avatar smart-alek avatar technomancy avatar teesloane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

circleci-demo-go's Issues

Error when executing build job using circleci cli

The instructions for the circleci cli use this repo as an example of running a build on a local machine:

git clone https://github.com/CircleCI-Public/circleci-demo-go.git
cd circleci-demo-go
circleci local execute --job build

Executing circleci local execute --job build results in the following error:

➜  circleci-demo-go git:(master) circleci local execute --job build
Docker image digest: sha256:b2a0faa5dd8828b6b7d28ca0ce5e44bdaab565f2b02d1116ee5bd655a0607833
====>> Spin up environment
Build-agent version  ()
Docker Engine Version: 19.03.13
Kernel Version: Linux 92d36a02f624 5.4.39-linuxkit #1 SMP Fri May 8 23:03:06 UTC 2020 x86_64 Linux
Starting container circleci/golang:1.12
Warning: No authentication provided, using CircleCI credentials for pulls from Docker Hub.
  image is cached as circleci/golang:1.12, but refreshing...
1.12: Pulling from circleci/golang
Digest: sha256:ae191834590b2cdee6ca9bb6985f02e05b3f9b326536f83494f788889481b408
Status: Image is up to date for circleci/golang:1.12
  pull stats: N/A
  time to create container: 34ms
  using image circleci/golang@sha256:ae191834590b2cdee6ca9bb6985f02e05b3f9b326536f83494f788889481b408
Starting container circleci/postgres:9.6-alpine
Warning: No authentication provided, using CircleCI credentials for pulls from Docker Hub.
  image is cached as circleci/postgres:9.6-alpine, but refreshing...
9.6-alpine: Pulling from circleci/postgres
Digest: sha256:0eac295566d32ad1b079f3ce0ccc8763931a4405200d767fcaaee5978fa51e94
Status: Image is up to date for circleci/postgres:9.6-alpine
  pull stats: N/A
  time to create container: 35ms
  using image circleci/postgres@sha256:0eac295566d32ad1b079f3ce0ccc8763931a4405200d767fcaaee5978fa51e94
Time to upload agent and config: 2.9596537s
Error:
Unexpected environment preparation error: Error response from daemon: can't join IPC of container c0ce7aad530ae02f8d0d0a6b12afbaa6cb5c28c090cb10fb153e156bbddb02ed: non-shareable IPC (hint: use IpcMode:shareable for the donor container)

Step failed
Task failed
Error: Unhandled prepare executor error: Error response from daemon: can't join IPC of container c0ce7aad530ae02f8d0d0a6b12afbaa6cb5c28c090cb10fb153e156bbddb02ed: non-shareable IPC (hint: use IpcMode:shareable for the donor container)

OS: macOS Catalina Version 10.15.7 (19H2)
Shell: zsh
Docker: 2.5.0.1 (49550)
CircleCI CLI: 0.1.11393+c9b8b87 (homebrew)

I will try again with macOS BigSur once I update my machine.

Error: Not Found when trying to execute locally

I'm trying to run the build job locally, per this tutorial, but when I run circleci local execute build, I get Error: Not Found. No other error info or output.
Anyone have any ideas here?

I'm on Mac M1 running Monterey 12.6, with Docker Desktop v4.17.0.

Documentation very unclear.

Found this in the get started with go.

Build the demo project yourself
A good way to start using CircleCI is to build a project yourself. Here’s how to build the Demo GoProject with your own account:

Fork the Demo Go Project onGitHub to your own account
Go to the Projects dashboard in the CircleCI app and click the Follow Project button next to the project you just forked.
To make changes you can edit the .circleci/config.yml file and make a commit. When you push a commit to GitHub, CircleCI will build and test the project.

So you say that I should build myself and then I arrive at a completed best practice project?

Local build doesn't work

Local build on this doesn't work - errors out:

go get github.com/jstemmer/go-junit-report
package github.com/jstemmer/go-junit-report: mkdir /go/src/github.com/jstemmer/: permission denied
Error: Exited with code 1
Step failed

How to expose container ports to localhost for secondary containers?

In the example config, you have this run command to see when the postgres service is ready:

      #  Wait for Postgres to be ready before proceeding
      - run:
          name: Waiting for Postgres to be ready
          command: dockerize -wait tcp://localhost:5432 -timeout 1m

But no where do I see you explicitly publishing the container port to the host port. What would happen if we ran two containers that exposed the same container port? How could would we be able to connect to them individually from the primary container?

Unit Tests Not Finding Dependencies

Hello! Total newbie to CircleCI, and Go for that matter. I forked this project and when I run a circleci build I get the following output. It appears the unit tests are unable to find some of the dependencies. Any pointers as to what I could be doing wrong would be appreciated. Thanks!

$ circleci build
Docker image digest: sha256:6331ae078d92837f2513d5aca3f6344189531ab1bdf79bd7231392c7a4b0aa45
====>> Spin up Environment
Build-agent version 1.0.10191-59d6c584 (2019-04-04T09:13:55+0000)
Docker Engine Version: 18.09.2
Kernel Version: Linux 4f5992e5b426 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64 Linux
Starting container circleci/golang:1.12
  using image circleci/golang@sha256:f9e2c7b59931898e325261128373e7876b4ce471ff5c4a11b987180da2088988
Starting container circleci/postgres:9.6-alpine
  using image circleci/postgres@sha256:b2896cbab027e7ccae134483d38219d28bddeabd2cf18e15a4c3866be76e19d5
====>> Container circleci/postgres:9.6-alpine
Service containers logs streaming is disabled for local builds
You can manually monitor container 0a95dd6511170bddeff63f6a827bccffdb8de761c10340008d8be51b96ffd40a
====>> Checkout code
  #!/bin/bash -eo pipefail
mkdir -p /go/src/github.com/CircleCI-Public/circleci-demo-go && cd /tmp/_circleci_local_build_repo && git ls-files -z | xargs -0 tar -c | tar -x -C /go/src/github.com/CircleCI-Public/circleci-demo-go && cp -a /tmp/_circleci_local_build_repo/.git /go/src/github.com/CircleCI-Public/circleci-demo-go
====>> mkdir -p $TEST_RESULTS
  #!/bin/bash -eo pipefail
mkdir -p $TEST_RESULTS
====>> Waiting for Postgres to be ready
  #!/bin/bash -eo pipefail
dockerize -wait tcp://localhost:5432 -timeout 1m
2019/04/06 00:20:56 Waiting for: tcp://localhost:5432
2019/04/06 00:20:56 Problem with dial: dial tcp 127.0.0.1:5432: connect: connection refused. Sleeping 1s
2019/04/06 00:20:57 Problem with dial: dial tcp 127.0.0.1:5432: connect: connection refused. Sleeping 1s
2019/04/06 00:20:58 Problem with dial: dial tcp 127.0.0.1:5432: connect: connection refused. Sleeping 1s
2019/04/06 00:20:59 Connected to tcp://localhost:5432
====>> Run unit tests
  #!/bin/bash -eo pipefail
PACKAGE_NAMES=$(go list ./... | circleci tests split --split-by=timings --timings-type=classname)
gotestsum --junitfile ${TEST_RESULTS}/gotestsum-report.xml -- $PACKAGE_NAMES

Requested historical based timing, but they are not present.  Falling back to name based sorting
service/service.go:10:2: cannot find package "github.com/julienschmidt/httprouter" in any of:
	/usr/local/go/src/github.com/julienschmidt/httprouter (from $GOROOT)
	/go/src/github.com/julienschmidt/httprouter (from $GOPATH)
main.go:10:2: cannot find package "github.com/mattes/migrate/driver/postgres" in any of:
	/usr/local/go/src/github.com/mattes/migrate/driver/postgres (from $GOROOT)
	/go/src/github.com/mattes/migrate/driver/postgres (from $GOPATH)
main.go:11:2: cannot find package "github.com/mattes/migrate/migrate" in any of:
	/usr/local/go/src/github.com/mattes/migrate/migrate (from $GOROOT)
	/go/src/github.com/mattes/migrate/migrate (from $GOPATH)
test/contacts.go:5:2: cannot find package "github.com/stretchr/testify/require" in any of:
	/usr/local/go/src/github.com/stretchr/testify/require (from $GOROOT)
	/go/src/github.com/stretchr/testify/require (from $GOPATH)

=== Errors
service/service.go:10:2: cannot find package "github.com/julienschmidt/httprouter" in any of:
	/usr/local/go/src/github.com/julienschmidt/httprouter (from $GOROOT)
	/go/src/github.com/julienschmidt/httprouter (from $GOPATH)
main.go:10:2: cannot find package "github.com/mattes/migrate/driver/postgres" in any of:
	/usr/local/go/src/github.com/mattes/migrate/driver/postgres (from $GOROOT)
	/go/src/github.com/mattes/migrate/driver/postgres (from $GOPATH)
main.go:11:2: cannot find package "github.com/mattes/migrate/migrate" in any of:
	/usr/local/go/src/github.com/mattes/migrate/migrate (from $GOROOT)
	/go/src/github.com/mattes/migrate/migrate (from $GOPATH)
test/contacts.go:5:2: cannot find package "github.com/stretchr/testify/require" in any of:
	/usr/local/go/src/github.com/stretchr/testify/require (from $GOROOT)
	/go/src/github.com/stretchr/testify/require (from $GOPATH)

DONE 0 tests, 4 errors in 0.073s
Error: Exited with code 1
Step failed
====>> Uploading artifacts
Uploading /tmp/test-results to raw-test-output
Uploading /tmp/test-results/gotestsum-report.xml (64 B): Error: FAILED with error not supported

====>> Uploading test results
Archiving the following test results
  * /tmp/test-results

Error: Failed uploading test results directory 
Error &errors.errorString{s:"not supported"}

{"Runner":true,"level":"error","msg":"Can't add file //tmp/test-results to tar: io: read/write on closed pipe","task-id":"localbuild-1554510052","time":"2019-04-06T00:20:59Z"}
{"Runner":true,"level":"error","msg":"Can't close tar writer: io: read/write on closed pipe","task-id":"localbuild-1554510052","time":"2019-04-06T00:20:59Z"}
Error: runner failed (exited with 101)
Task failed
Error: task failed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.