blob: a98405110849e907b3ea28049d594a0c8503a7b5 [file] [log] [blame]
Joey Armstrong7ee65262023-06-02 09:55:04 -04001# -*- makefile -*-
2# -----------------------------------------------------------------------
3# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16# -----------------------------------------------------------------------
17# Intent: Helper makefile target used to setup for a release
18# -----------------------------------------------------------------------
19
20$(if $(DEBUG),$(warning ENTER))
21
22##-------------------##
23##---] GLOBALS [---##
24##-------------------##
25
26# TODO: Library function $(call mk-path,makefiles/release/targets.mk)
27release-mk-top := $(abspath $(lastword $(MAKEFILE_LIST)))
28release-mk-top := $(subst /makefiles/release/targets.mk,$(null),$(release-mk-top))
29
30GIT ?= /usr/bin/env git
31
32# fatal to make help
33voltha-version ?= $(error $(MAKE) voltha-verison=voltha-x.yy is required)\
34
35## Known releases
36versions += master
37versions += voltha-2.12
38versions += voltha-2.11
39versions += voltha-2.8
40versions += playground
41
42##-------------------##
43##---] TARGETS [---##
44##-------------------##
45all: help
46
47## ---------------------------------------------------------------------------
48## Intent: Create branch driven pipeline test jobs.
49## ---------------------------------------------------------------------------
50## Build these deps to create a new release area
51create-jobs-release += create-jobs-release-nightly
52create-jobs-release += create-jobs-release-units
53
54create-jobs-release : $(create-jobs-release)
55
56 @echo
57 $(GIT) status
58
59## ---------------------------------------------------------------------------
60## Intent: Create branch driven pipeline test jobs.
61## ---------------------------------------------------------------------------
62units-yaml := $(release-mk-top)/jjb/pipeline/voltha/$(voltha-version)
63units-root := $(subst /$(voltha-version),$(null),$(units-yaml))
64create-jobs-release-units : $(units-yaml)
65$(units-yaml):
66
67 @echo
68 @echo "** Create branch driven pipeline: unit tests"
69 $(HIDE)mkdir -vp $@
70 rsync -r --checksum $(units-root)/master/. $@/.
71 $(HIDE)/bin/ls -l $(units-root)
72
73## ---------------------------------------------------------------------------
74## Intent: Create branch driven nightly test jobs.
75## o Clone config for the last nightly release
76## o In-place edit to the latest version.
77## ---------------------------------------------------------------------------
78## NOTE: WIP - nightly jobs have not yet migrated from the mega job config file
79## ---------------------------------------------------------------------------
80replace-ver := voltha-2.11
81nightly-dir := $(release-mk-top)/jjb/voltha-test/voltha-nightly-jobs
82nightly-yaml := $(nightly-dir)/$(voltha-version).yaml
83nightly-tmpl := $(nightly-dir)/$(replace-ver).yaml
84
85create-jobs-release-nightly : $(nightly-yaml)
86$(nightly-yaml) : $(nightly-tmpl)
87
88 @echo
89 @echo "** Create branch driven pipeline: nightly tests"
90 sed -e 's/$(replace-ver)/$(voltha-version)/g' $< > $@
91 $(HIDE)/bin/ls -l $(dir $@)
92
93## ---------------------------------------------------------------------------
94## Intent: Create branch driven nightly test jobs.
95## ---------------------------------------------------------------------------
96$(nightly-tmpl):
97 @echo "ERROR: Yaml template branch does not exist: $@"
98 @echo 1
99
100## ---------------------------------------------------------------------------
101## Intent: Create branch driven nightly test jobs.
102## ---------------------------------------------------------------------------
103sterile-create-jobs-release :
104 $(RM) $(nightly-yaml)
105 $(RM) -r $(units-yaml)
106
107$(if $(DEBUG),$(warning LEAVE))
108
109# [EOF]