GithubHelp home page GithubHelp logo

pombredanne / gcp-pkgbuild Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kolide/gcp-pkgbuild

0.0 1.0 0.0 6 KB

Build macOS packages with GCP Container Builder

License: MIT License

Makefile 13.31% Dockerfile 15.81% Shell 9.35% Go 61.52%

gcp-pkgbuild's Introduction

Build macOS packages using Google Container Builder.

Example

# create package root
mkdir -p build-dir/root

# put stuff in package root
mkdir -p build-dir/root/Users/Shared/foo
touch build-dir/root/Users/Shared/foo/bar

# submit cloudbuild job to create package
# the package will be uploaded to the 'gs://mac-packages' bucket. Make sure to replace with a bucket name you have write permissions to.
make package PACKAGE_NAME=foo-1.2.3.pkg PACKAGE_VERSION=1.2.3 PACKAGE_IDENTIFIER=co.acme.foo

How it works

A macOS flat package is a xar archive with a specific structure(see References). This repo takes advantage of several linux utilities to build a GCP Container Builder pipeline which creates a new macOS package. All the build steps assume that the package root is located inside build-dir/root/ and if there are package scripts, they're in build-dir/scripts/.

The provided Makefile package target abstracts the gcloud container builds submit step, which can be seen in full below:

gcloud container builds submit ./build-dir/ \
	--config ./cloudbuild.yml \
	--substitutions=_PACKAGE_NAME=foo-1.2.3.pkg,_PACKAGE_IDENTIFIER=co.acme.foo,_PACKAGE_VERSION=1.2.3

The full pipeline can be seen in the cloudbuild.yml file at the root of the repo. The steps are ordered using the id and waitFor directives in each build step.

Builders

The package pipeline is composed of several build steps, each of which is made up of a containerized linux utility. Every builder has an assocated Dockerfile, cloudbuild.yml and make $builder target.

builders
├── bomutils
│   ├── Dockerfile
│   ├── cloudbuild.yml
│   └── create_bom.sh
├── build-info
│   ├── Dockerfile
│   └── cloudbuild.yml
├── cpio
│   ├── Dockerfile
│   ├── cloudbuild.yml
│   ├── create_payload.sh
│   └── create_scripts.sh
└── xar
    ├── Dockerfile
    ├── cloudbuild.yml
    └── create_xar.sh

build-info

The build-info utility is a Go script which takes a few CLI arguments and traverses the root and scripts folders to build a PackageInfo file required by the package archive. The build-info utility is the least complete of all the steps, but could be updated to fit more complex requirements. Create an issue or pull request.

TODO

  • Support all the PackageInfo directives.
  • Build distribution style packages. Right now only simple flat packages are supported.
  • Sign packages using Google KMS secrets.
  • Add utility for bumping the package version number.
  • Automat Munki import with build pipeline.

References

gcp-pkgbuild's People

Contributors

groob avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.