Skip to content

Commit

Permalink
fix release pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
rawlingsj committed Jun 9, 2018
1 parent 9a183c3 commit 7f0de65
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ FROM centos:7

ENTRYPOINT ["jx", "version"]

COPY ./build/linux/jx /usr/bin/jx
COPY ./build/linux/jx /usr/bin/jx
2 changes: 1 addition & 1 deletion Dockerfile.base
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM jenkinsxio/builder-base:latest

COPY build/linux/jx-linux-amd64 /usr/bin/jx
COPY build/linux/jx /usr/bin/jx
2 changes: 1 addition & 1 deletion Dockerfile.buildgo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# this is used for testing jx inside a cluster in development
FROM jenkinsxio/builder-go:latest

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

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

COPY build/linux/jx-linux-amd64 /usr/bin/jx
COPY build/linux/ /usr/bin/jx
6 changes: 3 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pipeline {
}
environment {
GH_CREDS = credentials('jenkins-x-github')
CHARTMUSEUM_CREDS = credentials('jenkins-x-chartmuseum')
BUILD_NUMBER = "$BUILD_NUMBER"
GIT_USERNAME = "$GH_CREDS_USR"
GIT_API_TOKEN = "$GH_CREDS_PSW"
Expand All @@ -26,7 +27,7 @@ pipeline {
container('go') {
sh "make linux"
sh "make test"
sh "./build/linux/jx-linux-amd64 --help"
sh "./build/linux/jx --help"

sh "docker build -t docker.io/$ORG/$APP_NAME:$PREVIEW_VERSION ."

Expand All @@ -36,7 +37,7 @@ pipeline {
}
}
}

stage('Build and Release') {
when {
branch 'master'
Expand All @@ -52,7 +53,6 @@ pipeline {
dir ('/home/jenkins/go/src/github.com/jenkins-x/jx/charts/jx') {
container('go') {
sh "helm init --client-only"
input 'ok'
sh "make release"
}
}
Expand Down
50 changes: 24 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,53 +77,51 @@ vendoring:
$(GO) get -u github.com/golang/dep/cmd/dep
GO15VENDOREXPERIMENT=1 dep ensure

release:
release: check
rm -rf build release && mkdir build release
#for os in linux darwin ; do \
# CGO_ENABLED=$(CGO_ENABLED) GOOS=$$os GOARCH=amd64 $(GO) build $(BUILDFLAGS) -o build/$$os/$(NAME) cmd/jx/jx.go ; \
#done
#CGO_ENABLED=$(CGO_ENABLED) GOOS=windows GOARCH=amd64 $(GO) build $(BUILDFLAGS) -o build/$(NAME)-windows-amd64.exe cmd/jx/jx.go
#zip --junk-paths release/$(NAME)-windows-amd64.zip build/$(NAME)-windows-amd64.exe README.md LICENSE
# CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GOARCH=arm $(GO) build $(BUILDFLAGS) -o build/arm/$(NAME) cmd/jx/jx.go
CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GOARCH=amd64 $(GO) build $(BUILDFLAGS) -o build/linux/$(NAME) cmd/jx/jx.go
ls -al ./build
for os in linux darwin ; do \
CGO_ENABLED=$(CGO_ENABLED) GOOS=$$os GOARCH=amd64 $(GO) build $(BUILDFLAGS) -o build/$$os/$(NAME) cmd/jx/jx.go ; \
done
CGO_ENABLED=$(CGO_ENABLED) GOOS=windows GOARCH=amd64 $(GO) build $(BUILDFLAGS) -o build/$(NAME)-windows-amd64.exe cmd/jx/jx.go
zip --junk-paths release/$(NAME)-windows-amd64.zip build/$(NAME)-windows-amd64.exe README.md LICENSE
CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GOARCH=arm $(GO) build $(BUILDFLAGS) -o build/arm/$(NAME) cmd/jx/jx.go

docker build -t docker.io/jenkinsxio/$(NAME):$(VERSION) .
docker push docker.io/jenkinsxio/$(NAME):$(VERSION)

#chmod +x build/darwin/$(NAME)
chmod +x build/darwin/$(NAME)
chmod +x build/linux/$(NAME)
#chmod +x build/arm/$(NAME)
chmod +x build/arm/$(NAME)

#cd ./build/darwin; tar -zcvf ../../release/jx-darwin-amd64.tar.gz jx
cd ./build/darwin; tar -zcvf ../../release/jx-darwin-amd64.tar.gz jx
cd ./build/linux; tar -zcvf ../../release/jx-linux-amd64.tar.gz jx
#cd ./build/arm; tar -zcvf ../../release/jx-linux-arm.tar.gz jx
cd ./build/arm; tar -zcvf ../../release/jx-linux-arm.tar.gz jx

go get -u github.com/progrium/gh-release
gh-release checksums sha256
gh-release create jenkins-x/$(NAME) $(VERSION) master $(VERSION)

jx step changelog --header-file docs/dev/changelog-header.md --version $(VERSION)

#updatebot push-version --kind brew jx $(VERSION)
#updatebot push-version --kind docker JX_VERSION $(VERSION)
#updatebot push-regex -r "\s*release = \"(.*)\"" -v $(VERSION) config.toml
#updatebot update-loop
updatebot push-version --kind brew jx $(VERSION)
updatebot push-version --kind docker JX_VERSION $(VERSION)
updatebot push-regex -r "\s*release = \"(.*)\"" -v $(VERSION) config.toml
updatebot update-loop

#echo "Updating the JX CLI reference docs"
#git clone https://github.com/jenkins-x/jx-docs.git
#cd jx-docs/content/commands; \
# ../../../build/linux/jx create docs; \
# git config credential.helper store; \
# git add *; \
# git commit --allow-empty -a -m "updated jx commands from $(VERSION)"; \
# git push origin
echo "Updating the JX CLI reference docs"
git clone https://github.com/jenkins-x/jx-docs.git
cd jx-docs/content/commands; \
../../../build/linux/jx create docs; \
git config credential.helper store; \
git add *; \
git commit --allow-empty -a -m "updated jx commands from $(VERSION)"; \
git push origin

clean:
rm -rf build release

linux:
CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GOARCH=amd64 $(GO) build $(BUILDFLAGS) -o build/linux/jx-linux-amd64 cmd/jx/jx.go
CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GOARCH=amd64 $(GO) build $(BUILDFLAGS) -o build/linux/jx cmd/jx/jx.go

docker: linux
docker build --no-cache -t jenkinsxio/jx:dev .
Expand Down
3 changes: 1 addition & 2 deletions charts/jx/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CHART_REPO := http://jenkins-x-chartmuseum:8080
NAME := jx
OS := $(shell uname)
RELEASE_VERSION := $(cat ../../pkg/version/VERSION)
RELEASE_VERSION := $(shell cat ../../pkg/version/VERSION)

setup:
helm repo add jenkins-x https://chartmuseum.build.cd.jenkins-x.io
Expand Down Expand Up @@ -38,5 +38,4 @@ endif
helm package .
curl --fail -u $(CHARTMUSEUM_CREDS_USR):$(CHARTMUSEUM_CREDS_PSW) --data-binary "@$(NAME)-$(RELEASE_VERSION).tgz" $(CHART_REPO)/api/charts
rm -rf ${NAME}*.tgz
updatebot push-version --kind make CHART_VERSION $(RELEASE_VERSION)

0 comments on commit 7f0de65

Please sign in to comment.