Skip to content

Commit

Permalink
Merge pull request #55 from 7h3-3mp7y-m4n/doc
Browse files Browse the repository at this point in the history
Fix `.dockerignore`, add `docker run` and `go vet` tests in CI
  • Loading branch information
mathieu-benoit authored Oct 16, 2024
2 parents 92c85b8 + 5846104 commit d94aa99
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
!go.sum
!.git/
!internal/
!main.go/
!main.go
!main_init.go
!main_generate.go
!main_resources.go/
11 changes: 10 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Run Go Vet
run: go vet ./...
- name: Run Go Tests
run: go test ./... -cover -race
- name: Build binary
Expand All @@ -33,4 +35,11 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
push: false
push: false
load: true
tags: score-k8s:test
- name: Test docker image
run: |
docker run --rm score-k8s:test --version
docker run -v .:/score-k8s --rm score-k8s:test init
ls | grep score.yaml
11 changes: 9 additions & 2 deletions internal/convert/container_files.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ func convertContainerFile(
Name: mount.Name,
VolumeSource: coreV1.VolumeSource{
ConfigMap: &coreV1.ConfigMapVolumeSource{
Items: []coreV1.KeyToPath{{"file", filepath.Base(fileElem.Target), mountMode}},
Items: []coreV1.KeyToPath{{
Key: "file",
Path: filepath.Base(fileElem.Target),
Mode: mountMode,
}},
LocalObjectReference: coreV1.LocalObjectReference{Name: configMapName},
},
},
Expand All @@ -107,7 +111,10 @@ func convertContainerFile(
VolumeSource: coreV1.VolumeSource{
Secret: &coreV1.SecretVolumeSource{
SecretName: refs[0].Name,
Items: []coreV1.KeyToPath{{refs[0].Key, filepath.Base(fileElem.Target), mountMode}},
Items: []coreV1.KeyToPath{{
Key: refs[0].Key,
Path: filepath.Base(fileElem.Target),
Mode: mountMode}},
},
},
}, nil
Expand Down

0 comments on commit d94aa99

Please sign in to comment.