Skip to content

Commit

Permalink
Merge pull request #718 from opendevstack/fix/module-name
Browse files Browse the repository at this point in the history
Fix Go module name
  • Loading branch information
michaelsauter authored Jul 24, 2023
2 parents 35dce3b + 7af5de5 commit d649596
Show file tree
Hide file tree
Showing 99 changed files with 249 additions and 248 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ listed in the changelog.
### Fixed

- ods.yaml branch trigger patterns must be lowercase ([#713](https://github.com/opendevstack/ods-pipeline/issues/713))
- Go module name was incorrectly set to `github.com/opendevstack/pipeline`

- sonar-scanner invocations stderr not captured ([#719](https://github.com/opendevstack/ods-pipeline/issues/719))

Expand Down
6 changes: 3 additions & 3 deletions cmd/aqua-scan/aqua.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"os"
"path/filepath"

"github.com/opendevstack/pipeline/internal/command"
"github.com/opendevstack/pipeline/internal/image"
"github.com/opendevstack/pipeline/pkg/pipelinectxt"
"github.com/opendevstack/ods-pipeline/internal/command"
"github.com/opendevstack/ods-pipeline/internal/image"
"github.com/opendevstack/ods-pipeline/pkg/pipelinectxt"
)

const (
Expand Down
6 changes: 3 additions & 3 deletions cmd/aqua-scan/bitbucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"fmt"
"time"

"github.com/opendevstack/pipeline/pkg/bitbucket"
"github.com/opendevstack/pipeline/pkg/logging"
"github.com/opendevstack/pipeline/pkg/pipelinectxt"
"github.com/opendevstack/ods-pipeline/pkg/bitbucket"
"github.com/opendevstack/ods-pipeline/pkg/logging"
"github.com/opendevstack/ods-pipeline/pkg/pipelinectxt"
)

// createBitbucketInsightReport attaches a code insight report to the Git commit
Expand Down
4 changes: 2 additions & 2 deletions cmd/aqua-scan/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"flag"
"os"

"github.com/opendevstack/pipeline/internal/image"
"github.com/opendevstack/pipeline/pkg/pipelinectxt"
"github.com/opendevstack/ods-pipeline/internal/image"
"github.com/opendevstack/ods-pipeline/pkg/pipelinectxt"
"golang.org/x/exp/slog"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/aqua-scan/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"os"
"path/filepath"

"github.com/opendevstack/pipeline/internal/image"
"github.com/opendevstack/pipeline/pkg/pipelinectxt"
"github.com/opendevstack/ods-pipeline/internal/image"
"github.com/opendevstack/ods-pipeline/pkg/pipelinectxt"
"golang.org/x/exp/slog"
)

Expand Down
8 changes: 4 additions & 4 deletions cmd/artifact-download/artifact_download.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"os"
"path/filepath"

"github.com/opendevstack/pipeline/pkg/artifact"
"github.com/opendevstack/pipeline/pkg/logging"
"github.com/opendevstack/pipeline/pkg/nexus"
"github.com/opendevstack/pipeline/pkg/pipelinectxt"
"github.com/opendevstack/ods-pipeline/pkg/artifact"
"github.com/opendevstack/ods-pipeline/pkg/logging"
"github.com/opendevstack/ods-pipeline/pkg/nexus"
"github.com/opendevstack/ods-pipeline/pkg/pipelinectxt"
"sigs.k8s.io/yaml"
)

Expand Down
8 changes: 4 additions & 4 deletions cmd/artifact-download/artifact_download_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"testing"

"github.com/google/go-cmp/cmp"
"github.com/opendevstack/pipeline/internal/gittest"
"github.com/opendevstack/pipeline/pkg/logging"
"github.com/opendevstack/pipeline/pkg/nexus"
"github.com/opendevstack/pipeline/pkg/pipelinectxt"
"github.com/opendevstack/ods-pipeline/internal/gittest"
"github.com/opendevstack/ods-pipeline/pkg/logging"
"github.com/opendevstack/ods-pipeline/pkg/nexus"
"github.com/opendevstack/ods-pipeline/pkg/pipelinectxt"
)

func TestGetODSContextFromDir(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions cmd/artifact-download/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (
"os"
"path/filepath"

"github.com/opendevstack/pipeline/internal/installation"
"github.com/opendevstack/pipeline/pkg/logging"
"github.com/opendevstack/pipeline/pkg/nexus"
"github.com/opendevstack/ods-pipeline/internal/installation"
"github.com/opendevstack/ods-pipeline/pkg/logging"
"github.com/opendevstack/ods-pipeline/pkg/nexus"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/deploy-helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"

"github.com/google/shlex"
"github.com/opendevstack/pipeline/internal/command"
"github.com/opendevstack/ods-pipeline/internal/command"
"sigs.k8s.io/yaml"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/deploy-helm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"io/fs"
"os"

"github.com/opendevstack/pipeline/pkg/logging"
"github.com/opendevstack/pipeline/pkg/pipelinectxt"
"github.com/opendevstack/ods-pipeline/pkg/logging"
"github.com/opendevstack/ods-pipeline/pkg/pipelinectxt"
"k8s.io/client-go/kubernetes"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/deploy-helm/skopeo.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"io"
"strings"

"github.com/opendevstack/pipeline/internal/command"
"github.com/opendevstack/pipeline/pkg/artifact"
"github.com/opendevstack/ods-pipeline/internal/command"
"github.com/opendevstack/ods-pipeline/pkg/artifact"
)

func (d *deployHelm) copyImage(imageArtifact artifact.Image, destRegistryToken string, outWriter, errWriter io.Writer) error {
Expand Down
12 changes: 6 additions & 6 deletions cmd/deploy-helm/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import (
"regexp"
"strings"

"github.com/opendevstack/pipeline/internal/command"
"github.com/opendevstack/pipeline/internal/directory"
"github.com/opendevstack/pipeline/internal/file"
k "github.com/opendevstack/pipeline/internal/kubernetes"
"github.com/opendevstack/pipeline/pkg/artifact"
"github.com/opendevstack/pipeline/pkg/pipelinectxt"
"github.com/opendevstack/ods-pipeline/internal/command"
"github.com/opendevstack/ods-pipeline/internal/directory"
"github.com/opendevstack/ods-pipeline/internal/file"
k "github.com/opendevstack/ods-pipeline/internal/kubernetes"
"github.com/opendevstack/ods-pipeline/pkg/artifact"
"github.com/opendevstack/ods-pipeline/pkg/pipelinectxt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/deploy-helm/steps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"testing"

"github.com/opendevstack/pipeline/pkg/artifact"
"github.com/opendevstack/ods-pipeline/pkg/artifact"
)

func TestArtifactFilename(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions cmd/docs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"log"
"path/filepath"

"github.com/opendevstack/pipeline/internal/docs"
"github.com/opendevstack/pipeline/internal/projectpath"
"github.com/opendevstack/ods-pipeline/internal/docs"
"github.com/opendevstack/ods-pipeline/internal/projectpath"
)

func main() {
Expand Down
18 changes: 9 additions & 9 deletions cmd/finish/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import (
"os"
"path/filepath"

"github.com/opendevstack/pipeline/internal/kubernetes"
"github.com/opendevstack/pipeline/internal/notification"
"github.com/opendevstack/pipeline/internal/tekton"
"github.com/opendevstack/pipeline/pkg/artifact"
"github.com/opendevstack/pipeline/pkg/bitbucket"
"github.com/opendevstack/pipeline/pkg/config"
"github.com/opendevstack/pipeline/pkg/logging"
"github.com/opendevstack/pipeline/pkg/nexus"
"github.com/opendevstack/pipeline/pkg/pipelinectxt"
"github.com/opendevstack/ods-pipeline/internal/kubernetes"
"github.com/opendevstack/ods-pipeline/internal/notification"
"github.com/opendevstack/ods-pipeline/internal/tekton"
"github.com/opendevstack/ods-pipeline/pkg/artifact"
"github.com/opendevstack/ods-pipeline/pkg/bitbucket"
"github.com/opendevstack/ods-pipeline/pkg/config"
"github.com/opendevstack/ods-pipeline/pkg/logging"
"github.com/opendevstack/ods-pipeline/pkg/nexus"
"github.com/opendevstack/ods-pipeline/pkg/pipelinectxt"
)

type options struct {
Expand Down
8 changes: 4 additions & 4 deletions cmd/finish/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"path/filepath"
"testing"

"github.com/opendevstack/pipeline/pkg/config"
"github.com/opendevstack/pipeline/pkg/logging"
"github.com/opendevstack/pipeline/pkg/nexus"
"github.com/opendevstack/pipeline/pkg/pipelinectxt"
"github.com/opendevstack/ods-pipeline/pkg/config"
"github.com/opendevstack/ods-pipeline/pkg/logging"
"github.com/opendevstack/ods-pipeline/pkg/nexus"
"github.com/opendevstack/ods-pipeline/pkg/pipelinectxt"
)

func TestUploadArtifacts(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/package-image/buildah.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"strings"

"github.com/google/shlex"
"github.com/opendevstack/pipeline/internal/command"
"github.com/opendevstack/ods-pipeline/internal/command"
)

const (
Expand Down
8 changes: 4 additions & 4 deletions cmd/package-image/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"path/filepath"
"strings"

"github.com/opendevstack/pipeline/internal/image"
"github.com/opendevstack/pipeline/pkg/artifact"
"github.com/opendevstack/pipeline/pkg/logging"
"github.com/opendevstack/pipeline/pkg/pipelinectxt"
"github.com/opendevstack/ods-pipeline/internal/image"
"github.com/opendevstack/ods-pipeline/pkg/artifact"
"github.com/opendevstack/ods-pipeline/pkg/logging"
"github.com/opendevstack/ods-pipeline/pkg/pipelinectxt"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions cmd/package-image/skopeo_tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"io"
"strings"

"github.com/opendevstack/pipeline/internal/command"
"github.com/opendevstack/pipeline/internal/image"
"github.com/opendevstack/ods-pipeline/internal/command"
"github.com/opendevstack/ods-pipeline/internal/image"
)

func (p *packageImage) skopeoTag(idt *image.IdentityWithTag, outWriter, errWriter io.Writer) error {
Expand Down
6 changes: 3 additions & 3 deletions cmd/package-image/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"strings"

"github.com/google/shlex"
"github.com/opendevstack/pipeline/internal/directory"
"github.com/opendevstack/pipeline/internal/image"
"github.com/opendevstack/pipeline/pkg/pipelinectxt"
"github.com/opendevstack/ods-pipeline/internal/directory"
"github.com/opendevstack/ods-pipeline/internal/image"
"github.com/opendevstack/ods-pipeline/pkg/pipelinectxt"
)

type PackageStep func(d *packageImage) (*packageImage, error)
Expand Down
4 changes: 2 additions & 2 deletions cmd/package-image/trivy.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"path/filepath"

"github.com/google/shlex"
"github.com/opendevstack/pipeline/internal/command"
"github.com/opendevstack/pipeline/pkg/pipelinectxt"
"github.com/opendevstack/ods-pipeline/internal/command"
"github.com/opendevstack/ods-pipeline/pkg/pipelinectxt"
)

const (
Expand Down
10 changes: 5 additions & 5 deletions cmd/pipeline-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (
"strings"
"time"

kubernetesClient "github.com/opendevstack/pipeline/internal/kubernetes"
"github.com/opendevstack/pipeline/internal/manager"
tektonClient "github.com/opendevstack/pipeline/internal/tekton"
"github.com/opendevstack/pipeline/pkg/bitbucket"
"github.com/opendevstack/pipeline/pkg/logging"
kubernetesClient "github.com/opendevstack/ods-pipeline/internal/kubernetes"
"github.com/opendevstack/ods-pipeline/internal/manager"
tektonClient "github.com/opendevstack/ods-pipeline/internal/tekton"
"github.com/opendevstack/ods-pipeline/pkg/bitbucket"
"github.com/opendevstack/ods-pipeline/pkg/logging"
tekton "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
)

Expand Down
6 changes: 3 additions & 3 deletions cmd/sonar/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"strings"
"time"

"github.com/opendevstack/pipeline/pkg/logging"
"github.com/opendevstack/pipeline/pkg/pipelinectxt"
"github.com/opendevstack/pipeline/pkg/sonar"
"github.com/opendevstack/ods-pipeline/pkg/logging"
"github.com/opendevstack/ods-pipeline/pkg/pipelinectxt"
"github.com/opendevstack/ods-pipeline/pkg/sonar"
)

type options struct {
Expand Down
6 changes: 3 additions & 3 deletions cmd/sonar/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"strings"
"testing"

"github.com/opendevstack/pipeline/pkg/logging"
"github.com/opendevstack/pipeline/pkg/pipelinectxt"
"github.com/opendevstack/pipeline/pkg/sonar"
"github.com/opendevstack/ods-pipeline/pkg/logging"
"github.com/opendevstack/ods-pipeline/pkg/pipelinectxt"
"github.com/opendevstack/ods-pipeline/pkg/sonar"
)

type fakeClient struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/start/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"path/filepath"
"strings"

"github.com/opendevstack/pipeline/internal/command"
"github.com/opendevstack/pipeline/pkg/logging"
"github.com/opendevstack/ods-pipeline/internal/command"
"github.com/opendevstack/ods-pipeline/pkg/logging"
)

// gitCheckoutParams holds the parameters configuring the checkout.
Expand Down
12 changes: 6 additions & 6 deletions cmd/start/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (
"path/filepath"
"strings"

"github.com/opendevstack/pipeline/internal/tekton"
"github.com/opendevstack/pipeline/pkg/bitbucket"
"github.com/opendevstack/pipeline/pkg/config"
"github.com/opendevstack/pipeline/pkg/logging"
"github.com/opendevstack/pipeline/pkg/nexus"
"github.com/opendevstack/pipeline/pkg/pipelinectxt"
"github.com/opendevstack/ods-pipeline/internal/tekton"
"github.com/opendevstack/ods-pipeline/pkg/bitbucket"
"github.com/opendevstack/ods-pipeline/pkg/config"
"github.com/opendevstack/ods-pipeline/pkg/logging"
"github.com/opendevstack/ods-pipeline/pkg/nexus"
"github.com/opendevstack/ods-pipeline/pkg/pipelinectxt"
)

type options struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/tasks/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"log"
"path/filepath"

"github.com/opendevstack/pipeline/internal/projectpath"
"github.com/opendevstack/pipeline/internal/tasks"
"github.com/opendevstack/ods-pipeline/internal/projectpath"
"github.com/opendevstack/ods-pipeline/internal/tasks"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion docs/authoring-tasks.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Of course this doesn't do anything useful in the CI pipeline. Typically, you'd n

=== Using pipeline context

The pipeline generated by ODS is automatically fed with a few parameters which can be passed to each task. However, that would lead to a lot of boilerplate in `ods.yaml` as many parameters would need to be passed over and over again to each task. To avoid this, the parameters are cached by the `ods-start` task in the workspace in a `.ods` directory. For example, the `repository` parameter value is written to a file `.ods/repository`. This file and other similar files are forming the "pipeline context", which can be read by task authors to access this type of information easily. If you are writing your task logic in Go, you can conveniently read this cache into an `ODSContext` struct using `ReadCache` from the `github.com/opendevstack/pipeline/pkg/pipelinectxt` package.
The pipeline generated by ODS is automatically fed with a few parameters which can be passed to each task. However, that would lead to a lot of boilerplate in `ods.yaml` as many parameters would need to be passed over and over again to each task. To avoid this, the parameters are cached by the `ods-start` task in the workspace in a `.ods` directory. For example, the `repository` parameter value is written to a file `.ods/repository`. This file and other similar files are forming the "pipeline context", which can be read by task authors to access this type of information easily. If you are writing your task logic in Go, you can conveniently read this cache into an `ODSContext` struct using `ReadCache` from the `github.com/opendevstack/ods-pipeline/pkg/pipelinectxt` package.

=== Handling artifacts

Expand Down
6 changes: 3 additions & 3 deletions docs/development.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ As mentioned above, `make test` will run all tests. You may also run only a subs

Individual task test can be executed like this:
```
go test -run ^TestTaskODSBuildImage github.com/opendevstack/pipeline/test/tasks -v -count=1
go test -run ^TestTaskODSBuildImage github.com/opendevstack/ods-pipeline/test/tasks -v -count=1
```

Further, if you only want to run one test case from the map of test cases, this can be done like this:
```
go test -run ^TestTaskODSBuildNPM/build_backend_javascript_app$ github.com/opendevstack/pipeline/test/tasks -v -count=1
go test -run ^TestTaskODSBuildNPM/build_backend_javascript_app$ github.com/opendevstack/ods-pipeline/test/tasks -v -count=1
```

Be aware that depending on the tested task, some local services (e.g. Bitbucket) need to run for the test to succeed. These are all started via `make prepare-local-env`, but more fine-grained control is possible too.
Expand Down Expand Up @@ -73,7 +73,7 @@ If you place this file in the root of the `ods-pipeline` repository, it will aut
Finally, you need to run the tests, passing the configuration created earlier and the token of a serviceaccount with enough permissions in the target namespace:

```
go test --tags=external -run ^TestTaskODSDeployHelmExternal$ github.com/opendevstack/pipeline/test/tasks -count=1 -v -external-cluster-token=*** -external-cluster-config=ods.external.yaml
go test --tags=external -run ^TestTaskODSDeployHelmExternal$ github.com/opendevstack/ods-pipeline/test/tasks -count=1 -v -external-cluster-token=*** -external-cluster-config=ods.external.yaml
```

The above command runs only the external deployment test, but you may also remove this limitation (by removing `-run ^TestTaskODSDeployHelmExternal$`) and run the whole test suite including the external deployment test.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/opendevstack/pipeline
module github.com/opendevstack/ods-pipeline

go 1.19

Expand Down
2 changes: 1 addition & 1 deletion internal/docs/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"
"text/template"

"github.com/opendevstack/pipeline/internal/command"
"github.com/opendevstack/ods-pipeline/internal/command"
tekton "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
"sigs.k8s.io/yaml"
)
Expand Down
Loading

0 comments on commit d649596

Please sign in to comment.