Skip to content

Commit 10fc0fd

Browse files
author
Ava Czechowska
authored
Merge pull request #33 from kudulab/golang-1.17.7
Golang 1.17.7
2 parents 5837a6e + 9464185 commit 10fc0fd

File tree

13 files changed

+130
-63
lines changed

13 files changed

+130
-63
lines changed

.circleci/config.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,14 @@ jobs:
4747
- run:
4848
name: Install dojo
4949
command: |
50-
version="0.10.3"
50+
version="0.10.5"
5151
wget -O /tmp/dojo https://github.com/kudulab/dojo/releases/download/${version}/dojo_linux_amd64
5252
chmod +x /tmp/dojo
5353
sudo mv /tmp/dojo /usr/bin/dojo
5454
- run:
55-
command: dojo -c Dojofile.build "./tasks deps"
55+
command: /bin/bash -c "./tasks build"
5656
- run:
57-
command: dojo -c Dojofile.build "./tasks build"
58-
- run:
59-
command: dojo -c Dojofile.build "./tasks unit"
57+
command: /bin/bash -c "./tasks unit"
6058
- run:
6159
command: /bin/bash -c "./tasks symlink linux"
6260
- persist_to_workspace:
@@ -71,7 +69,7 @@ jobs:
7169
- run:
7270
name: Install dojo
7371
command: |
74-
version="0.10.3"
72+
version="0.10.5"
7573
wget -O /tmp/dojo https://github.com/kudulab/dojo/releases/download/${version}/dojo_linux_amd64
7674
chmod +x /tmp/dojo
7775
sudo mv /tmp/dojo /usr/bin/dojo
@@ -89,7 +87,7 @@ jobs:
8987
- run:
9088
name: Install dojo
9189
command: |
92-
version="0.10.3"
90+
version="0.10.5"
9391
wget -O /tmp/dojo https://github.com/kudulab/dojo/releases/download/${version}/dojo_linux_amd64
9492
chmod +x /tmp/dojo
9593
sudo mv /tmp/dojo /usr/bin/dojo

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 0.11.0 (2022-Feb-27)
2+
3+
* Compile Dojo using Golang 1.17.7 thanks to using Docker image kudulab/golang-dojo:2.0.0
4+
15
### 0.10.5 (2022-Feb-20)
26

37
* Update a log message in entrypoint about sourcing the scripts

Dojofile.build

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
DOJO_DOCKER_IMAGE=kudulab/golang-dojo:1.1.1
2-
DOJO_WORK_INNER="/dojo/work/src/dojo"
1+
DOJO_DOCKER_IMAGE=kudulab/golang-dojo:2.0.0
32
DOJO_DOCKER_OPTIONS="--security-opt seccomp:unconfined"

README.md

Lines changed: 58 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Dojo works on **Linux or Mac**. Dojo is continuously tested only on Linux.
3535
* [Handling signals](#handling-signals)
3636
1. [FAQ](#faq)
3737
1. [Comparison to other tools](#comparison-to-other-tools)
38-
1. [Development](#Development)
38+
1. [Contributing and Development](#contributing-and-development)
3939
1. [License](#License)
4040

4141
## Installation
@@ -112,7 +112,7 @@ Let's build this project (Dojo) using `dojo`:
112112
```bash
113113
git clone https://github.com/kudulab/dojo.git
114114
cd dojo
115-
dojo -c Dojofile.build "./tasks deps && ./tasks build"
115+
dojo -c Dojofile.build "./tasks build"
116116
```
117117

118118
Here we used Dojo flag `-c Dojofile.build`. This way we instructed dojo CLI which Dojofile to use. Dojofile keeps information about the Docker Image. [Dojofile.build](https://github.com/kudulab/dojo/blob/master/Dojofile.build) uses [kudulab/golang-dojo](https://github.com/kudulab/docker-golang-dojo) Docker image.
@@ -123,7 +123,7 @@ There are also Dojo Docker images which bundle a tool (or group of tools), e.g.
123123
```
124124
$ nano Dojofile
125125
$ cat Dojofile
126-
DOJO_DOCKER_IMAGE="kudulab/aws-dojo:0.6.0"
126+
DOJO_DOCKER_IMAGE="kudulab/aws-dojo:0.7.0"
127127
$ dojo
128128
# now we run interactively in the Dojo Docker container
129129
dojo@407490ab35cb(aws-dojo):/dojo/work$ aws ec2 describe-instances --filters "Name=tag:Name,Values=ec2-ansible-test"
@@ -861,25 +861,70 @@ If we extend this concept, then we soon realize that the project did not define
861861
In any sensible organization, configuration management is used to provision the CI-agents and developer's workstation building the project. It is one level better than the README, but still the definition of the environment exists outside the project and there is no reference to it.
862862
The `Dojofile` is the *lock* file which allows to store this reference in source control. When you run `dojo <command>`, then the environment is fetched, just like a dependency manager would fetch all dependencies of the project.
863863

864-
## Development
865-
Run these commands in `dojo` (use previous version of dojo to build a next one):
864+
## Contributing and Development
865+
866+
Instructions how to update this project.
867+
868+
1. Create a new feature branch from the `master` branch
869+
2. Work on your changes in that feature branch. If you want, describe you changes in [CHANGELOG.md](CHANGELOG.md)
870+
3. Compile the code and run tests locally, see the [2 options](#2-options-to-develop-Dojo) below
871+
4. If you are happy with the results, create a PR from your feature branch to the main branch
872+
873+
After this, someone will read your PR, merge it and ensure version bump (using `./tasks set_version`). CI pipeline will run to automatically build and test docker image, release the project and publish the docker image.
874+
875+
### 2 options to develop Dojo
876+
You may either use Dojo to develop Dojo, or use your local environment
877+
878+
You may take a look at the [CICD pipeline config](.circleci/config.yml) and at the [tasks](tasks) file. The tasks file has the same purpose as Makefile or Rakefile.
879+
880+
#### Option 1: Using Dojo to develop Dojo
881+
1. Please ensure you have the [runtime dependencies](#dependencies) installed
882+
2. Please install [Dojo](#installation)
883+
3. Compile the code and run unit tests:
866884
```
867-
./tasks deps
868-
./tasks build
869-
./tasks unit
885+
$ dojo -c Dojofile.build
886+
./tasks _build
887+
./tasks _unit
888+
./tasks symlink linux
889+
# or instead, if you're running on Mac: ./tasks symlink darwin
870890
```
871891

872-
Run integration tests, (this uses [inception-dojo](https://github.com/kudulab/docker-inception-dojo) docker image):
892+
or
893+
```
894+
./tasks build
895+
./tasks unit
896+
897+
./tasks symlink linux
898+
# or instead, if you're running on Mac: ./tasks symlink darwin
899+
```
900+
901+
4. Run end to end tests:
873902
```
874-
./tasks symlink linux
875-
# or instead, if you're running on Mac: ./tasks symlink linux
876-
./tasks e2e alpine
877903
./tasks e2e ubuntu18
904+
./tasks e2e alpine
878905
```
879906

907+
#### Option 2: Using local environment to develop Dojo
908+
1. Please ensure you have the [runtime dependencies](#dependencies) installed
909+
2. Please install the development dependencies:
910+
* Golang
911+
* Python
912+
913+
3. Now you can compile and test Dojo:
914+
915+
```
916+
./tasks _build
917+
./tasks _unit
918+
919+
./tasks symlink linux
920+
# or instead, if you're running on Mac: ./tasks symlink darwin
921+
./tasks _e2e
922+
```
923+
924+
880925
## License
881926

882-
Copyright 2019 Ewa Czechowska, Tomasz Sętkowski
927+
Copyright 2019-2022 Ava Czechowska, Tom Setkowski
883928

884929
Licensed under the Apache License, Version 2.0 (the "License");
885930
you may not use this file except in compliance with the License.

config_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,18 @@ func Test_getMergedConfig(t *testing.T){
248248
DockerImage: "img",
249249
}
250250
config3 := getDefaultConfig("somefile")
251+
currentDirectory, err := os.Getwd()
252+
if err != nil {
253+
panic(err)
254+
}
255+
251256
mergedConfig := getMergedConfig(config1, config2, config3)
252257
assert.Equal(t, "dummy", mergedConfig.Action)
253258
assert.Equal(t, "somefile", mergedConfig.ConfigFile)
254259
assert.Equal(t, "false", mergedConfig.Debug)
255260
assert.Equal(t, "mydriver", mergedConfig.Driver)
256261
assert.Equal(t, "true", mergedConfig.RemoveContainers)
257-
assert.Contains(t, mergedConfig.WorkDirOuter, "/src/dojo")
262+
assert.Contains(t, mergedConfig.WorkDirOuter, currentDirectory)
258263
assert.Equal(t, "/dojo/work", mergedConfig.WorkDirInner)
259264
assert.Equal(t, "/tmp/myhome", mergedConfig.IdentityDirOuter)
260265
assert.Equal(t, "img", mergedConfig.DockerImage)

glide.lock

Lines changed: 0 additions & 16 deletions
This file was deleted.

glide.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

go.mod

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module github.com/kudulab/dojo
2+
3+
go 1.17
4+
5+
require github.com/stretchr/testify v1.7.0
6+
7+
require (
8+
github.com/davecgh/go-spew v1.1.0 // indirect
9+
github.com/pmezard/go-difflib v1.0.0 // indirect
10+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
11+
)

go.sum

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
2+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
4+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
5+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
6+
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
7+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
8+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
9+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
10+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
11+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

tasks

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ function setup_github_credentials {
3434

3535
command="$1"
3636
case "${command}" in
37-
deps)
38-
glide install
39-
;;
40-
build)
37+
_build)
4138
rm -rf bin/dojo
4239
# disable the use of cgo with: CGO_ENABLED=0
4340
(set -x; GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o bin/dojo_darwin_amd64 ./; )
4441
(set -x; GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o bin/dojo_linux_amd64 ./; )
4542
# to get a list supported golang platforms: go tool dist list
4643
;;
44+
build)
45+
dojo -c Dojofile.build "./tasks _build"
46+
;;
4747
symlink)
4848
if [[ -n "$2" ]]; then
4949
os_suffix=$2
@@ -56,24 +56,26 @@ case "${command}" in
5656
ln -s dojo_${os_suffix}_amd64 ./bin/dojo
5757
chmod +x ./bin/dojo
5858
;;
59-
unit)
59+
_unit)
6060
(set -x; go test -v -race ./... | sed ''/PASS/s//$(printf "\033[32mPASS\033[0m")/'' | sed ''/FAIL/s//$(printf "\033[31mFAIL\033[0m")/''; )
6161
;;
62-
e2e_py)
63-
echo "Running task: e2e_py"
62+
unit)
63+
dojo -c Dojofile.build "./tasks _unit"
64+
;;
65+
_e2e)
66+
echo "Running task: e2e"
67+
if [[ ! -f "bin/dojo" ]]; then
68+
echo "Error: File bin/dojo not found. Please run either './tasks symlink linux' or ./tasks symlink darwin' depending on your OS"
69+
exit 1
70+
fi
6471
python3 -m venv venv
6572
source venv/bin/activate
6673
pip3 install -r test/requirements.txt
6774
pytest test --verbose
6875
;;
69-
e2e_invalid_environment)
70-
echo "Running task: e2e_invalid_environment"
71-
docker run -t --rm -v ${PWD}/bin/dojo:/usr/bin/dojo alpine:3.15 "/usr/bin/dojo" 2>&1 | grep "Error while verifying if Bash is installed" && true
72-
;;
7376
e2e)
7477
check_flavor $2
75-
dojo -c Dojofile.e2e-$2 "./tasks e2e_py"
76-
./tasks e2e_invalid_environment
78+
dojo -c Dojofile.e2e-$2 "./tasks _e2e"
7779
;;
7880
test_signals)
7981
check_flavor $2

0 commit comments

Comments
 (0)