diff --git a/.github/actions/release/action.yaml b/.github/actions/release/action.yaml new file mode 100644 index 0000000..c3f3b23 --- /dev/null +++ b/.github/actions/release/action.yaml @@ -0,0 +1,38 @@ +name: release +description: release executables + +inputs: + tag: + description: check out the tag if not empty + default: '' + token: + description: GitHub token + required: true + +runs: + using: composite + + steps: + - uses: actions/checkout@v3 + name: "checkout tag ${{ inputs.tag }}" + if: "inputs.tag != ''" + with: + ref: refs/tags/${{ inputs.tag }} + env: + GITHUB_TOKEN: ${{ inputs.token }} + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: ~1.16 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: pfnet-research + password: ${{ inputs.token }} + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v3 + with: + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ inputs.token }} diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml deleted file mode 100644 index 2c9d4fb..0000000 --- a/.github/release-drafter.yml +++ /dev/null @@ -1,20 +0,0 @@ -name-template: 'v$NEXT_PATCH_VERSION' -tag-template: 'v$NEXT_PATCH_VERSION' -categories: -- title: 'πŸ’£ Breaking Changes' - label: 'release-note/breaking-change' -- title: 'πŸš€ Features' - label: 'release-note/feature' -- title: 'πŸ› Bug Fixes' - label: 'release-note/bugfix' -- title: 'πŸ“œ Documentation' - label: 'release-note/document' -- title: '🧰 Maintenance' - label: 'release-note/chore' -exclude-labels: -- 'release-note/skip' -template: | - ## What’s Changed from $PREVIOUS_TAG - $CHANGES - - Thanks to $CONTRIBUTORS diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..9d9a77b --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,24 @@ +changelog: + exclude: + labels: + - release-note/skip + - tagpr + categories: + - title: "πŸ’£ Breaking Changes" + labels: + - release-note/breaking-change + - title: "πŸš€ Features" + labels: + - release-note/feature + - title: "πŸ› Bug Fixes" + labels: + - release-note/bugfix + - title: "πŸ“œ Documentation" + labels: + - release-note/document + - title: "🧰 Maintenance" + labels: + - release-note/chore + - title: "πŸ”¬ Other Changes" + labels: + - "*" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f8b1309..7f2751e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,57 +11,57 @@ on: jobs: - test: - name: Test + lint: + name: Lint runs-on: ubuntu-latest steps: + - name: Check out + uses: actions/checkout@v3 - name: Set up Go 1.x - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: - go-version: ^1.16 + go-version: ~1.16 id: go - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - with: - fetch-depth: 0 - name: Get dependencies run: go mod download - name: Get Devtools run: make setup - name: Lint run : make lint + + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Check out + uses: actions/checkout@v3 + - name: Set up Go 1.x + uses: actions/setup-go@v3 + with: + go-version: ~1.16 + id: go + - name: Get dependencies + run: go mod download + - name: Get Devtools + run: make setup - name: Build - run: make + run: make build-only - name: Test run: make test - - name: Validate .goreleaser.yml - uses: goreleaser/goreleaser-action@v2 - with: - version: latest - args: release --snapshot --skip-publish --rm-dist --debug - image_build: - name: Image Build + validate-goreleaser: + name: Validate .goreleaser.yml runs-on: ubuntu-latest - env: - DOCKER_BUILDKIT: 1 - IMAGE_PREFIX: docker.pkg.github.com/${{ github.repository }}/ steps: - - name: Set up Go 1.x - uses: actions/setup-go@v2 - with: - go-version: ^1.16 - id: go - - name: Check out - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Get Devtools - run: make setup - - name: Login GitHub Registry - run: docker login docker.pkg.github.com -u owner -p ${{ secrets.GITHUB_TOKEN }} - - name: Build Docker image - run: make build-image - - name: Push Docker image - if: github.ref == 'refs/heads/master' && github.event_name == 'push' - run: make push-image + - name: Check out + uses: actions/checkout@v3 + - name: Set up Go 1.x + uses: actions/setup-go@v3 + with: + go-version: ~1.16 + id: go + - name: Validate GoReleaser + uses: goreleaser/goreleaser-action@v3 + with: + version: latest + args: release --snapshot --skip-publish --rm-dist --debug diff --git a/.github/workflows/manual_release.yaml b/.github/workflows/manual_release.yaml new file mode 100644 index 0000000..adacef2 --- /dev/null +++ b/.github/workflows/manual_release.yaml @@ -0,0 +1,17 @@ +name: Release By Tagged Manually +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + +jobs: + goreleaser: + name: Release + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + steps: + - name: Check out + uses: actions/checkout@v3 + - uses: ./.github/actions/release + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/publish_dev_image.yaml b/.github/workflows/publish_dev_image.yaml new file mode 100644 index 0000000..d562d4b --- /dev/null +++ b/.github/workflows/publish_dev_image.yaml @@ -0,0 +1,47 @@ +name: Publish Dev Image + +on: + push: + branches: [ master ] + tags-ignore: [ "**" ] + paths-ignore: [ "**.md" ] + +jobs: + publish_dev_image: + name: Publish Dev Image + runs-on: ubuntu-latest + steps: + - name: Check out + uses: actions/checkout@v3 + - name: Set up Go 1.x + uses: actions/setup-go@v3 + with: + go-version: ~1.16 + id: go + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: pfnet-research + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build Snapshots + uses: goreleaser/goreleaser-action@v3 + with: + version: latest + args: release --snapshot --rm-dist --debug + # Mimic docker, docker_manifests artifacts in goreleaser here. + # because "goreleaser release --snapshot" does NOT publish any artifact + - name: Publish Snapshot Images + shell: bash + run: | + set -euo pipefail + IMAGES=($(jq -r '.[] | select(.type=="Docker Image") | .name' dist/artifacts.json)) + for i in ${IMAGES[@]}; do + docker push $i + done + MANIFEST=$(jq '.[] | select(.type=="Docker Image") | .name' dist/artifacts.json | jq -sr '.[0]' | sed -e "s|-[a-z0-9]\+$||g") + docker manifest create ${MANIFEST} ${IMAGES[@]} + docker manifest push ${MANIFEST} + MANIFEST_LATEST=$(jq '.[] | select(.type=="Docker Image") | .name' dist/artifacts.json | jq -sr '.[0]' | sed -e "s|:.*$||g"):latest + docker manifest create ${MANIFEST_LATEST} ${IMAGES[@]} + docker manifest push ${MANIFEST_LATEST} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index 2082906..0000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,72 +0,0 @@ -name: Release -on: - push: - tags: - - "v[0-9]+.[0-9]+.[0-9]+" - -jobs: - image_build: - name: Release Docker Image - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') - env: - RELEASE: "true" - DOCKER_BUILDKIT: 1 - IMAGE_PREFIX: docker.pkg.github.com/${{ github.repository }}/ - steps: - - name: Set up Go 1.x - uses: actions/setup-go@v2 - with: - go-version: ^1.16 - id: go - - name: Check out - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Get Devtools - run: make setup - - name: Login GitHub Registry - run: docker login docker.pkg.github.com -u owner -p ${{ secrets.GITHUB_TOKEN }} - - name: Build Docker image - run: make build-image - - name: Push Docker image - run: make push-image - - goreleaser: - name: Release Binaries - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') - env: - RELEASE: "true" - steps: - - name: Set up Go 1.x - uses: actions/setup-go@v2 - with: - go-version: ^1.16 - id: go - - name: Check out - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Get Devtools - run: make setup - - name: Get dependencies - run: go mod download - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 - with: - version: latest - args: release --rm-dist - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - update_release_draft: - name: Draft Release Note - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') - env: - RELEASE: "true" - steps: - - uses: release-drafter/release-drafter@v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/tagpr.yaml b/.github/workflows/tagpr.yaml new file mode 100644 index 0000000..e5fb31f --- /dev/null +++ b/.github/workflows/tagpr.yaml @@ -0,0 +1,32 @@ +# +# tagpr workflow +# +name: tagpr +on: + push: + branches: ["master"] + +jobs: + tagpr: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - id: tagpr + name: Tagpr + uses: Songmu/tagpr@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # If tagpr pushed tags, invoke release custom action manually. + # It is because: + # > When you use the repository's GITHUB_TOKEN to perform tasks, + # > events triggered by the GITHUB_TOKEN, with the exception of + # > workflow_dispatch and repository_dispatch, will not create + # > a new workflow run. + # ref: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow + - name: "Release (only when tagged)" + uses: ./.github/actions/release + if: "steps.tagpr.outputs.tag != ''" + with: + tag: ${{ steps.tagpr.outputs.tag }} + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 0e14cc1..787d614 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -22,7 +22,47 @@ builds: - netgo ldflags: - -s -w -X github.com/pfnet-research/pftaskqueue/cmd.Version={{.Version}} -X github.com/pfnet-research/pftaskqueue/cmd.Revision={{.ShortCommit}} -extldflags "-static" -# changelog will be generated by release drafter -# see .github/release-drafter.yml + +dockers: +- image_templates: ["ghcr.io/pfnet-research/{{ .ProjectName }}/{{ if .IsSnapshot }}dev:{{ incpatch .Version }}-alpha-{{ .ShortCommit }}{{else}}release:{{ .Version }}{{end}}-amd64"] + dockerfile: Dockerfile + goarch: amd64 + use: buildx + build_flag_templates: + - --platform=linux/amd64 + - --label=org.opencontainers.image.title={{ .ProjectName }} + - --label=org.opencontainers.image.description={{ .ProjectName }} + - --label=org.opencontainers.image.url=https://github.com/pfnet-research/{{ .ProjectName }} + - --label=org.opencontainers.image.source=https://github.com/pfnet-research/{{ .ProjectName }} + - --label=org.opencontainers.image.version={{ .Version }} + - --label=org.opencontainers.image.revision={{ .ShortCommit }} + - --label=org.opencontainers.image.licenses=Apache-2.0 +- image_templates: ["ghcr.io/pfnet-research/{{ .ProjectName }}/{{ if .IsSnapshot }}dev:{{ incpatch .Version }}-alpha-{{ .ShortCommit }}{{else}}release:{{ .Version }}{{end}}-arm64v8"] + dockerfile: Dockerfile + goarch: arm64 + use: buildx + build_flag_templates: + - --platform=linux/arm64/v8 + - --label=org.opencontainers.image.title={{ .ProjectName }} + - --label=org.opencontainers.image.description={{ .ProjectName }} + - --label=org.opencontainers.image.url=https://github.com/pfnet-research/{{ .ProjectName }} + - --label=org.opencontainers.image.source=https://github.com/pfnet-research/{{ .ProjectName }} + - --label=org.opencontainers.image.version={{ .Version }} + - --label=org.opencontainers.image.revision={{ .ShortCommit }} + - --label=org.opencontainers.image.licenses=Apache-2.0 + +docker_manifests: +- name_template: ghcr.io/pfnet-research/{{ .ProjectName }}/{{ if .IsSnapshot }}dev:{{ incpatch .Version }}-alpha-{{ .ShortCommit }}{{else}}release:{{ .Version }}{{end}} + image_templates: + - ghcr.io/pfnet-research/{{ .ProjectName }}/{{ if .IsSnapshot }}dev:{{ incpatch .Version }}-alpha-{{ .ShortCommit }}{{else}}release:{{ .Version }}{{end}}-amd64 + - ghcr.io/pfnet-research/{{ .ProjectName }}/{{ if .IsSnapshot }}dev:{{ incpatch .Version }}-alpha-{{ .ShortCommit }}{{else}}release:{{ .Version }}{{end}}-arm64v8 +- name_template: ghcr.io/pfnet-research/{{ .ProjectName }}/{{ if .IsSnapshot }}dev{{else}}release{{end}}:latest + image_templates: + - ghcr.io/pfnet-research/{{ .ProjectName }}/{{ if .IsSnapshot }}dev:{{ incpatch .Version }}-alpha-{{ .ShortCommit }}{{else}}release:{{ .Version }}{{end}}-amd64 + - ghcr.io/pfnet-research/{{ .ProjectName }}/{{ if .IsSnapshot }}dev:{{ incpatch .Version }}-alpha-{{ .ShortCommit }}{{else}}release:{{ .Version }}{{end}}-arm64v8 + +snapshot: + name_template: '{{ incpatch .Version }}-alpha-{{ .ShortCommit }}' + changelog: skip: true diff --git a/.tagpr b/.tagpr new file mode 100644 index 0000000..065e8a3 --- /dev/null +++ b/.tagpr @@ -0,0 +1,36 @@ +# config file for the tagpr in git config format +# The tagpr generates the initial configuration, which you can rewrite to suit your environment. +# CONFIGURATIONS: +# tagpr.releaseBranch +# Generally, it is "main." It is the branch for releases. The pcpr tracks this branch, +# creates or updates a pull request as a release candidate, or tags when they are merged. +# +# tagpr.versionFile +# Versioning file containing the semantic version needed to be updated at release. +# It will be synchronized with the "git tag". +# Often this is a meta-information file such as gemspec, setup.cfg, package.json, etc. +# Sometimes the source code file, such as version.go or Bar.pm, is used. +# If you do not want to use versioning files but only git tags, specify the "-" string here. +# You can specify multiple version files by comma separated strings. +# +# tagpr.vPrefix +# Flag whether or not v-prefix is added to semver when git tagging. (e.g. v1.2.3 if true) +# This is only a tagging convention, not how it is described in the version file. +# +# tagpr.changelog (Optional) +# Flag whether or not changelog is added or changed during the release. +# +# tagpr.command (Optional) +# Command to change files just before release. +# +# tagpr.tmplate (Optional) +# Pull request template in go template format +# +# tagpr.release (Optional) +# GitHub Release creation behavior after tagging [true, draft, false] +# If this value is not set, the release is to be created. +[tagpr] + vPrefix = true + releaseBranch = master + versionFile = - + changelog = false diff --git a/Dockerfile b/Dockerfile index df45f0a..81fa7b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,4 @@ -FROM golang:1.16 as builder -ARG RELEASE -ARG VERSION -WORKDIR /workspace -COPY go.mod go.mod -COPY go.sum go.sum -RUN go mod download - -COPY . /workspace -RUN make build-only - -FROM ubuntu:18.04 as runtime -RUN apt-get update && apt-get install -y ca-certificates && apt-get clean && rm -rf /var/lib/apt/lists/* +FROM gcr.io/distroless/base-debian11 WORKDIR / -COPY --from=builder /workspace/dist/pftaskqueue /usr/local/bin/pftaskqueue +COPY pftaskqueue /usr/local/bin/pftaskqueue ENTRYPOINT ["/usr/local/bin/pftaskqueue"] diff --git a/Makefile b/Makefile index 601b6e8..094c97b 100644 --- a/Makefile +++ b/Makefile @@ -4,12 +4,9 @@ export CGO_ENABLED=0 # project metadta NAME := pftaskqueue -VERSION ?= $(if $(RELEASE),$(shell git semv now),$(shell git semv patch -p)) REVISION := $(shell git rev-parse --short HEAD) IMAGE_PREFIX ?= pftaskqueue/ -IMAGE_NAME := $(if $(RELEASE),release,dev) -IMAGE_TAG ?= $(if $(RELEASE),$(VERSION),$(VERSION)-$(REVISION)) -LDFLAGS := -ldflags="-s -w -X \"github.com/pfnet-research/pftaskqueue/cmd.Version=$(VERSION)\" -X \"github.com/pfnet-research/pftaskqueue/cmd.Revision=$(REVISION)\" -extldflags \"-static\"" +LDFLAGS := -ldflags="-s -w -X github.com/pfnet-research/pftaskqueue/cmd.Version=dev -X github.com/pfnet-research/pftaskqueue/cmd.Revision=$(REVISION) -extldflags \"-static\"" OUTDIR ?= ./dist .DEFAULT_GOAL := build @@ -17,69 +14,38 @@ OUTDIR ?= ./dist .PHONY: setup setup: npm install --prefix=.dev markdown-toc && \ - npm install --prefix=.dev github-release-notes && \ cd $(shell go env GOPATH) && \ go get -u golang.org/x/tools/cmd/goimports && \ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.27.0 && \ - go get -u github.com/elastic/go-licenser && \ - go get -u github.com/tcnksm/ghr && \ - go get -u github.com/linyows/git-semv/cmd/git-semv + go get -u github.com/elastic/go-licenser + .PHONY: fmt -fmt: +fmt: build-readme-toc $(shell go env GOPATH)/bin/goimports -w cmd/ pkg/ $(shell go env GOPATH)/bin/go-licenser --licensor "Preferred Networks, Inc." .PHONY: lint lint: fmt $(shell go env GOPATH)/bin/golangci-lint run --config .golangci.yml --deadline 30m + git diff --exit-code README.md .PHONY: build-readme-toc build-readme-toc: .dev/node_modules/markdown-toc/cli.js -i README.md .PHONY: build -build: fmt lint build-readme-toc +build: fmt lint go build -tags netgo -installsuffix netgo $(LDFLAGS) -o $(OUTDIR)/$(NAME) . .PHONY: build-only -build-only: +build-only: go build -tags netgo -installsuffix netgo $(LDFLAGS) -o $(OUTDIR)/$(NAME) . .PHONY: test -test: fmt lint +test: go test ./... .PHONY: clean clean: rm -rf "$(OUTDIR)" - -.PHONY: build-image -build-image: - docker build -t $(shell make -e docker-tag) --build-arg RELEASE=$(RELEASE) --build-arg VERSION=$(VERSION) --target runtime . - docker tag $(shell make -e docker-tag) $(IMAGE_PREFIX)$(IMAGE_NAME):$(VERSION) # without revision - docker tag $(shell make -e docker-tag) $(IMAGE_PREFIX)$(IMAGE_NAME):latest # latest - -.PHONY: push-image -push-image: - docker push $(shell make -e docker-tag) - docker push $(IMAGE_PREFIX)$(IMAGE_NAME):$(VERSION) # without revision - docker push $(IMAGE_PREFIX)$(IMAGE_NAME):latest # latest - -.PHONY: docker-tag -docker-tag: - @echo $(IMAGE_PREFIX)$(IMAGE_NAME):$(IMAGE_TAG) - -# -# Release -# -guard-%: - @ if [ "${${*}}" = "" ]; then \ - echo "Environment variable $* is not set"; \ - exit 1; \ - fi -.PHONY: release -release: guard-RELEASE guard-RELEASE_TAG - git diff --quiet HEAD || (echo "your current branch is dirty" && exit 1) - git tag $(RELEASE_TAG) $(REVISION) - git push origin $(RELEASE_TAG) diff --git a/README.md b/README.md index 5b4915e..afc5a6d 100644 --- a/README.md +++ b/README.md @@ -94,10 +94,10 @@ Just download a tar ball for your platform from [releases](./../../releases) pag `pftaskqueue` publishes two kind of docker iamges in [GitHub Packages](https://github.com/pfnet-research/pftaskqueue/packages) -- `docker.pkg.github.com/pfnet-research/pftaskqueue/dev:latest`: built on the latest master branch - - `docker.pkg.github.com/pfnet-research/pftaskqueue/dev:vx.y.z-alppha.n` is also available for old dev images -- `docker.pkg.github.com/pfnet-research/pftaskqueue/release:latest`: the latest release image - - `docker.pkg.github.com/pfnet-research/pftaskqueue/release:vx.y.z` is also available for previous/specific release images +- `ghcr.io/pfnet-research/pftaskqueue/dev:latest`: built on the latest master branch + - `ghcr.io/pfnet-research/pftaskqueue/dev:vx.y.z-alpha-{{revision}}` is also available for old dev images +- `ghcr.io/pfnet-research/pftaskqueue/release:latest`: the latest release image + - `ghcr.io/pfnet-research/pftaskqueue/release:vx.y.z` is also available for previous/specific release images To pull those images, you would need `docker login docker.pkg.github.com` first. Please see [Configuring Docker for use with GitHub Packages](https://help.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages) if you are not familiar wit it. @@ -825,12 +825,7 @@ make test ### How to make release -`release` target tags a commit and push the tag to `origin`. Release process will run in GitHub Action. - -```bash -$ RELEASE_TAG=$(git semv patch) # next patch version. bump major/minor version if necessary -$ make release RELEASE=true RELEASE_TAG=${RELEASE_TAG} -``` +The release process is fully automated by [tagpr](https://github.com/Songmu/tagpr). To release, just merge [the latest release PR](https://github.com/pfnet-research/pftaskqueue/pulls?q=is:pr+is:open+label:tagpr). ## License diff --git a/cmd/print_config.go b/cmd/print_config.go index 27d6cb5..e71ea1b 100644 --- a/cmd/print_config.go +++ b/cmd/print_config.go @@ -22,7 +22,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/pkg/worker/worker.go b/pkg/worker/worker.go index cbac54c..c2594fc 100644 --- a/pkg/worker/worker.go +++ b/pkg/worker/worker.go @@ -402,21 +402,21 @@ func (w *Worker) workspacePath(t *task.Task) string { return filepath.Join(w.thisWorkerWorkDir(), t.Status.CurrentRecord.ProcessUID) } -// {task workspace path}/ -// input/ -// # taskspec info -// payload # also exported as PFTQ_TASK_HANDLER_INPUT_PAYLOAD -// retryLimit # also exported as PFTQ_TASK_HANDLER_INPUT_RETRY_LIMIT -// timeoutSeconds # also exported as PFTQ_TASK_HANDLER_INPUT_TIMEOUT_SECONDS -// meta/ -// taskUID # also exported as PFTQ_TASK_HANDLER_INPUT_TASK_UID -// task.json # also exported as PFTQ_TASK_HANDLER_INPUT_TASK_JSON -// processUID # also exported as PFTQ_TASK_HANDLER_INPUT_PROCESS_UID -// # worker info -// workerName # also exported as PFTQ_TASK_HANDLER_INPUT_WORKER_NAME -// workerUID # also exported as PFTQ_TASK_HANDLER_INPUT_WORKER_UID -// workerConfig.json # also exported as PFTQ_TASK_HANDLER_INPUT_WORKER_CONFIG_JSON -// output/ +// {task workspace path}/ +// input/ +// # taskspec info +// payload # also exported as PFTQ_TASK_HANDLER_INPUT_PAYLOAD +// retryLimit # also exported as PFTQ_TASK_HANDLER_INPUT_RETRY_LIMIT +// timeoutSeconds # also exported as PFTQ_TASK_HANDLER_INPUT_TIMEOUT_SECONDS +// meta/ +// taskUID # also exported as PFTQ_TASK_HANDLER_INPUT_TASK_UID +// task.json # also exported as PFTQ_TASK_HANDLER_INPUT_TASK_JSON +// processUID # also exported as PFTQ_TASK_HANDLER_INPUT_PROCESS_UID +// # worker info +// workerName # also exported as PFTQ_TASK_HANDLER_INPUT_WORKER_NAME +// workerUID # also exported as PFTQ_TASK_HANDLER_INPUT_WORKER_UID +// workerConfig.json # also exported as PFTQ_TASK_HANDLER_INPUT_WORKER_CONFIG_JSON +// output/ func (w *Worker) prepareTaskHandlerDirAndEnvvars(t *task.Task) (string, []string, error) { inputOutputDirPermission := os.FileMode(0750) inputFilePermission := os.FileMode(0440) @@ -501,11 +501,12 @@ func (w *Worker) prepareTaskHandlerDirAndEnvvars(t *task.Task) (string, []string return workspacePath, envvars, nil } -// {task workspace path}/ -// output/ -// message -// payload -// postHooks.json +// {task workspace path}/ +// +// output/ +// message +// payload +// postHooks.json func (w *Worker) fetchResultContents(logger zerolog.Logger, t *task.Task) (*string, *string, []task.TaskSpec, error) { workspaceDir := w.workspacePath(t) postHooksPath := filepath.Join(workspaceDir, "output", "postHooks.json")