blob: 44aaac771b935f37d8466247de790e060956766f [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
Joey Armstrongf3208602023-06-03 15:12:23 -040035last-release := voltha-2.11
36
Joey Armstrong7ee65262023-06-02 09:55:04 -040037## Known releases
38versions += master
39versions += voltha-2.12
40versions += voltha-2.11
41versions += voltha-2.8
42versions += playground
43
44##-------------------##
45##---] TARGETS [---##
46##-------------------##
47all: help
48
49## ---------------------------------------------------------------------------
50## Intent: Create branch driven pipeline test jobs.
51## ---------------------------------------------------------------------------
52## Build these deps to create a new release area
Joey Armstrongf3208602023-06-03 15:12:23 -040053create-jobs-release += create-jobs-release-certification
Joey Armstrong7ee65262023-06-02 09:55:04 -040054create-jobs-release += create-jobs-release-nightly
55create-jobs-release += create-jobs-release-units
56
57create-jobs-release : $(create-jobs-release)
58
59 @echo
60 $(GIT) status
61
62## ---------------------------------------------------------------------------
63## Intent: Create branch driven pipeline test jobs.
64## ---------------------------------------------------------------------------
65units-yaml := $(release-mk-top)/jjb/pipeline/voltha/$(voltha-version)
66units-root := $(subst /$(voltha-version),$(null),$(units-yaml))
67create-jobs-release-units : $(units-yaml)
68$(units-yaml):
69
70 @echo
71 @echo "** Create branch driven pipeline: unit tests"
72 $(HIDE)mkdir -vp $@
73 rsync -r --checksum $(units-root)/master/. $@/.
74 $(HIDE)/bin/ls -l $(units-root)
75
76## ---------------------------------------------------------------------------
77## Intent: Create branch driven nightly test jobs.
78## o Clone config for the last nightly release
79## o In-place edit to the latest version.
80## ---------------------------------------------------------------------------
81## NOTE: WIP - nightly jobs have not yet migrated from the mega job config file
82## ---------------------------------------------------------------------------
Joey Armstrong7ee65262023-06-02 09:55:04 -040083nightly-dir := $(release-mk-top)/jjb/voltha-test/voltha-nightly-jobs
84nightly-yaml := $(nightly-dir)/$(voltha-version).yaml
Joey Armstrongf3208602023-06-03 15:12:23 -040085nightly-tmpl := $(nightly-dir)/$(last-release).yaml
Joey Armstrong7ee65262023-06-02 09:55:04 -040086
87create-jobs-release-nightly : $(nightly-yaml)
88$(nightly-yaml) : $(nightly-tmpl)
89
90 @echo
91 @echo "** Create branch driven pipeline: nightly tests"
Joey Armstrongf3208602023-06-03 15:12:23 -040092 sed -e 's/$(last-release)/$(voltha-version)/g' $< > $@
Joey Armstrong7ee65262023-06-02 09:55:04 -040093 $(HIDE)/bin/ls -l $(dir $@)
94
95## ---------------------------------------------------------------------------
96## Intent: Create branch driven nightly test jobs.
97## ---------------------------------------------------------------------------
98$(nightly-tmpl):
99 @echo "ERROR: Yaml template branch does not exist: $@"
100 @echo 1
101
102## ---------------------------------------------------------------------------
103## Intent: Create branch driven nightly test jobs.
Joey Armstrongf3208602023-06-03 15:12:23 -0400104## o Clone config for the last nightly release
105## o In-place edit to the latest version.
106## ---------------------------------------------------------------------------
107## NOTE: WIP - nightly jobs have not yet migrated from the mega job config file
108## ---------------------------------------------------------------------------
109certification-dir := $(release-mk-top)/jjb/voltha-test/voltha-certification
110certification-yaml := $(certification-dir)/$(voltha-version).yaml
111certification-tmpl := $(certification-dir)/$(last-release).yaml
112
113create-jobs-release-certification : $(certification-yaml)
114$(certification-yaml) : $(certification-tmpl)
115
116 @echo
117 @echo "** Create branch driven pipeline: nightly tests"
118 sed -e 's/$(last-release)/$(voltha-version)/g' $< > $@
119 $(HIDE)/bin/ls -l $(dir $@)
120
121## ---------------------------------------------------------------------------
122## Intent: Create branch driven nightly test jobs.
123## ---------------------------------------------------------------------------
124$(certification-tmpl):
125 @echo "ERROR: Yaml template branch does not exist: $@"
126 @echo 1
127
128
129## ---------------------------------------------------------------------------
130## Intent: Create branch driven nightly test jobs.
Joey Armstrong7ee65262023-06-02 09:55:04 -0400131## ---------------------------------------------------------------------------
132sterile-create-jobs-release :
Joey Armstrongf3208602023-06-03 15:12:23 -0400133 $(RM) $(certification-yaml)
Joey Armstrong7ee65262023-06-02 09:55:04 -0400134 $(RM) $(nightly-yaml)
135 $(RM) -r $(units-yaml)
136
137$(if $(DEBUG),$(warning LEAVE))
138
139# [EOF]