summaryrefslogtreecommitdiffstats
path: root/docker/Makefile
blob: 036d67db3326bd90d55d75a8454174c7bceede5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
##############################################################################
# Copyright (c) 2015 Ericsson AB and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

SHELL = /bin/bash

IMAGE = opnfv/yardstick

DOCKER_TAG = brahmaputra.0

.PHONY: all
all: .docker

.docker:
	/usr/bin/docker build --rm=true --no-cache=true -t $(IMAGE):$(DOCKER_TAG) yardstick-ci
	/usr/bin/docker tag -f $(IMAGE):$(DOCKER_TAG) $(IMAGE):latest
	touch .docker


.PHONY:	clean
clean:
	@docker ps | grep $(IMAGE) | awk '{print $$1}' | xargs -r docker stop
	@docker ps -a | grep $(IMAGE) | awk '{print $$1}' | xargs -r docker rm
	@echo "Docker images to remove:"
	@docker images | head -1 && docker images | grep $(IMAGE) || true
	@image_tags=($$(docker images | grep $(IMAGE) | awk '{print $$2}')) ; \
	for tag in "$${image_tags[@]}"; do \
	   echo "Removing docker image $(IMAGE):$$tag..." ; \
	   docker rmi $(IMAGE):$$tag ; \
	done
	rm -f .docker
ss="c"># Create a unique hash to be used for getting and putting cache, based on: # - The SHA1 hash of the HEAD on the plugin repo's $(ODL_BRANCH) # - The contents of this Makefile .cacheid: git ls-remote --heads $(ODL_REPO) | grep $(ODL_BRANCH) > .cachedata sha1sum Makefile >> .cachedata cat .cachedata | $(CACHETOOL) getid > .cacheid # Clean local data related to caching - called prior to ordinary build .PHONY: clean-cache clean-cache: clean rm -f .cachedata .cacheid # Try to download cache - called prior to ordinary build .PHONY: get-cache get-cache: .cacheid @if $(CACHETOOL) check $(shell cat .cacheid); then \ $(CACHETOOL) get $(shell cat .cacheid) | tar xf -;\ else \ echo "No cache item found for $(shell cat .cacheid)" ;\ exit 0;\ fi # Store cache if not already stored - called after ordinary build .PHONY: put-cache put-cache: .cacheid @tar cf - .odlbuild opendaylight*.rpm gitinfo_odlplugin.txt | $(CACHETOOL) put $(shell cat .cacheid)