Joey Armstrong | 7ee6526 | 2023-06-02 09:55:04 -0400 | [diff] [blame^] | 1 | # -*- 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) |
| 27 | release-mk-top := $(abspath $(lastword $(MAKEFILE_LIST))) |
| 28 | release-mk-top := $(subst /makefiles/release/targets.mk,$(null),$(release-mk-top)) |
| 29 | |
| 30 | GIT ?= /usr/bin/env git |
| 31 | |
| 32 | # fatal to make help |
| 33 | voltha-version ?= $(error $(MAKE) voltha-verison=voltha-x.yy is required)\ |
| 34 | |
| 35 | ## Known releases |
| 36 | versions += master |
| 37 | versions += voltha-2.12 |
| 38 | versions += voltha-2.11 |
| 39 | versions += voltha-2.8 |
| 40 | versions += playground |
| 41 | |
| 42 | ##-------------------## |
| 43 | ##---] TARGETS [---## |
| 44 | ##-------------------## |
| 45 | all: help |
| 46 | |
| 47 | ## --------------------------------------------------------------------------- |
| 48 | ## Intent: Create branch driven pipeline test jobs. |
| 49 | ## --------------------------------------------------------------------------- |
| 50 | ## Build these deps to create a new release area |
| 51 | create-jobs-release += create-jobs-release-nightly |
| 52 | create-jobs-release += create-jobs-release-units |
| 53 | |
| 54 | create-jobs-release : $(create-jobs-release) |
| 55 | |
| 56 | @echo |
| 57 | $(GIT) status |
| 58 | |
| 59 | ## --------------------------------------------------------------------------- |
| 60 | ## Intent: Create branch driven pipeline test jobs. |
| 61 | ## --------------------------------------------------------------------------- |
| 62 | units-yaml := $(release-mk-top)/jjb/pipeline/voltha/$(voltha-version) |
| 63 | units-root := $(subst /$(voltha-version),$(null),$(units-yaml)) |
| 64 | create-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 | ## --------------------------------------------------------------------------- |
| 80 | replace-ver := voltha-2.11 |
| 81 | nightly-dir := $(release-mk-top)/jjb/voltha-test/voltha-nightly-jobs |
| 82 | nightly-yaml := $(nightly-dir)/$(voltha-version).yaml |
| 83 | nightly-tmpl := $(nightly-dir)/$(replace-ver).yaml |
| 84 | |
| 85 | create-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 | ## --------------------------------------------------------------------------- |
| 103 | sterile-create-jobs-release : |
| 104 | $(RM) $(nightly-yaml) |
| 105 | $(RM) -r $(units-yaml) |
| 106 | |
| 107 | $(if $(DEBUG),$(warning LEAVE)) |
| 108 | |
| 109 | # [EOF] |