Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

Commit

Permalink
Update Makefile for easier package creation and maintenance #409
Browse files Browse the repository at this point in the history
Signed-off-by: Nicholas Seemiller <nseemiller@vmware.com>
  • Loading branch information
seemiller committed Apr 6, 2021
1 parent 15afd2c commit c86c067
Showing 1 changed file with 39 additions and 8 deletions.
47 changes: 39 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,11 @@ GO := GOPRIVATE=${PRIVATE_REPOS} go

##### IMAGE #####
OCI_REGISTRY := projects.registry.vmware.com/tce
repo_tag := stable
##### IMAGE #####

tag := latest

##### LINTING TARGETS #####
.PHONY: fmt vet lint mdlint shellcheck staticcheck check
check: fmt lint mdlint shellcheck staticcheck vet
Expand Down Expand Up @@ -253,16 +256,44 @@ create-addon: ## create the directory structure for a new add-on
# MISC
##### BUILD TARGETS #####

# build and push package template
push-packages:
lock-images: ## Updates the image lock file in each package.
cd addons/packages && for package in *; do\
printf "\n===> $${package}\n";\
imgpkg push --bundle $(OCI_REGISTRY)/$${package}-extension-templates:dev --file $${package}/bundle/;\
printf "\n===> Updating image lockfile for package $${package}\n";\
kbld --file $${package}/bundle --imgpkg-lock-output $${package}/bundle/.imgpkg/images.yml >> /dev/null;\
done

# updates the ImageLock files in each package
update-image-lockfiles:
lock-package-images: ## Updates the image lock file for a package. Usage: make update-package-image-lockfile package=foobar
printf "\n===> Updating image lockfile for package $${package}\n";\
cd addons/packages/$${package} && kbld --file bundle --imgpkg-lock-output bundle/.imgpkg/images.yml >> /dev/null;\

vendir-sync: ## Performs a `vendir sync` for each package
cd addons/packages && for package in *; do\
printf "\n===> $${package}\n";\
kbld --file $${package}/bundle --imgpkg-lock-output $${package}/bundle/.imgpkg/images.yml >> /dev/null;\
printf "\n===> syncing $${package}\n";\
pushd $${package}/bundle;\
vendir sync >> /dev/null;\
popd;\
done

vendir-package-sync: ## Performs a `vendir sync` for a package. Usage: make vendir-package-sync package=foobar
printf "\n===> syncing $${package}\n";\
cd addons/packages/$${package}/bundle && vendir sync >> /dev/null;\

push-package: ## Build and push a package template. Tag will default to `latest`. Usage: make push-package package=foobar tag=baz
printf "\n===> pushing $${package}\n";\
cd addons/packages/$${package} && imgpkg push --bundle $(OCI_REGISTRY)/$${package}:$${tag} --file bundle/;\

push-packages: ## Build and push all package templates. Tag will default to `latest`. Usage: make push-packages tag=baz
cd addons/packages && for package in *; do\
printf "\n===> pushing $${package}\n";\
imgpkg push --bundle $(OCI_REGISTRY)/$${package}:$${tag} --file $${package}/bundle/;\
done

update-package: lock-package-images vendir-package-sync push-package ## Perform all the steps to update a package. Tag will default to `latest`. Usage: make update-package package=foobar tag=baz
printf "\n===> updated $${package}\n";\

update-packages: lock-images vendir-sync push-packages ## Perform all the steps to update all package. Tag will default to `latest`. Usage: make update-packages tag=baz
printf "\n===> updated packages\n";\

update-repo: ## Update the repository metadata. Usage: make update-repo OCI_REGISTRY=repo.example.com/main repo_tag=stable
printf "\n===> updating repository metadata\n";\
impkg push -i $${OCI_REGISTRY}:$${repo-tag} -f addons/repos/main;\

0 comments on commit c86c067

Please sign in to comment.