Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: go-vela/vela-hugo
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.2.0
Choose a base ref
...
head repository: go-vela/vela-hugo
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Aug 31, 2022

  1. fix(download): make extended version download work (#35)

    * fix(download): make extended version download work
    
    * allow leading v
    wass3r authored Aug 31, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    136523c View commit details

Commits on Sep 21, 2022

  1. refactor(download): change order of operations (#37)

    * refactor(download): change order of operations
    
    * use the variable
    wass3r authored Sep 21, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    094da8b View commit details

Commits on Oct 5, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3d3a66e View commit details

Commits on Oct 10, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    eaf8b60 View commit details

Commits on Oct 27, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b5339a1 View commit details

Commits on Dec 21, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c0da51d View commit details

Commits on Jan 19, 2023

  1. fix(deps): update module github.com/go-vela/types to v0.17.0 (#42)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jan 19, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8b246a7 View commit details

Commits on Jul 24, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    aff8a9d View commit details

Commits on Jul 28, 2023

  1. fix(Dockerfile)!: hugo version 0.115.4, apk add npm, update deps (#59)

    * chore(deps): bump go to v1.20 and bump other deps
    
    * chore(deps): bump deps
    
    * fix(Dockerfile)hugo version 0.115.4, apk add npm
    
    * pin full alpine version
    KellyMerrick authored Jul 28, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    6ae2478 View commit details

Commits on Oct 11, 2023

  1. chore(license): update source code headers + copyright year (#64)

    wass3rw3rk authored Oct 11, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    345531b View commit details

Commits on Dec 8, 2023

  1. chore(deps): update actions/setup-go action to v5 (#67)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 8, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f083d58 View commit details
  2. chore(deps): bump google.golang.org/grpc from 1.50.1 to 1.56.3 (#66)

    dependabot[bot] authored Dec 8, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a1548b8 View commit details
  3. chore(deps): pin dependencies (#60)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 8, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ac6d249 View commit details
  4. chore(deps): update actions/checkout action to v4 (#62)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 8, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a014a40 View commit details

Commits on Dec 13, 2023

  1. chore(linter): fix linter errors, remove deprecated allow leading spa…

    …ces (#70)
    
    * chore(linter): fix linter errors, remove deprecated allow leading spaces
    
    * chore(codeql): remove toolchain in go.mod to pass
    KellyMerrick authored Dec 13, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    71dd673 View commit details

Commits on Apr 2, 2024

  1. chore(deps): update codecov/codecov-action action to v4 (#72)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Apr 2, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    dac7cb8 View commit details
  2. chore(deps): update github/codeql-action action to v3 (#69)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Apr 2, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    07e070f View commit details

Commits on Apr 3, 2024

  1. fix(deps): update module github.com/go-vela/types to v0.23.2 [securit…

    …y] (#75)
    
    * fix(deps): update module github.com/go-vela/types to v0.23.2 [security]
    
    * update to 23.3
    
    ---------
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    Co-authored-by: TimHuynh <tim.huynh@target.com>
    renovate[bot] and TimHuynh authored Apr 3, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    1bc36e7 View commit details
  2. chore(deps): update all non-major dependencies (#68)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Apr 3, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    ba1aa01 View commit details
  3. chore: update deps (#76)

    * update deps
    
    * update protobuf
    
    ---------
    
    Co-authored-by: TimHuynh <tim.huynh@target.com>
    timhuynh94 and TimHuynh authored Apr 3, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d833c91 View commit details

Commits on Apr 15, 2024

  1. chore(deps): update all non-major dependencies (#77)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Apr 15, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    fef5c96 View commit details

Commits on Aug 13, 2024

  1. chore(deps): update all non-major dependencies (#78)

    * chore(deps): update all non-major dependencies
    
    * chore(deps): update all non-major dependencies
    
    * update go getter
    
    * add version
    
    ---------
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    Co-authored-by: TimHuynh <tim.huynh@target.com>
    renovate[bot] and TimHuynh authored Aug 13, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    0825dac View commit details

Commits on Aug 14, 2024

  1. fix(deps): update all non-major dependencies (#83)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Aug 14, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    4df4e23 View commit details

Commits on Sep 4, 2024

  1. chore: checksum validation, dep upgrades, consistent lint rules (#85)

    wass3r authored Sep 4, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    ee69891 View commit details
  2. fix(deps): update all non-major dependencies (#84)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Sep 4, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    2badf7e View commit details
74 changes: 0 additions & 74 deletions .github/CODE_OF_CONDUCT.md

This file was deleted.

4 changes: 2 additions & 2 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ Please see our [support](SUPPORT.md) documentation for further instructions.
## Copyright and License

```
Copyright (c) 2022 Target Brands, Inc.
Copyright 2021 Target Brands, Inc.
```

[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)
[Apache License, Version 2.0](../LICENSE)
3 changes: 2 additions & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"local>go-vela/renovate-config"
"local>go-vela/renovate-config",
"customManagers:dockerfileVersions"
]
}
13 changes: 10 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -10,11 +10,18 @@ on:
jobs:
build:
runs-on: ubuntu-latest
container:
image: golang:1.18

steps:
- name: clone
uses: actions/checkout@v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: install go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
# use version from go.mod file
go-version-file: 'go.mod'
cache: true
check-latest: true

- name: build
run: |
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -35,11 +35,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -50,7 +50,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
@@ -64,4 +64,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6
13 changes: 10 additions & 3 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -11,15 +11,22 @@ on:
jobs:
prerelease:
runs-on: ubuntu-latest
container:
image: golang:1.18

steps:
- name: clone
uses: actions/checkout@v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
# ensures we fetch tag history for the repository
fetch-depth: 0

- name: install go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
# use version from go.mod file
go-version-file: 'go.mod'
cache: true
check-latest: true

- name: setup
run: |
# setup git tag in Actions environment
13 changes: 10 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -10,15 +10,22 @@ on:
jobs:
publish:
runs-on: ubuntu-latest
container:
image: golang:1.18

steps:
- name: clone
uses: actions/checkout@v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
# ensures we fetch tag history for the repository
fetch-depth: 0

- name: install go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
# use version from go.mod file
go-version-file: 'go.mod'
cache: true
check-latest: true

- name: build
env:
GOOS: linux
30 changes: 22 additions & 8 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -9,14 +9,21 @@ on:
jobs:
diff-review:
runs-on: ubuntu-latest
container:
image: golang:1.18

steps:
- name: clone
uses: actions/checkout@v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: install go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
# use version from go.mod file
go-version-file: 'go.mod'
cache: true
check-latest: true

- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2
uses: reviewdog/action-golangci-lint@7708105983c614f7a2725e2172908b7709d1c3e4 # v2.6.2
with:
github_token: ${{ secrets.github_token }}
golangci_lint_flags: "--config=.golangci.yml"
@@ -26,14 +33,21 @@ jobs:

full-review:
runs-on: ubuntu-latest
container:
image: golang:1.18

steps:
- name: clone
uses: actions/checkout@v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: install go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
# use version from go.mod file
go-version-file: 'go.mod'
cache: true
check-latest: true

- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2
uses: reviewdog/action-golangci-lint@7708105983c614f7a2725e2172908b7709d1c3e4 # v2.6.2
with:
github_token: ${{ secrets.github_token }}
golangci_lint_flags: "--config=.golangci.yml"
15 changes: 11 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -10,18 +10,25 @@ on:
jobs:
test:
runs-on: ubuntu-latest
container:
image: golang:1.18

steps:
- name: clone
uses: actions/checkout@v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: install go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
# use version from go.mod file
go-version-file: 'go.mod'
cache: true
check-latest: true

- name: test
run: |
go test -race -covermode=atomic -coverprofile=coverage.out ./...
- name: coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.out
13 changes: 10 additions & 3 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -10,11 +10,18 @@ on:
jobs:
validate:
runs-on: ubuntu-latest
container:
image: golang:1.18

steps:
- name: clone
uses: actions/checkout@v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: install go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
# use version from go.mod file
go-version-file: 'go.mod'
cache: true
check-latest: true

- name: validate
run: |
115 changes: 63 additions & 52 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -8,7 +8,10 @@
# outputs it results from the linters it executes.
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
format: colored-line-number
formats:
- format: json
path: stderr
- format: colored-line-number

# print lines of code with issue, default is true
print-issued-lines: true
@@ -32,23 +35,32 @@ linters-settings:
lines: 160
statements: 70

# https://github.com/daixiang0/gci
# ensure import order is consistent
# gci write --custom-order -s standard -s default -s blank -s dot -s "prefix(github.com/go-vela)" .
gci:
custom-order: true
sections:
- standard
- default
- blank
- dot
- prefix(github.com/go-vela)

# https://github.com/denis-tingaikin/go-header
goheader:
template: |-
Copyright (c) {{ YEAR }} Target Brands, Inc. All rights reserved.
Use of this source code is governed by the LICENSE file in this repository.
SPDX-License-Identifier: Apache-2.0
# https://github.com/client9/misspell
misspell:
locale: US

# https://github.com/golangci/golangci-lint/blob/master/pkg/golinters/nolintlint
nolintlint:
allow-leading-space: true # allow non-"machine-readable" format (ie. with leading space)
allow-unused: false # allow nolint directives that don't address a linting issue
require-explanation: true # require an explanation for nolint directives
require-specific: true # require nolint directives to be specific about which linter is being skipped
allow-unused: false # allow nolint directives that don't address a linting issue
require-explanation: true # require an explanation for nolint directives
require-specific: true # require nolint directives to be specific about which linter is being skipped

# This section provides the configuration for which linters
# golangci will execute. Several of them were disabled by
@@ -59,46 +71,43 @@ linters:

# enable a specific set of linters to run
enable:
- bidichk # checks for dangerous unicode character sequences
- bodyclose # checks whether HTTP response body is closed successfully
- contextcheck # check the function whether use a non-inherited context
- deadcode # finds unused code
- dupl # code clone detection
- errcheck # checks for unchecked errors
- errorlint # find misuses of errors
- exportloopref # check for exported loop vars
- funlen # detects long functions
- goconst # finds repeated strings that could be replaced by a constant
- gocyclo # computes and checks the cyclomatic complexity of functions
- godot # checks if comments end in a period
- gofmt # checks whether code was gofmt-ed
- goheader # checks is file header matches to pattern
- goimports # fixes imports and formats code in same style as gofmt
- gomoddirectives # manage the use of 'replace', 'retract', and 'excludes' directives in go.mod
- goprintffuncname # checks that printf-like functions are named with f at the end
- gosec # inspects code for security problems
- gosimple # linter that specializes in simplifying a code
- govet # reports suspicious constructs, ex. Printf calls whose arguments don't align with the format string
- ineffassign # detects when assignments to existing variables aren't used
- makezero # finds slice declarations with non-zero initial length
- misspell # finds commonly misspelled English words in comments
- nakedret # finds naked returns in functions greater than a specified function length
- nilerr # finds the code that returns nil even if it checks that the error is not nil
- noctx # noctx finds sending http request without context.Context
- nolintlint # reports ill-formed or insufficient nolint directives
- revive # linter for go
- staticcheck # applies static analysis checks, go vet on steroids
- structcheck # finds unused struct fields
- stylecheck # replacement for golint
- tenv # analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
- typecheck # parses and type-checks go code, like the front-end of a go compiler
- unconvert # remove unnecessary type conversions
- unparam # reports unused function parameters
- unused # checks for unused constants, variables, functions and types
- varcheck # finds unused global variables and constants
- whitespace # detects leading and trailing whitespace
- wsl # forces code to use empty lines

- bidichk # checks for dangerous unicode character sequences
- bodyclose # checks whether HTTP response body is closed successfully
- contextcheck # check the function whether use a non-inherited context
- dupl # code clone detection
- errcheck # checks for unchecked errors
- errorlint # find misuses of errors
- exportloopref # check for exported loop vars
- funlen # detects long functions
- gci # consistent import ordering
- goconst # finds repeated strings that could be replaced by a constant
- gocyclo # computes and checks the cyclomatic complexity of functions
- godot # checks if comments end in a period
- gofmt # checks whether code was gofmt-ed
- goheader # checks is file header matches to pattern
- gomoddirectives # manage the use of 'replace', 'retract', and 'excludes' directives in go.mod
- goprintffuncname # checks that printf-like functions are named with f at the end
- gosec # inspects code for security problems
- gosimple # linter that specializes in simplifying a code
- govet # reports suspicious constructs, ex. Printf calls whose arguments don't align with the format string
- ineffassign # detects when assignments to existing variables aren't used
- makezero # finds slice declarations with non-zero initial length
- misspell # finds commonly misspelled English words in comments
- nakedret # finds naked returns in functions greater than a specified function length
- nilerr # finds the code that returns nil even if it checks that the error is not nil
- noctx # noctx finds sending http request without context.Context
- nolintlint # reports ill-formed or insufficient nolint directives
- revive # linter for go
- staticcheck # applies static analysis checks, go vet on steroids
- stylecheck # replacement for golint
- tenv # analyzer that detects using os.Setenv instead of t.Setenv since Go1.17
- typecheck # parses and type-checks go code, like the front-end of a go compiler
- unconvert # remove unnecessary type conversions
- unparam # reports unused function parameters
- unused # checks for unused constants, variables, functions and types
- whitespace # detects leading and trailing whitespace
- wsl # forces code to use empty lines

# static list of linters we know golangci can run but we've
# chosen to leave disabled for now
# - asciicheck - non-critical
@@ -111,21 +120,21 @@ linters:
# - exhaustivestruct - style preference
# - forbidigo - unused
# - forcetypeassert - unused
# - gci - use goimports
# - gochecknoinits - unused
# - gochecknoglobals - global variables allowed
# - gocognit - unused complexity metric
# - gocognit - unused complexity metric
# - gocritic - style preference
# - godox - to be used in the future
# - goerr113 - to be used in the future
# - goimports - use gci
# - golint - archived, replaced with revive
# - gofumpt - use gofmt
# - gomnd - get too many false-positives
# - gomodguard - unused
# - ifshort - use both styles
# - ireturn - allow interfaces to be returned
# - importas - want flexibility with naming
# - lll - not too concerned about line length
# - lll - not too concerned about line length
# - interfacer - archived
# - nestif - non-critical
# - nilnil - style preference
@@ -134,7 +143,7 @@ linters:
# - paralleltest - false-positives
# - prealloc - don't use
# - predeclared - unused
# - promlinter - style preference
# - promlinter - style preference
# - rowserrcheck - unused
# - scopelint - deprecated - replaced with exportloopref
# - sqlclosecheck - unused
@@ -157,3 +166,5 @@ issues:
- funlen
- goconst
- gocyclo
- wsl

26 changes: 15 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,41 @@
# Copyright (c) 2022 Target Brands, Inc. All rights reserved.
#
# Use of this source code is governed by the LICENSE file in this repository.
# SPDX-License-Identifier: Apache-2.0

# set a global Docker argument for the default CLI version
#
# https://github.com/moby/moby/issues/37345
ARG HUGO_VERSION=0.101.0
# renovate: datasource=github-tags depName=gohugoio/hugo extractVersion=^v(?<version>.*)$
ARG HUGO_VERSION=0.134.0

##########################################################################
## docker build --no-cache --target binary -t vela-hugo:binary . ##
##########################################################################

FROM alpine as binary
FROM alpine:3.20.2@sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5 AS binary

ARG HUGO_VERSION

ADD https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz /tmp/hugo.tar.gz
RUN tar -xzf /tmp/hugo.tar.gz -C /bin
ENV HUGO_RELEASE_URL="https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}"
ENV HUGO_FILENAME="hugo_${HUGO_VERSION}_linux-amd64.tar.gz"
ENV HUGO_CHECKSUM_FILENAME="hugo_${HUGO_VERSION}_checksums.txt"

RUN chmod 0700 /bin/hugo
RUN wget -q "${HUGO_RELEASE_URL}/${HUGO_FILENAME}" -O "${HUGO_FILENAME}" && \
wget -q "${HUGO_RELEASE_URL}/${HUGO_CHECKSUM_FILENAME}" -O "${HUGO_CHECKSUM_FILENAME}" && \
grep "${HUGO_FILENAME}" "${HUGO_CHECKSUM_FILENAME}" | sha256sum -c && \
tar -xf "${HUGO_FILENAME}" && \
mv hugo /bin/hugo && \
chmod 0700 /bin/hugo

########################################################
## docker build --no-cache -t vela-hugo:local . ##
########################################################

FROM alpine
FROM alpine:3.20.2@sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5

ARG HUGO_VERSION

ENV PLUGIN_HUGO_VERSION=${HUGO_VERSION}

RUN apk add --update --no-cache ca-certificates git libc6-compat libstdc++ nodejs
RUN apk add --update --no-cache ca-certificates git libc6-compat libstdc++ nodejs npm

COPY --from=binary /bin/hugo /bin/hugo

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright (c) 2022 Target Brands, Inc.
Copyright 2021 Target Brands, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Copyright (c) 2022 Target Brands, Inc. All rights reserved.
#
# Use of this source code is governed by the LICENSE file in this repository.
# SPDX-License-Identifier: Apache-2.0

# capture the current date we build the application from
BUILD_DATE = $(shell date +%Y-%m-%dT%H:%M:%SZ)
4 changes: 1 addition & 3 deletions cmd/vela-hugo/build.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
// SPDX-License-Identifier: Apache-2.0

package main

4 changes: 1 addition & 3 deletions cmd/vela-hugo/command.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
// SPDX-License-Identifier: Apache-2.0

package main

4 changes: 1 addition & 3 deletions cmd/vela-hugo/command_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
// SPDX-License-Identifier: Apache-2.0

package main

4 changes: 1 addition & 3 deletions cmd/vela-hugo/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
// SPDX-License-Identifier: Apache-2.0

package main

4 changes: 1 addition & 3 deletions cmd/vela-hugo/config_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
// SPDX-License-Identifier: Apache-2.0

package main

96 changes: 53 additions & 43 deletions cmd/vela-hugo/hugo.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
// SPDX-License-Identifier: Apache-2.0

package main

@@ -9,6 +7,7 @@ import (
"runtime"
"strings"

"github.com/Masterminds/semver/v3"
"github.com/hashicorp/go-getter"
"github.com/sirupsen/logrus"
"github.com/spf13/afero"
@@ -18,6 +17,7 @@ const (
_hugo = "/bin/hugo"
_hugoTmp = "/bin/download"
_download = "https://github.com/gohugoio/hugo/releases/download/v%s/%s_%s_%s-%s.tar.gz"
_checksum = "https://github.com/gohugoio/hugo/releases/download/v%s/%s_%s_checksums.txt"
)

func install(extendedBinary bool, customVer, defaultVer string) error {
@@ -28,68 +28,78 @@ func install(extendedBinary bool, customVer, defaultVer string) error {

// setup vars for building the _download url
// based off of https://github.com/gohugoio/hugo/releases for the naming convention
var (
binary = "hugo"
osName string
archType string
)

switch runtime.GOOS {
case "darwin":
osName = "macOS"
case "linux":
osName = "Linux"
case "windows":
osName = "Windows"
default:
osName = "unsupported"
binary := "hugo"
osName := runtime.GOOS
archType := runtime.GOARCH

// change the binary file name
// if the extended version for Sass/SCSS support
// has been requested
if extendedBinary {
logrus.Infof("using extended hugo binary")

binary = "hugo_extended"
}

// use default version if no custom version
// was requested
if len(customVer) == 0 {
customVer = defaultVer
}

switch runtime.GOARCH {
case "amd64":
archType = "64bit"
case "arm64":
archType = "arm64"
case "arm":
archType = "arm"
case "386":
archType = "32bit"
default:
archType = "unsupported"
// try to parse the version
// into semantic version struct
ver, err := semver.NewVersion(customVer)
if err != nil {
return fmt.Errorf("not a valid version: %s", customVer)
}

versionMatch := strings.EqualFold(customVer, defaultVer)
// get the version without leading "v",
// if it was supplied
verWithoutV := ver.String()

// check if the custom version requested
// is the default version
isDefaultVersion := strings.EqualFold(verWithoutV, defaultVer)

// check if the custom version matches the default version and/or the extneded binary is requested
if versionMatch && !extendedBinary {
// the hugo versions match and using the base hugo binary so no action is required
// are we using the included default
// (non-extended) version?
// if so, no need to download anything
if isDefaultVersion && !extendedBinary {
return nil
}

if !versionMatch {
logrus.Infof("custom version does not match default: %s", defaultVer)
// let user know that a custom version
// was requested
if !isDefaultVersion {
logrus.Infof("custom version requested (default is: %s): %s", defaultVer, verWithoutV)
}

if extendedBinary {
logrus.Infof("using extended hugo binary")

binary = "hugo_extended"
// special handling for macOS.
// starting with 0.102, hugo supplies
// a "fat" universal binary
//
// see notes here: https://github.com/gohugoio/hugo/releases/tag/v0.102.0
if osName == "darwin" && ver.Minor() > uint64(101) {
archType = "universal"
}

// rename the old hugo binary since we can't overwrite it for now
//
// https://github.com/hashicorp/go-getter/issues/219
err := a.Rename(_hugo, fmt.Sprintf("%s.default", _hugo))
err = a.Rename(_hugo, fmt.Sprintf("%s.default", _hugo))
if err != nil {
return err
}

// create the download URL to install hugo - https://github.com/gohugoio/hugo/releases
url := fmt.Sprintf(_download, customVer, binary, customVer, osName, archType)
url := fmt.Sprintf(_download, verWithoutV, binary, verWithoutV, osName, archType)
checksumURL := fmt.Sprintf(_checksum, verWithoutV, binary, verWithoutV)
fullURL := fmt.Sprintf("%s?checksum=file:%s", url, checksumURL)

logrus.Infof("downloading hugo version from: %s", url)
logrus.Infof("downloading hugo version from: %s", fullURL)
// send the HTTP request to install hugo
err = getter.Get(_hugoTmp, url, []getter.ClientOption{}...)
err = getter.Get(_hugoTmp, fullURL, []getter.ClientOption{}...)
if err != nil {
return err
}
13 changes: 5 additions & 8 deletions cmd/vela-hugo/main.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
// SPDX-License-Identifier: Apache-2.0

package main

import (
"encoding/json"
"fmt"
"os"

"time"

"github.com/go-vela/vela-hugo/version"

"github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"

_ "github.com/joho/godotenv/autoload"

"github.com/go-vela/vela-hugo/version"
)

func main() {
@@ -40,7 +37,7 @@ func main() {
app.Name = "vela-hugo"
app.HelpName = "vela-hugo"
app.Usage = "Vela Hugo plugin for generating a static website"
app.Copyright = "Copyright (c) 2022 Target Brands, Inc. All rights reserved."
app.Copyright = "Copyright 2021 Target Brands, Inc. All rights reserved."
app.Authors = []*cli.Author{
{
Name: "Vela Admins",
@@ -204,7 +201,7 @@ func run(c *cli.Context) error {

logrus.WithFields(logrus.Fields{
"code": "https://github.com/go-vela/vela-hugo",
"docs": "https://go-vela.github.io/docs/plugins/registry/hugo",
"docs": "https://go-vela.github.io/docs/plugins/registry/pipeline/hugo",
"registry": "https://hub.docker.com/r/target/vela-hugo",
}).Info("Vela Hugo Plugin")

4 changes: 1 addition & 3 deletions cmd/vela-hugo/plugin.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
// SPDX-License-Identifier: Apache-2.0

package main

6 changes: 2 additions & 4 deletions cmd/vela-hugo/plugin_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
// SPDX-License-Identifier: Apache-2.0

package main

@@ -42,7 +40,7 @@ func TestPlugin_Command(t *testing.T) {
Directory: "themes",
},
},
// nolint: gosec // ignore for testing
//nolint:gosec // ignore for testing
want: exec.Command(
_hugo,
fmt.Sprintf("--baseURL=%s", "http://hugo.example.com/"),
4 changes: 1 addition & 3 deletions cmd/vela-hugo/theme.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
// SPDX-License-Identifier: Apache-2.0

package main

4 changes: 1 addition & 3 deletions cmd/vela-hugo/theme_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
// SPDX-License-Identifier: Apache-2.0

package main

79 changes: 43 additions & 36 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,49 +1,56 @@
module github.com/go-vela/vela-hugo

go 1.18
go 1.23.0

require (
github.com/Masterminds/semver/v3 v3.1.1
github.com/go-vela/types v0.14.0
github.com/hashicorp/go-getter v1.6.2
github.com/joho/godotenv v1.4.0
github.com/sirupsen/logrus v1.9.0
github.com/spf13/afero v1.9.2
github.com/urfave/cli/v2 v2.11.1
github.com/Masterminds/semver/v3 v3.3.0
github.com/go-vela/types v0.24.0
github.com/hashicorp/go-getter v1.7.6
github.com/joho/godotenv v1.5.1
github.com/sirupsen/logrus v1.9.3
github.com/spf13/afero v1.11.0
github.com/urfave/cli/v2 v2.27.4
)

require (
cloud.google.com/go v0.75.0 // indirect
cloud.google.com/go/storage v1.14.0 // indirect
github.com/aws/aws-sdk-go v1.15.78 // indirect
cloud.google.com/go v0.110.10 // indirect
cloud.google.com/go/compute v1.23.3 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.5 // indirect
cloud.google.com/go/storage v1.35.1 // indirect
github.com/aws/aws-sdk-go v1.44.122 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.4.3 // indirect
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-version v1.1.0 // indirect
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8 // indirect
github.com/jstemmer/go-junit-report v0.9.1 // indirect
github.com/klauspost/compress v1.11.2 // indirect
github.com/mitchellh/go-homedir v1.0.0 // indirect
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/klauspost/compress v1.15.11 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/ulikunitz/xz v0.5.8 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
go.opencensus.io v0.22.5 // indirect
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 // indirect
golang.org/x/mod v0.4.1 // indirect
golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect
golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99 // indirect
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.0 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/api v0.40.0 // indirect
github.com/ulikunitz/xz v0.5.10 // indirect
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.15.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.152.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20210226172003-ab064af71705 // indirect
google.golang.org/grpc v1.35.0 // indirect
google.golang.org/protobuf v1.25.0 // indirect
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
)
576 changes: 504 additions & 72 deletions go.sum

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions version/version.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
// SPDX-License-Identifier: Apache-2.0

package version

import (
"fmt"
"runtime"

"github.com/go-vela/types/version"

"github.com/Masterminds/semver/v3"

"github.com/sirupsen/logrus"

"github.com/go-vela/types/version"
)

var (