Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions ci/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
== Concourse pipeline

To set the pipeline first create a file in this directory called `secrets.yml`:

[source,yaml]
.secrets.yml
----
docker-hub-username: "<username>"
docker-hub-password: "<secret>"
github-username: "<username>"
github-password: "<secret>"
----

NOTE: The file should be ignored by git, make sure that you don't commit it!

Once the file has been created, the pipeline can be deployed:

[source]
----
$ fly -t spring set-pipeline -p concourse-java-scripts -c ci/pipeline.yml --load-vars-from secrets.yml
----

=== Release

To perform a release run:

[source]
----
$ fly -t spring trigger-job -j concourse-java-scripts/release
----
4 changes: 4 additions & 0 deletions ci/images/concourse-java-scripts-ci-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM debian

RUN apt-get update && \
apt-get install -y git
71 changes: 71 additions & 0 deletions ci/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
resources:
- name: git-repo
type: git
source:
uri: https://github.com/mbhave/concourse-java-scripts
branch: master
ignore_paths: ["ci/images/*"]
- name: ci-images-git-repo
type: git
source:
uri: https://github.com/mbhave/concourse-java-scripts
username: ((github-username))
password: ((github-password))
branch: master
paths: ["ci/images/*"]
- name: concourse-java-scripts-ci-image
type: docker-image
source:
repository: mbhave/concourse-java-scripts-ci-image
username: ((docker-hub-username))
password: ((docker-hub-password))
tag: master
jobs:
- name: build-concourse-java-scripts-ci-image
plan:
- get: ci-images-git-repo
trigger: true
- put: concourse-java-scripts-ci-image
params:
build: ci-images-git-repo/ci/images/concourse-java-scripts-ci-image
- name: test
plan:
- get: git-repo
trigger: true
- task: test
config:
platform: linux
image_resource:
type: docker-image
source:
repository: mbhave/concourse-java-scripts-ci-image
tag: master
inputs:
- name: git-repo
run:
path: git-repo/ci/scripts/test.sh
- name: release
plan:
- get: git-repo
passed: [test]
trigger: false
- task: release
config:
platform: linux
image_resource:
type: docker-image
source:
repository: mbhave/concourse-java-scripts-ci-image
tag: master
inputs:
- name: git-repo
params:
MINOR_VERSION: 0
MAJOR_VERSION: 0
run:
path: git-repo/ci/scripts/release.sh
- put: git-repo
params:
repository: release-git-repo


15 changes: 15 additions & 0 deletions ci/scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -e

git clone git-repo release-git-repo

pushd release-git-repo > /dev/null
git fetch --tags --all
last=$( git tag --list "v${MAJOR_VERSION}.${MINOR_VERSION}*"| sed -E "s/^.*${2}([0-9]+)$/\1/g" | sort -rn | head -n1 )
next=$((last+1))
releaseVersion=v${MAJOR_VERSION}.${MINOR_VERSION}.$next
echo "Releasing $releaseVersion"
git config user.name "Spring Buildmaster" > /dev/null
git config user.email "[email protected]" > /dev/null
git tag -a "v$releaseVersion" -m"Release v$releaseVersion" > /dev/null
popd > /dev/null
8 changes: 8 additions & 0 deletions ci/scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -e

export TERM=dumb

pushd git-repo
./test.sh
popd
2 changes: 2 additions & 0 deletions test/get_next_release.bats
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ mock_git_repo() {
mkdir -p "$tmpdir" >&2
cd "$tmpdir" >&2
git init >&2
git config user.name "Test User" >&2
git config user.email "[email protected]" >&2
echo "foo" > foo.txt
git add foo.txt >&2
git commit -m'Initial commit' >&2
Expand Down