Skip to content

Commit

Permalink
Merge pull request #122 from dokku/master
Browse files Browse the repository at this point in the history
Release 0.17.0
  • Loading branch information
josegonzalez authored Feb 9, 2024
2 parents db5f3bb + 0642f05 commit 951a02a
Show file tree
Hide file tree
Showing 38 changed files with 1,546 additions and 559 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ on:
jobs:
build:
name: build
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: true
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: make version
run: |
make version .env.docker
Expand All @@ -31,7 +31,7 @@ jobs:
- run: make build-in-docker
- run: make validate-in-docker
- name: upload packages
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: build
path: build/**/*
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
22 changes: 11 additions & 11 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ on:
jobs:
hadolint:
name: hadolint
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Run hadolint
uses: hadolint/hadolint-action@54c9adbab1582c2ef04b2016b760714a4bfde3cf
# v1.5.0 => c27bd9edc1e95eed30474db8f295ff5807ebca14

markdown-lint:
name: markdown-lint
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Run markdown-lint
uses: avto-dev/markdown-lint@04d43ee9191307b50935a753da3b775ab695eceb
# v1.5.0 => 04d43ee9191307b50935a753da3b775ab695eceb
Expand All @@ -36,23 +36,23 @@ jobs:

shellcheck:
name: shellcheck
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Run shellcheck
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38
# 1.1.0 => 94e0aab03ca135d11a35e5bfc14e6746dc56e7e9
env:
SHELLCHECK_OPTS: -s bash
shfmt:
name: shfmt
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Run shfmt
uses: luizm/action-sh-checker@76ab0b22e1f194e4a582edc7969df6485c4e9246
uses: luizm/action-sh-checker@c6edb3de93e904488b413636d96c6a56e3ad671a
# v0.3.0 => 7f44869033b40ee4ffe7dc76c87a1bc66e3d025a
env:
GITHUB_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
Expand All @@ -63,10 +63,10 @@ jobs:

yamllint:
name: yamllint
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Run yamllint
uses: ibiqlik/action-yamllint@2576378a8e339169678f9939646ee3ee325e845c
# v3.0.2 => c19bd0523a9011c3a3960fe6640a0882b59af15d
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20.7-bullseye
FROM golang:1.22.0-bookworm

# hadolint ignore=DL3027
RUN apt-get update \
Expand Down
45 changes: 2 additions & 43 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ MAINTAINER_NAME = Jose Diaz-Gonzalez
REPOSITORY = procfile-util
HARDWARE = $(shell uname -m)
SYSTEM_NAME = $(shell uname -s | tr '[:upper:]' '[:lower:]')
BASE_VERSION ?= 0.16.0
BASE_VERSION ?= 0.17.0
IMAGE_NAME ?= $(MAINTAINER)/$(REPOSITORY)
PACKAGECLOUD_REPOSITORY ?= dokku/dokku-betafish

Expand Down Expand Up @@ -47,10 +47,8 @@ build: prebuild
@$(MAKE) build/darwin/$(NAME)-arm64
@$(MAKE) build/linux/$(NAME)-amd64
@$(MAKE) build/linux/$(NAME)-arm64
@$(MAKE) build/linux/$(NAME)-armhf
@$(MAKE) build/deb/$(NAME)_$(VERSION)_amd64.deb
@$(MAKE) build/deb/$(NAME)_$(VERSION)_arm64.deb
@$(MAKE) build/deb/$(NAME)_$(VERSION)_armhf.deb

build-docker-image:
docker build --rm -q -f Dockerfile -t $(IMAGE_NAME):build .
Expand Down Expand Up @@ -89,12 +87,6 @@ build/linux/$(NAME)-arm64:
-ldflags "-s -w -X main.Version=$(VERSION)" \
-o build/linux/$(NAME)-arm64

build/linux/$(NAME)-armhf:
mkdir -p build/linux
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -a -asmflags=-trimpath=/src -gcflags=-trimpath=/src \
-ldflags "-s -w -X main.Version=$(VERSION)" \
-o build/linux/$(NAME)-armhf

build/deb/$(NAME)_$(VERSION)_amd64.deb: build/linux/$(NAME)-amd64
export SOURCE_DATE_EPOCH=$(shell git log -1 --format=%ct) \
&& mkdir -p build/deb \
Expand Down Expand Up @@ -135,26 +127,6 @@ build/deb/$(NAME)_$(VERSION)_arm64.deb: build/linux/$(NAME)-arm64
build/linux/$(NAME)-arm64=/usr/bin/$(NAME) \
LICENSE=/usr/share/doc/$(NAME)/copyright

build/deb/$(NAME)_$(VERSION)_armhf.deb: build/linux/$(NAME)-armhf
export SOURCE_DATE_EPOCH=$(shell git log -1 --format=%ct) \
&& mkdir -p build/deb \
&& fpm \
--architecture armhf \
--category utils \
--description "$$PACKAGE_DESCRIPTION" \
--input-type dir \
--license 'MIT License' \
--maintainer "$(MAINTAINER_NAME) <$(EMAIL)>" \
--name $(NAME) \
--output-type deb \
--package build/deb/$(NAME)_$(VERSION)_armhf.deb \
--url "https://github.com/$(MAINTAINER)/$(REPOSITORY)" \
--vendor "" \
--version $(VERSION) \
--verbose \
build/linux/$(NAME)-armhf=/usr/bin/$(NAME) \
LICENSE=/usr/share/doc/$(NAME)/copyright

clean:
rm -rf build release validation

Expand All @@ -180,52 +152,39 @@ release: build bin/gh-release bin/gh-release-body
rm -rf release && mkdir release
tar -zcf release/$(NAME)_$(VERSION)_linux_amd64.tgz -C build/linux $(NAME)-amd64
tar -zcf release/$(NAME)_$(VERSION)_linux_arm64.tgz -C build/linux $(NAME)-arm64
tar -zcf release/$(NAME)_$(VERSION)_linux_armhf.tgz -C build/linux $(NAME)-armhf
tar -zcf release/$(NAME)_$(VERSION)_darwin_amd64.tgz -C build/darwin $(NAME)-amd64
tar -zcf release/$(NAME)_$(VERSION)_darwin_arm64.tgz -C build/darwin $(NAME)-arm64
cp build/deb/$(NAME)_$(VERSION)_amd64.deb release/$(NAME)_$(VERSION)_amd64.deb
cp build/deb/$(NAME)_$(VERSION)_arm64.deb release/$(NAME)_$(VERSION)_arm64.deb
cp build/deb/$(NAME)_$(VERSION)_armhf.deb release/$(NAME)_$(VERSION)_armhf.deb
bin/gh-release create $(MAINTAINER)/$(REPOSITORY) $(VERSION) $(shell git rev-parse --abbrev-ref HEAD)
bin/gh-release-body $(MAINTAINER)/$(REPOSITORY) v$(VERSION)

release-packagecloud:
@$(MAKE) release-packagecloud-deb

release-packagecloud-deb: build/deb/$(NAME)_$(VERSION)_amd64.deb build/deb/$(NAME)_$(VERSION)_arm64.deb build/deb/$(NAME)_$(VERSION)_armhf.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/ubuntu/bionic build/deb/$(NAME)_$(VERSION)_amd64.deb
release-packagecloud-deb: build/deb/$(NAME)_$(VERSION)_amd64.deb build/deb/$(NAME)_$(VERSION)_arm64.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/ubuntu/focal build/deb/$(NAME)_$(VERSION)_amd64.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/ubuntu/jammy build/deb/$(NAME)_$(VERSION)_amd64.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/debian/buster build/deb/$(NAME)_$(VERSION)_amd64.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/debian/bullseye build/deb/$(NAME)_$(VERSION)_amd64.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/debian/bookworm build/deb/$(NAME)_$(VERSION)_amd64.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/ubuntu/focal build/deb/$(NAME)_$(VERSION)_arm64.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/ubuntu/jammy build/deb/$(NAME)_$(VERSION)_arm64.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/debian/bullseye build/deb/$(NAME)_$(VERSION)_arm64.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/debian/bookworm build/deb/$(NAME)_$(VERSION)_arm64.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/ubuntu/focal build/deb/$(NAME)_$(VERSION)_armhf.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/ubuntu/jammy build/deb/$(NAME)_$(VERSION)_armhf.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/raspbian/buster build/deb/$(NAME)_$(VERSION)_armhf.deb
package_cloud push $(PACKAGECLOUD_REPOSITORY)/raspbian/bullseye build/deb/$(NAME)_$(VERSION)_armhf.deb

validate:
mkdir -p validation
lintian build/deb/$(NAME)_$(VERSION)_amd64.deb || true
lintian build/deb/$(NAME)_$(VERSION)_arm64.deb || true
lintian build/deb/$(NAME)_$(VERSION)_armhf.deb || true
dpkg-deb --info build/deb/$(NAME)_$(VERSION)_amd64.deb
dpkg-deb --info build/deb/$(NAME)_$(VERSION)_arm64.deb
dpkg-deb --info build/deb/$(NAME)_$(VERSION)_armhf.deb
dpkg -c build/deb/$(NAME)_$(VERSION)_amd64.deb
dpkg -c build/deb/$(NAME)_$(VERSION)_arm64.deb
dpkg -c build/deb/$(NAME)_$(VERSION)_armhf.deb
cd validation && ar -x ../build/deb/$(NAME)_$(VERSION)_amd64.deb
cd validation && ar -x ../build/deb/$(NAME)_$(VERSION)_arm64.deb
cd validation && ar -x ../build/deb/$(NAME)_$(VERSION)_armhf.deb
ls -lah build/deb validation
sha1sum build/deb/$(NAME)_$(VERSION)_amd64.deb
sha1sum build/deb/$(NAME)_$(VERSION)_arm64.deb
sha1sum build/deb/$(NAME)_$(VERSION)_armhf.deb
bats test.bats

prebuild:
Expand Down
4 changes: 2 additions & 2 deletions PROCFILE_FORMAT.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ A Procfile is a file that was [promoted by Heroku](https://blog.heroku.com/the_n

The `procfile-util` tool expects a Procfile to be defined as one or more lines containing one of:

- a comment (preceeded by a `#` symbol)
- a comment (preceeded by a `#` symbol or two `//` characters)
- a process-type/command combination (with optional trailing whitespace or trailing comment)
- when there is a trailing comment, the `#` symbol _must_ be preceeded by one or more `whitespace` characters.
- when there is a trailing comment, the `#` symbol/`//` characters _must_ be preceeded by one or more `whitespace` characters.
- a blank line (with optional trailing whitespace)

Comments and blank lines are ignored, while process-type/command combinations look like the following:
Expand Down
100 changes: 100 additions & 0 deletions commands/check.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package commands

import (
"fmt"
"os"
"strings"

"github.com/josegonzalez/cli-skeleton/command"
"github.com/posener/complete"
flag "github.com/spf13/pflag"
)

type CheckCommand struct {
command.Meta
GlobalFlagCommand
}

func (c *CheckCommand) Name() string {
return "check"
}

func (c *CheckCommand) Synopsis() string {
return "Eats one or more lollipops"
}

func (c *CheckCommand) Help() string {
return command.CommandHelp(c)
}

func (c *CheckCommand) Examples() map[string]string {
appName := os.Getenv("CLI_APP_NAME")
return map[string]string{
"Check if the procfile is valid": fmt.Sprintf("%s %s", appName, c.Name()),
}
}

func (c *CheckCommand) Arguments() []command.Argument {
args := []command.Argument{}
return args
}

func (c *CheckCommand) AutocompleteArgs() complete.Predictor {
return complete.PredictNothing
}

func (c *CheckCommand) ParsedArguments(args []string) (map[string]command.Argument, error) {
return command.ParseArguments(args, c.Arguments())
}

func (c *CheckCommand) FlagSet() *flag.FlagSet {
f := c.Meta.FlagSet(c.Name(), command.FlagSetClient)
c.GlobalFlags(f)
return f
}

func (c *CheckCommand) AutocompleteFlags() complete.Flags {
return command.MergeAutocompleteFlags(
c.Meta.AutocompleteFlags(command.FlagSetClient),
c.AutocompleteGlobalFlags(),
complete.Flags{},
)
}

func (c *CheckCommand) Run(args []string) int {
flags := c.FlagSet()
flags.Usage = func() { c.Ui.Output(c.Help()) }
if err := flags.Parse(args); err != nil {
c.Ui.Error(err.Error())
c.Ui.Error(command.CommandErrorText(c))
return 1
}

_, err := c.ParsedArguments(flags.Args())
if err != nil {
c.Ui.Error(err.Error())
c.Ui.Error(command.CommandErrorText(c))
return 1
}

entries, err := parseProcfile(c.procfile, c.delimiter, c.strict)
if err != nil {
c.Ui.Error(err.Error())
return 1
}

if len(entries) == 0 {
c.Ui.Error("No processes defined")
return 1
}

names := []string{}
for _, entry := range entries {
names = append(names, entry.Name)
}

processNames := strings.Join(names[:], ", ")
c.Ui.Output(fmt.Sprintf("valid procfile detected %v", processNames))

return 0
}
26 changes: 0 additions & 26 deletions commands/check_command.go

This file was deleted.

Loading

0 comments on commit 951a02a

Please sign in to comment.