Skip to content

Commit

Permalink
⬆ Upgrade to newer version of apb tool
Browse files Browse the repository at this point in the history
There's no longer an 'apb push' command, so I've removed that make
task; and I've changed the Jenkinsfile to use the apb-tools image from
the RHCC instead of DockerHub, because the only task that seems to get
updated in DockerHub is the 'nightly' one, which doesn't sound stable
enough for what we want.
  • Loading branch information
grdryn committed Dec 6, 2018
1 parent 36ed98f commit d9418d4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
16 changes: 8 additions & 8 deletions Jenkinsfile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ stage('Trust') {
enforceTrustedApproval('aerogear')
}

node ("ocp-slave") {
node ("ocp-slave") {
def apb_container_id, pod_container_id, apb_pod_output
def apb_version = "sprint147.2"
def apb_version = "v3.11"

stage('Cleanup') {
deleteDir()
}
Expand All @@ -21,21 +21,21 @@ node ("ocp-slave") {

stage('Run APB test') {
apb_container_id = sh (
script: "docker run --detach --net=host --privileged -v \$PWD:/mnt -v \$HOME/.kube:/.kube -v /var/run/docker.sock:/var/run/docker.sock -u \$UID docker.io/ansibleplaybookbundle/apb-tools:${apb_version} test --registry-route docker-registry.default.svc:5000",
script: "docker run --detach --net=host --privileged -v \$PWD:/mnt -v \$HOME/.kube:/.kube -v /var/run/docker.sock:/var/run/docker.sock -u \$UID registry.access.redhat.com/openshift3/apb-tools:${apb_version} test --registry-route docker-registry.default.svc:5000",
returnStdout: true
).trim()
}

stage('Watch the logs') {

pod_container_id = sh (
script: "sleep 30 ; docker ps --filter since=${apb_container_id} | grep 'entrypoint.sh test' | awk '{print \$1}'",
returnStdout: true
).trim()

sh "docker logs -f ${pod_container_id}"
}

stage('Get APB container logs and evaluate test result') {

apb_pod_output = sh (
Expand All @@ -45,7 +45,7 @@ node ("ocp-slave") {
).trim()

echo apb_pod_output

if ( apb_pod_output.contains("Pod phase Failed") ) {
error("APB test failed.")
}
Expand Down
9 changes: 2 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@ IMAGENAME ?= metrics-apb
TAG = latest
USER=$(shell id -u)
PWD=$(shell pwd)
build_and_push: apb_build docker_push apb_push
build_and_push: apb_build docker_push

.PHONY: apb_build
apb_build:
apb prepare
apb bundle prepare
docker build -t $(DOCKERHOST)/$(DOCKERORG)/$(IMAGENAME):$(TAG) .

.PHONY: docker_push
docker_push:
docker push $(DOCKERHOST)/$(DOCKERORG)/$(IMAGENAME):$(TAG)

.PHONY: apb_push
apb_push:
apb push

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

## Testing

If you want to test the changes made to this repo, you can do it by simply running `apb test`
If you want to test the changes made to this repo, you can do it by simply running `apb bundle test`
The test does the following:
1. Builds the APB
1. Builds the APB
1. Creates the project in currently targeted OpenShift instance
1. Runs the `provision` role
1. Runs the `test-provision` role which checks that
Expand Down Expand Up @@ -42,13 +42,13 @@ Under the `playbooks` directory create a file `requirements.yml`:
name: oc-patch-file-to-configmap
```
This file defines the `oc-patch-file-to-configmap` role as a dependency.
This file defines the `oc-patch-file-to-configmap` role as a dependency.

#### Modify Dockerfile
The next step is to modify the default `Dockerfile`. The default APB Dockerfile usually has a list of commands like this:

```
COPY playbooks /opt/apb/actions
COPY playbooks /opt/apb/project
COPY roles /opt/ansible/roles
COPY vars /opt/ansible/vars
RUN chmod -R g=u /opt/{ansible,apb}
Expand Down

0 comments on commit d9418d4

Please sign in to comment.