oc new-project gogs
Install persistent PostgreSQL. Set postgresql username, password and database to gogs.
docker pull wkulhanek/gogs:11.4
oc new-app wkulhanek/gogs:11.4
[root@openshift todoAPIjs]# oc project gogs
[root@openshift todoAPIjs]# oc get pods
NAME READY STATUS RESTARTS AGE
gogs-3-t3wqs 1/1 Running 0 9h
postgresql-1-7969q 1/1 Running 0 10h
oc rsh gogs-3-t3wqs cat /opt/gogs/custom/conf/app.ini
git clone https://github.com/corpbob/todoAPIjs.git
cd todoAPIjs
git remote add gogs <your gogs todoAPIjs repository url>
git push gogs master
oc project todo-dev
oc secrets new-basicauth gogs-secret --username=<your gogs username> --password=<your gogs password>
source:
type: Git
git:
uri: 'http://gogs-gogs.10.1.2.2.nip.io/bcorpus/todoAPIjs.git'
ref: master
and change to
source:
type: Git
git:
uri: 'http://gogs-gogs.10.1.2.2.nip.io/bcorpus/todoAPIjs.git'
ref: master
sourceSecret:
name: gogs-secret
#!/bin/bash
while read oldrev newrev ref
do
if [[ $ref =~ refs/tags ]];
then
echo "Master ref received. Deploying master branch to production..."
TAG=`echo $ref|sed 's#refs/tags/\(.*\)#\1#g'`
curl -v -k --user <userid>:<api token> -G "https://jenkins-todo-dev.10.1.2.2.nip.io/job/todo-dev-todo-pipeline/buildWithParameters" -d token=secret -d commit=$newrev -d tag=$TAG
else
echo "Ref $ref successfully received. Doing nothing: only the master branch may be deployed on this server."
fi
done
node('nodejs') {
stage('build') {
openshiftBuild(buildConfig: 'todo', showBuildLogs: 'true', commitID: params.commit)
}
stage( 'Wait for approval')
input( 'Aprove to production?')
stage('Deploy UAT'){
openshiftTag(sourceStream: 'todo', sourceTag: 'latest', destinationStream: 'todo', destinationTag: params.tag)
}
}
git add README
git commit -m "test"
git tag TestReady-1.0
git push gogs TestReady-1.0