Skip to content

Commit

Permalink
sort deps in charts for less merge conflicts (jenkins-x#1269)
Browse files Browse the repository at this point in the history
  • Loading branch information
i0n authored and jstrachan committed Jul 12, 2018
1 parent 5680b65 commit 80e8b2b
Show file tree
Hide file tree
Showing 14 changed files with 75 additions and 17 deletions.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions Dockerfile.builder-gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# this is used for testing jx inside a cluster in development
FROM jenkinsxio/builder-gradle:latest

COPY build/linux/jx /usr/bin/jx
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions Dockerfile.builder-python
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# this is used for testing jx inside a cluster in development
FROM jenkinsxio/builder-python:latest

COPY build/linux/jx /usr/bin/jx
4 changes: 4 additions & 0 deletions Dockerfile.builder-python2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# this is used for testing jx inside a cluster in development
FROM jenkinsxio/builder-python2:latest

COPY build/linux/jx /usr/bin/jx
4 changes: 4 additions & 0 deletions Dockerfile.builder-ruby
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# this is used for testing jx inside a cluster in development
FROM jenkinsxio/builder-ruby:latest

COPY build/linux/jx /usr/bin/jx
4 changes: 4 additions & 0 deletions Dockerfile.builder-rust
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# this is used for testing jx inside a cluster in development
FROM jenkinsxio/builder-rust:latest

COPY build/linux/jx /usr/bin/jx
4 changes: 4 additions & 0 deletions Dockerfile.builder-scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# this is used for testing jx inside a cluster in development
FROM jenkinsxio/builder-scala:latest

COPY build/linux/jx /usr/bin/jx
4 changes: 4 additions & 0 deletions Dockerfile.builder-swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# this is used for testing jx inside a cluster in development
FROM jenkinsxio/builder-swift:latest

COPY build/linux/jx /usr/bin/jx
4 changes: 4 additions & 0 deletions Dockerfile.builder-terraform
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# this is used for testing jx inside a cluster in development
FROM jenkinsxio/builder-terraform:latest

COPY build/linux/jx /usr/bin/jx
40 changes: 28 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -133,35 +133,51 @@ docker: linux
docker build --no-cache -t rawlingsj/jx:dev35 .
docker push rawlingsj/jx:dev35

docker-go: linux Dockerfile.buildgo
docker build --no-cache -t builder-go -f Dockerfile.buildgo .
docker-go: linux Dockerfile.builder-go
docker build --no-cache -t builder-go -f Dockerfile.builder-go .

docker-maven: linux Dockerfile.maven
docker build --no-cache -t builder-maven -f Dockerfile.maven .
docker-maven: linux Dockerfile.builder-maven
docker build --no-cache -t builder-maven -f Dockerfile.builder-maven .

docker-pipeline: linux
docker build -t rawlingsj/builder-base:dev . -f Dockerfile-pipeline

docker-dev: linux
docker build --no-cache -t $(DOCKER_HUB_USER)/jx:dev .
docker push $(DOCKER_HUB_USER)/jx:dev
docker build --no-cache -t $(DOCKER_HUB_USER)/builder-go:dev -f Dockerfile.buildgo .
docker build --no-cache -t $(DOCKER_HUB_USER)/builder-base:dev -f Dockerfile.builder-base .
docker push $(DOCKER_HUB_USER)/builder-base:dev
docker build --no-cache -t $(DOCKER_HUB_USER)/builder-go:dev -f Dockerfile.builder-go .
docker push $(DOCKER_HUB_USER)/builder-go:dev
docker build --no-cache -t $(DOCKER_HUB_USER)/builder-maven:dev -f Dockerfile.maven .
docker build --no-cache -t $(DOCKER_HUB_USER)/builder-gradle:dev -f Dockerfile.builder-gradle .
docker push $(DOCKER_HUB_USER)/builder-gradle:dev
docker build --no-cache -t $(DOCKER_HUB_USER)/builder-maven:dev -f Dockerfile.builder-maven .
docker push $(DOCKER_HUB_USER)/builder-maven:dev
docker build --no-cache -t $(DOCKER_HUB_USER)/builder-nodejs:dev -f Dockerfile.nodejs .
docker build --no-cache -t $(DOCKER_HUB_USER)/builder-rust:dev -f Dockerfile.builder-rust .
docker push $(DOCKER_HUB_USER)/builder-rust:dev
docker build --no-cache -t $(DOCKER_HUB_USER)/builder-scala:dev -f Dockerfile.builder-scala .
docker push $(DOCKER_HUB_USER)/builder-scala:dev
docker build --no-cache -t $(DOCKER_HUB_USER)/builder-swift:dev -f Dockerfile.builder-swift .
docker push $(DOCKER_HUB_USER)/builder-swift:dev
docker build --no-cache -t $(DOCKER_HUB_USER)/builder-terraform:dev -f Dockerfile.builder-terraform .
docker push $(DOCKER_HUB_USER)/builder-terraform:dev
docker build --no-cache -t $(DOCKER_HUB_USER)/builder-nodejs:dev -f Dockerfile.builder-nodejs .
docker push $(DOCKER_HUB_USER)/builder-nodejs:dev
docker build --no-cache -t $(DOCKER_HUB_USER)/builder-base:dev -f Dockerfile.base .
docker push $(DOCKER_HUB_USER)/builder-base:dev
docker build --no-cache -t $(DOCKER_HUB_USER)/builder-python:dev -f Dockerfile.builder-python .
docker push $(DOCKER_HUB_USER)/builder-python:dev
docker build --no-cache -t $(DOCKER_HUB_USER)/builder-python2:dev -f Dockerfile.builder-python2 .
docker push $(DOCKER_HUB_USER)/builder-python2:dev
docker build --no-cache -t $(DOCKER_HUB_USER)/builder-ruby:dev -f Dockerfile.builder-ruby .
docker push $(DOCKER_HUB_USER)/builder-ruby:dev

.PHONY: release clean arm

preview:
docker build --no-cache -t docker.io/jenkinsxio/builder-maven:SNAPSHOT-JX-$(BRANCH_NAME)-$(BUILD_NUMBER) -f Dockerfile.maven .
docker build --no-cache -t docker.io/jenkinsxio/builder-maven:SNAPSHOT-JX-$(BRANCH_NAME)-$(BUILD_NUMBER) -f Dockerfile.builder-maven .
docker push docker.io/jenkinsxio/builder-maven:SNAPSHOT-JX-$(BRANCH_NAME)-$(BUILD_NUMBER)
docker build --no-cache -t docker.io/jenkinsxio/builder-go:SNAPSHOT-JX-$(BRANCH_NAME)-$(BUILD_NUMBER) -f Dockerfile.buildgo .
docker build --no-cache -t docker.io/jenkinsxio/builder-go:SNAPSHOT-JX-$(BRANCH_NAME)-$(BUILD_NUMBER) -f Dockerfile.builder-go .
docker push docker.io/jenkinsxio/builder-go:SNAPSHOT-JX-$(BRANCH_NAME)-$(BUILD_NUMBER)
docker build --no-cache -t docker.io/jenkinsxio/builder-nodejs:SNAPSHOT-JX-$(BRANCH_NAME)-$(BUILD_NUMBER) -f Dockerfile.nodejs .
docker build --no-cache -t docker.io/jenkinsxio/builder-nodejs:SNAPSHOT-JX-$(BRANCH_NAME)-$(BUILD_NUMBER) -f Dockerfile.builder-nodejs .
docker push docker.io/jenkinsxio/builder-nodejs:SNAPSHOT-JX-$(BRANCH_NAME)-$(BUILD_NUMBER)

FGT := $(GOPATH)/bin/fgt
Expand Down
20 changes: 15 additions & 5 deletions pkg/helm/helm_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package helm

import (
"fmt"
"io/ioutil"
"path/filepath"
"sort"

"github.com/ghodss/yaml"
"github.com/jenkins-x/jx/pkg/util"
"io/ioutil"
"k8s.io/helm/pkg/chartutil"
"path/filepath"
)

const (
Expand Down Expand Up @@ -62,6 +64,13 @@ type Requirements struct {
Dependencies []*Dependency `json:"dependencies"`
}

// DepSorter Used to avoid merge conflicts by sorting deps by name
type DepSorter []*Dependency

func (a DepSorter) Len() int { return len(a) }
func (a DepSorter) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a DepSorter) Less(i, j int) bool { return a[i].Name < a[j].Name }

// SetAppVersion sets the version of the app to use
func (r *Requirements) SetAppVersion(app string, version string, repository string) {
if r.Dependencies == nil {
Expand All @@ -79,13 +88,15 @@ func (r *Requirements) SetAppVersion(app string, version string, repository stri
Version: version,
Repository: repository,
})
sort.Sort(DepSorter(r.Dependencies))
}

// RemoveApp removes the given app name. Returns true if a dependency was removed
func (r *Requirements) RemoveApp(app string) bool {
for i, dep := range r.Dependencies {
if dep != nil && dep.Name == app {
r.Dependencies = append(r.Dependencies[:i], r.Dependencies[i+1:]...)
sort.Sort(DepSorter(r.Dependencies))
return true
}
}
Expand Down Expand Up @@ -152,10 +163,9 @@ func LoadRequirementsFile(fileName string) (*Requirements, error) {
return nil, err
}
return LoadRequirements(data)
} else {
r := &Requirements{}
return r, nil
}
r := &Requirements{}
return r, nil
}

// LoadRequirements loads the requirements from some data
Expand Down

0 comments on commit 80e8b2b

Please sign in to comment.