Skip to content

Commit

Permalink
#208. Cleaned up instructions and Makefile. Fixed zarf missing error …
Browse files Browse the repository at this point in the history
…on Mac. Updated prrtrwuidid. Change build-package in Makefile to package
  • Loading branch information
mike-winberry committed Feb 9, 2022
1 parent 17841b0 commit 86bf65b
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 21 deletions.
51 changes: 36 additions & 15 deletions packages/Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,45 @@
PACKAGE_PATH=$(shell cd $(name) && pwd)
SHA_SUM=$(shell sha256sum $(name)/zarf-package-$(name).tar.zst | cut -d " " -f1)
build-package:
# Figure out which Zarf binary we should use based on the operating system we are on
ZARF_BIN := zarf
UNAME_S := $(shell uname -s)
UNAME_P := $(shell uname -p)
ifneq ($(UNAME_S),Linux)
ifeq ($(UNAME_S),Darwin)
ZARF_BIN := $(addsuffix -mac,$(ZARF_BIN))
endif
ifeq ($(UNAME_P),i386)
ZARF_BIN := $(addsuffix -intel,$(ZARF_BIN))
endif
ifeq ($(UNAME_P),arm64)
ZARF_BIN := $(addsuffix -apple,$(ZARF_BIN))
endif
endif

PACKAGE_PATH := $(shell cd $(name) && pwd)

.PHONY: default
default: help

.PHONY: build-package
package:
ifdef name
@cd $(name) && zarf package create --confirm
@echo "\nCreated $(name) add the sha and path to your zarf yaml components: "
@cd $(name) && $(ZARF_BIN) package create --confirm
@echo "\nCreated $(name) add the sha and path to your zarf yaml components: "
@echo " - name: $(name)"
@echo " files:"
@echo " - source: \"$(PACKAGE_PATH)/zarf-package-$(name).tar.zst\""
@echo " shasum: $(SHA_SUM)"
@echo " target: /usr/local/bin/zarf-package-$(name).tar.zst"
@echo " scripts:"
@echo " after:"
@echo " files:"
@echo " - source: \"$(PACKAGE_PATH)/zarf-package-$(name).tar.zst\""
@echo " shasum: `cd $(PACKAGE_PATH) && sha256sum zarf-package-$(name).tar.zst | cut -d " " -f1`"
@echo " target: \"/usr/local/bin/zarf-package-$(name).tar.zst\""
@echo " scripts:"
@echo " after:"
@echo " - \"./zarf package deploy /usr/local/bin/zarf-package-$(name).tar.zst --confirm\""
else
@echo "Please provide a valid package name. ie: make build-package name=flux"
@echo "Please provide a valid package name. ie: make package name=flux"
endif


.PHONY: help
help:
@echo "\nAvailable commands: "
@echo "\n build-package Builds a tar.zst given the name of the component you wish to create."
@echo " example: make build-package name=flux"
@echo "\n package Builds a tar.zst given the name of the component you wish to create."
@echo " example: make build-package name=flux"
@echo "\n help shows this menu."
@echo
12 changes: 6 additions & 6 deletions packages/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Zarf Prebuilt Packages
## Prerequisites
- zarf binary in PATH as zarf or ```alias zarf="$HOME/path/to/zarf/cli```
- sha256sum
- Add zarf binary to path `export PATH=path/to/zarf/binary:$PATH`
- Install `sha256sum` (on Mac it's `brew install coreutils`)

## Usage
executing the command `make build-package name=NAME_OF_PACKAGE` will build the zarf-package.tar.zst in the folder of the required package. It will also output the required yaml to add to your zarf.yaml components section.
executing the command `make package name=NAME_OF_PACKAGE` will build the zarf-package.tar.zst in the folder of the required package. It will also output the required yaml to add to your zarf.yaml components section.
### Building Composable Packages example:
```yaml
☁ packages ⚡ make build-package name=flux
☁ packages ⚡ make package name=flux

Created flux add the sha and path to your zarf yaml components:
- name: flux
files:
- source: "/home/ubuntu/github/zarf/packages/flux/zarf-package-flux.tar.zst"
shasum: a8932720c6fe95e99be74c9dd1a6e8905b5c92b2b4672b3350e45739f3aad8be
target: /usr/local/bin/zarf-package-flux.tar.zst
target: "/usr/local/bin/zarf-package-flux.tar.zst"
scripts:
after:
- "./zarf package deploy /usr/local/bin/zarf-package-flux.tar.zst --confirm"
Expand All @@ -33,7 +33,7 @@ components:
files:
- source: "/home/ubuntu/github/zarf/packages/flux/zarf-package-flux.tar.zst"
shasum: a8932720c6fe95e99be74c9dd1a6e8905b5c92b2b4672b3350e45739f3aad8be
target: /usr/local/bin/zarf-package-flux.tar.zst
target: "/usr/local/bin/zarf-package-flux.tar.zst"
scripts:
after:
- "./zarf package deploy /usr/local/bin/zarf-package-flux.tar.zst --confirm"
Expand Down

0 comments on commit 86bf65b

Please sign in to comment.