├── .appveyor.yml ├── .buildkite └── pipeline.yml ├── .checkov.yaml ├── .circleci └── config.yml ├── .cirrus.yml ├── .drone.yml ├── .editorconfig ├── .envrc ├── .envrc-python ├── .github ├── CODEOWNERS └── workflows │ ├── alpine.yaml │ ├── alpine_3.yaml │ ├── centos.yaml.disabled │ ├── centos7.yaml.disabled │ ├── centos8.yaml.disabled │ ├── checkov.yaml │ ├── codeowners.yaml │ ├── debian.yaml │ ├── debian_10.yaml │ ├── debian_11.yaml │ ├── debian_12.yaml │ ├── debian_8.yaml.disabled │ ├── debian_9.yaml.disabled │ ├── fedora.yaml │ ├── fork-sync.yaml │ ├── fork-update-pr.yaml │ ├── golang.yaml │ ├── golang_1.10.yaml │ ├── golang_1.11.yaml │ ├── golang_1.12.yaml │ ├── golang_1.13.yaml │ ├── golang_1.14.yaml │ ├── golang_1.15.yaml │ ├── golang_1.16.yaml │ ├── golang_1.17.yaml │ ├── golang_1.18.yaml │ ├── golang_1.2.yaml │ ├── golang_1.3.yaml │ ├── golang_1.4.yaml │ ├── golang_1.5.yaml │ ├── golang_1.6.yaml │ ├── golang_1.7.yaml │ ├── golang_1.8.yaml │ ├── golang_1.9.yaml │ ├── grype.yaml │ ├── json.yaml │ ├── kics.yaml │ ├── mac.yaml │ ├── mac_11.yaml │ ├── mac_12.yaml │ ├── markdown.yaml │ ├── semgrep-cloud.yaml │ ├── semgrep.yaml │ ├── shellcheck.yaml │ ├── trivy.yaml │ ├── ubuntu.yaml │ ├── ubuntu_14.04.yaml.disabled │ ├── ubuntu_16.04.yaml.disabled │ ├── ubuntu_18.04.yaml.disabled │ ├── ubuntu_20.04.yaml │ ├── ubuntu_22.04.yaml │ ├── ubuntu_github.yaml │ ├── validate.yaml │ ├── xml.yaml │ └── yaml.yaml ├── .gitignore ├── .gitlab-ci.yml ├── .gitmodules ├── .mdl.rb ├── .mdlrc ├── .pre-commit-config.yaml ├── .semaphore └── semaphore.yml ├── .travis.yml ├── Jenkinsfile ├── LICENSE ├── Makefile ├── README.md ├── azure-pipelines.yml ├── bitbucket-pipelines.yml ├── boot ├── buddy.yml ├── cicd ├── .concourse.yml ├── .gocd.yml ├── buildspec.yml └── cloudbuild.yaml ├── codefresh.yml ├── colors.go ├── compile.sh ├── diffnet.go ├── go.mod ├── go.sum ├── httpfirst.go ├── kics.config ├── pldd.go ├── setup ├── bootstrap.sh ├── ci_bootstrap.sh ├── ci_git_set_dir_safe.sh ├── gocd_config_repo.json └── jenkins-job.xml ├── teamcity ├── .teamcity.vcs.json ├── .teamcity.vcs.oauth.json └── .teamcity.vcs.ssh.json ├── tests ├── all.sh ├── data │ └── uniq.txt ├── excluded.sh ├── test_colors.sh ├── test_uniq2.sh ├── test_welcome.sh └── utils.sh ├── timestamp_epoch_to_human.go ├── uniq2.go └── welcome.go /.appveyor.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: 2020-02-24 16:19:35 +0000 (Mon, 24 Feb 2020) 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | # ============================================================================ # 17 | # A p p V e y o r C I 18 | # ============================================================================ # 19 | 20 | # https://www.appveyor.com/docs/appveyor-yml/ 21 | 22 | image: Ubuntu 23 | 24 | # workaround for default JDK9 have old CA certs: 25 | # 26 | # https://github.com/appveyor/ci/issues/3833 27 | # 28 | # https://www.appveyor.com/docs/getting-started-with-appveyor-for-linux/#configuring-language-stack 29 | # 30 | stack: jdk 15 31 | 32 | skip_commits: 33 | files: 34 | - docs/* 35 | - '**/*.md' 36 | 37 | # https://www.appveyor.com/docs/how-to/ssh-to-build-worker/ 38 | environment: 39 | APPVEYOR_SSH_KEY: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvihSRU+YjBKvKiacDfUoZ7ghoVMcwNh4cWIYUNFGZosXOzNtyOcBpIb71TCgLFhOd+aMWKXCEC67BpNSIjt+a/FLD27AwmgVHv6cPlE3G0JJ9zmIrNmx9511dshTsxUW2O0SbYG+3InuO7FUkSrld+kA1OucyjgmZU7/+Cs9shpAEOaIVYmGlpDGRucAHpwtckvdgRTtnA3WNZ/Qg1vU6Ik4Xm03vjrW6lSiuTffYO1kbdcMQ4IZBlzfmovOtXQ0PomvN5NMCpgOyQuoNlvyS11tOXoqNiWOkiLE15XEzAQth9hHbNiH8jHJbAtkHqWWh0KK4IUyNGvoL6QfNxsTlw== hari@anotherdimension 40 | 41 | # enable SSH session accessible via my public key 42 | #init: 43 | # - sh: curl -sflL 'https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-ssh.sh' | bash -e - 44 | 45 | # more useful at end to leverage .appveyor.yml tweaks like disabling broken mssql repo/dependencies, checking out project and building the core stuff happen first so we don't have to do all that manually in SSH session 46 | on_finish: 47 | # set this in Settings -> Environment dynamically instead of here 48 | #- sh: export APPVEYOR_SSH_BLOCK=true 49 | # 50 | # workaround for https://github.com/appveyor/ci/issues/3373 51 | # and https://github.com/appveyor/ci/issues/3384 52 | # 53 | # has since been added to AppVeyor's own scripts: 54 | # 55 | # https://github.com/appveyor/ci/pull/3385 56 | # 57 | #- sh: curl -sflL 'https://raw.githubusercontent.com/HariSekhon/DevOps-Golang-tools/master/install/install_openssh.sh' | bash -e - 58 | # 59 | # https://www.appveyor.com/docs/how-to/ssh-to-build-worker/ 60 | - sh: if [ "$APPVEYOR_SSH_BLOCK" = true ]; then curl -sflL 'https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-ssh.sh' | bash -e -; fi 61 | 62 | install: 63 | # workaround for: 64 | # Some packages could not be installed. This may mean that you have 65 | # requested an impossible situation or if you are using the unstable 66 | # distribution that some required packages have not yet been created 67 | # or been moved out of Incoming. 68 | # The following information may help to resolve the situation: 69 | # 70 | # The following packages have unmet dependencies: 71 | # mssql-server : Depends: libsasl2-modules-gssapi-mit but it is not going to be installed 72 | # E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages. 73 | # DevOps-Golang-tools/Makefile.in:272: recipe for target 'apt-packages' failed 74 | # make[2]: *** [apt-packages] Error 123 75 | # make[2]: Leaving directory '/home/appveyor/projects/pylib' 76 | # DevOps-Golang-tools/Makefile.in:212: recipe for target 'system-packages' failed 77 | # 78 | # adding "|| :" to the end of these commands causes them to be silently ignored! 79 | - sudo sed -i '/https:\/\/packages.microsoft.com\/ubuntu\/.*\/mssql-server/d' /etc/apt/sources.list 80 | - sudo apt purge -yq --allow-change-held-packages mssql-server 81 | # this prevents conflicts installing default-jdk - see https://github.com/appveyor/ci/issues/3411 82 | #- dpkg -l | awk '/openjdk/{print $2}' | DEBIAN_FRONTEND=noninteractive xargs sudo apt-get remove -y --allow-change-held-packages 83 | - setup/ci_bootstrap.sh 84 | - make 85 | 86 | test_script: 87 | - make test 88 | 89 | build: off 90 | -------------------------------------------------------------------------------- /.buildkite/pipeline.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: 2020-03-13 21:10:39 +0000 (Fri, 13 Mar 2020) 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | # ============================================================================ # 17 | # B u i l d K i t e C I 18 | # ============================================================================ # 19 | 20 | # BuildKite Pipeline 21 | # 22 | # add this command to the UI and it will read the rest of the steps from here: 23 | # 24 | # - command: buildkite-agent pipeline upload 25 | 26 | # Yaml Anchors workaround to BuildKite's lack of global retries configuration - credit to Jason @ BuildKite for this workaround: 27 | # 28 | # https://forum.buildkite.community/t/reschedule-builds-on-other-agents-rather-than-fail-builds-when-agents-time-out-or-are-killed-machine-shut-down-or-put-to-sleep/1388/5 29 | # 30 | anchors: 31 | std_retries: &std_retries 32 | retry: 33 | automatic: 34 | - exit_status: -1 # Agent was lost 35 | limit: 2 36 | - exit_status: 255 # Forced agent shutdown 37 | limit: 2 38 | 39 | steps: 40 | - command: setup/ci_bootstrap.sh 41 | label: ci bootstrap 42 | timeout: 30 # brew can take 10 mins just to do a brew update 43 | branches: master 44 | <<: [*std_retries] 45 | - wait 46 | - command: make init 47 | label: init 48 | timeout: 2 49 | branches: master 50 | <<: [*std_retries] 51 | - wait 52 | - command: make ci 53 | label: build 54 | timeout: 60 55 | branches: master 56 | <<: [*std_retries] 57 | - wait 58 | - command: make test 59 | label: test 60 | timeout: 120 61 | branches: master 62 | <<: [*std_retries] 63 | -------------------------------------------------------------------------------- /.checkov.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: 2022-02-21 16:53:29 +0000 (Mon, 21 Feb 2022) 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | # ============================================================================ # 17 | # C h e c k o v c o n f i g 18 | # ============================================================================ # 19 | 20 | # https://github.com/bridgecrewio/checkov#configuration-using-a-config-file 21 | # 22 | # This is not well documented but the fields seem to be the same as: 23 | # 24 | # checkov --help 25 | # 26 | # See master template at: 27 | # 28 | # https://github.com/HariSekhon/Templates/blob/master/.checkov.yaml 29 | 30 | --- 31 | compact: true 32 | directory: 33 | - . 34 | skip-path: 35 | - bash-tools 36 | - sql 37 | - templates 38 | #docker-image: harisekhon/go-tools 39 | download-external-modules: true # without this gets lots of annoying warning lines such as '2022-02-22 16:14:40,180 [MainThread ] [WARNI] Failed to download module x/y/z:n.n.n' 40 | framework: 41 | - all 42 | no-guide: true 43 | output: cli 44 | quiet: true 45 | repo-id: HariSekhon/DevOps-Golang-tools # what to report to Bridgecrew Cloud - without this gets annoying duplicate repos such as 'harisekhon_cli_repo/go-tools' 46 | skip-suppressions: true 47 | soft-fail: true 48 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: 2020-02-23 23:30:14 +0000 (Sun, 23 Feb 2020) 4 | # Original: H1 2016 (Circle CI 1.x) 5 | # 6 | # vim:ts=2:sts=2:sw=2:et 7 | # 8 | # https://github.com/HariSekhon/DevOps-Golang-tools 9 | # 10 | # License: see accompanying Hari Sekhon LICENSE file 11 | # 12 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 13 | # 14 | # https://www.linkedin.com/in/HariSekhon 15 | # 16 | 17 | # ============================================================================ # 18 | # C i r c l e C I 19 | # ============================================================================ # 20 | 21 | # Master Template with more advanced config: 22 | # 23 | # https://github.com/HariSekhon/Templates/blob/master/circleci_config.yml 24 | 25 | # Reference: 26 | # 27 | # https://circleci.com/docs/2.0/configuration-reference 28 | 29 | version: 2.1 30 | 31 | workflows: 32 | version: 2 33 | workflow: 34 | jobs: 35 | - build 36 | 37 | jobs: 38 | build: 39 | docker: 40 | - image: cimg/base:2024.12 41 | resource_class: small 42 | steps: 43 | # CLI is too old - config validate breaks in test - install new version to fix 44 | # doesn't work - existing version is too old to update 45 | #- run: circleci update 46 | - run: | 47 | curl -sSLf https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/main/install.sh | sudo bash 48 | - checkout 49 | #- setup_remote_docker: 50 | # version: 20.10.11 51 | - run: setup/ci_bootstrap.sh 52 | - run: make init 53 | - run: make 54 | - run: make test 55 | -------------------------------------------------------------------------------- /.cirrus.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: 2020-02-24 16:55:36 +0000 (Mon, 24 Feb 2020) 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | # ============================================================================ # 17 | # C i r r u s C I 18 | # ============================================================================ # 19 | 20 | # https://cirrus-ci.org/guide/writing-tasks/ 21 | 22 | container: 23 | image: ubuntu:18.04 24 | 25 | task: 26 | env: 27 | TMPDIR: /var/tmp 28 | script: 29 | - setup/ci_bootstrap.sh 30 | - make init 31 | - make ci test 32 | -------------------------------------------------------------------------------- /.drone.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # XXX: putting this separator further down with code causes a parsing bug in drone lint 3 | # 4 | # Author: Hari Sekhon 5 | # Date: 2020-02-29 12:05:52 +0000 (Sat, 29 Feb 2020) 6 | # 7 | # vim:ts=2:sts=2:sw=2:et 8 | # 9 | # https://github.com/HariSekhon/DevOps-Golang-tools 10 | # 11 | # License: see accompanying Hari Sekhon LICENSE file 12 | # 13 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 14 | # 15 | # https://www.linkedin.com/in/HariSekhon 16 | # 17 | 18 | # ============================================================================ # 19 | # D r o n e C I 20 | # ============================================================================ # 21 | 22 | # https://docs.drone.io/quickstart/cli/ 23 | # 24 | # https://docs.drone.io/cli/install/ 25 | # 26 | # brew install drone-cli 27 | # 28 | # cd to this directory 29 | # 30 | # drone exec [--pipeline default] [--include=thisstep] [--exclude=thatstep] 31 | 32 | kind: pipeline 33 | type: docker 34 | name: default 35 | 36 | steps: 37 | - name: build 38 | image: ubuntu:18.04 39 | #environment: 40 | # DEBUG: 1 41 | commands: 42 | - setup/ci_bootstrap.sh 43 | - make init 44 | - make ci 45 | - make test 46 | 47 | trigger: 48 | branch: 49 | - master 50 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # vim:ts=4:sts=4:sw=4:et 2 | # 3 | # Author: Hari Sekhon 4 | # Date: 2015-10-31 19:04:34 +0000 (Sat, 31 Oct 2015) 5 | # 6 | # https://github.com/HariSekhon/DevOps-Golang-tools 7 | # 8 | # License: see accompanying Hari Sekhon LICENSE file 9 | # 10 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 11 | # to help improve or steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | # http://EditorConfig.org 17 | 18 | # stop recursing upwards for other .editorconfig files 19 | root = true 20 | 21 | # Unix-style newlines with a newline ending every file 22 | [*] 23 | indent_size = 4 24 | indent_style = space 25 | end_of_line = lf 26 | trim_trailing_whitespace = true 27 | insert_final_newline = true 28 | 29 | [*.go] 30 | indent_size = 4 31 | indent_style = tab 32 | end_of_line = lf 33 | trim_trailing_whitespace = true 34 | insert_final_newline = true 35 | 36 | [Makefile] 37 | indent_size = 4 38 | indent_style = tab 39 | end_of_line = lf 40 | trim_trailing_whitespace = true 41 | insert_final_newline = true 42 | 43 | [{*.md,*.hcl,*.tf,*.tfvars}] 44 | indent_size = 2 45 | indent_style = space 46 | end_of_line = lf 47 | trim_trailing_whitespace = true 48 | insert_final_newline = true 49 | 50 | [*.yml,*.yaml] 51 | indent_size = 2 52 | indent_style = space 53 | end_of_line = lf 54 | trim_trailing_whitespace = true 55 | insert_final_newline = true 56 | 57 | [.*] 58 | indent_size = 4 59 | indent_style = space 60 | end_of_line = lf 61 | trim_trailing_whitespace = true 62 | insert_final_newline = true 63 | 64 | # ============================================================================ # 65 | # Older Stuff, don't think I use this any more 66 | # ============================================================================ # 67 | 68 | # Matches multiple files with brace expansion notation 69 | # Set default charset 70 | #[*.{js,py}] 71 | #charset = utf-8 72 | 73 | # Indentation override for all JS under lib directory 74 | #[lib/**.js] 75 | #indent_style = space 76 | #indent_size = 2 77 | 78 | # Matches the exact files either package.json or .travis.yml 79 | #[{package.json,.travis.yml}] 80 | #indent_style = space 81 | #indent_size = 2 82 | 83 | #[*.xml] 84 | #indent_style = space 85 | #indent_size = 2 86 | -------------------------------------------------------------------------------- /.envrc-python: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # vim:ts=4:sts=4:sw=4:et 3 | # 4 | # Author: Hari Sekhon 5 | # Date: Mon Feb 22 17:42:01 2021 +0000 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | # ============================================================================ # 17 | # P y t h o n D i r E n v 18 | # ============================================================================ # 19 | 20 | # .envrc to auto-load the virtualenv inside the 'venv' directory if present 21 | 22 | # https://direnv.net/man/direnv-stdlib.1.html 23 | 24 | set -euo pipefail 25 | [ -n "${DEBUG:-}" ] && set -x 26 | #srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 27 | 28 | # this is necessary because newer versions of pip no longer allow you to install PyPI packages in system-packages by default 29 | for venv in "$PWD/venv" "$HOME/venv"; do 30 | if [ -f "$venv/bin/activate" ]; then 31 | echo 32 | echo "Virtualenv directory found in: $venv" 33 | echo 34 | echo "Activating Virtualenv inside the directory: $venv" 35 | 36 | # shellcheck disable=SC1091 37 | source "$venv/bin/activate" 38 | break 39 | fi 40 | done 41 | 42 | # read .env too 43 | #dotenv 44 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: 2021-11-09 15:14:59 +0000 (Tue, 09 Nov 2021) 4 | # 5 | # vim:ts=4:sts=4:sw=4:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | # https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners 17 | 18 | # Good in theory, to alert on PR changes to these code paths, but for public repos which may be forked and run .github/workflows/fork-update.yaml, this will result in a lot of spam 19 | 20 | # Tips: 21 | # 22 | # * includes changes under .github/ 23 | # dir/* only matches first level file changes but doesn't recurse 24 | # dir/ recurses 25 | # 26 | # - CODEOWNERS in base branch of PR determines review request 27 | # - paths are case sensitive 28 | # - last match wins, use * at top for overall owner then override with more specific teams 29 | 30 | #* @harisekhon # username or email address 31 | #* @myorg/platform-engineering # team based is the way to go - team must have Write access to the repo regardless of if individuals have access 32 | #* @myorg/devops 33 | #k8s @myorg/devops @myorg/sre-team 34 | #apps/ @myorg/developers 35 | #apps/dir2 # ignores dir2 as no owner/team specified on this line 36 | #src/ @myorg/developers 37 | #docs/ docs@example.com 38 | #.github/workflows @ci-cd-team 39 | -------------------------------------------------------------------------------- /.github/workflows/alpine.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: Alpine 16 | 17 | on: # yamllint disable-line rule:truthy 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/alpine.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | container: alpine:latest 84 | caches: apk pip cpanm 85 | debug: ${{ github.event.inputs.debug }} 86 | -------------------------------------------------------------------------------- /.github/workflows/alpine_3.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: Alpine 3 16 | 17 | on: # yamllint disable-line rule:truthy 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/alpine_3.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | container: alpine:3 84 | caches: apk pip cpanm 85 | debug: ${{ github.event.inputs.debug }} 86 | -------------------------------------------------------------------------------- /.github/workflows/centos.yaml.disabled: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: CentOS 16 | 17 | on: 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/centos.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | container: centos:latest 84 | caches: yum pip cpanm 85 | debug: ${{ github.event.inputs.debug }} 86 | -------------------------------------------------------------------------------- /.github/workflows/centos7.yaml.disabled: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: CentOS 7 16 | 17 | on: 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/centos7.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | container: centos:7 84 | caches: yum pip cpanm 85 | debug: ${{ github.event.inputs.debug }} 86 | -------------------------------------------------------------------------------- /.github/workflows/centos8.yaml.disabled: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: CentOS 8 16 | 17 | on: 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/centos8.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | container: centos:8 84 | caches: yum pip cpanm 85 | debug: ${{ github.event.inputs.debug }} 86 | -------------------------------------------------------------------------------- /.github/workflows/checkov.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | # ============================================================================ # 15 | # C h e c k o v G i t H u b W o r k f l o w 16 | # ============================================================================ # 17 | 18 | # Static analysis of Terraform code - publishes report to GitHub Security tab 19 | 20 | # https://github.com/bridgecrewio/checkov-action 21 | 22 | --- 23 | name: Checkov 24 | 25 | on: # yamllint disable-line rule:truthy 26 | push: 27 | branches: 28 | - master 29 | - main 30 | paths-ignore: 31 | - '**/*.md' 32 | pull_request: 33 | branches: 34 | - master 35 | - main 36 | paths-ignore: 37 | - '**/*.md' 38 | workflow_dispatch: 39 | inputs: 40 | debug: 41 | type: boolean 42 | required: false 43 | default: false 44 | schedule: 45 | - cron: '0 0 * * 1' 46 | 47 | permissions: 48 | actions: read 49 | contents: read 50 | security-events: write 51 | 52 | jobs: 53 | checkov: 54 | # github.event.repository context not available in scheduled workflows 55 | #if: github.event.repository.fork == false 56 | if: github.repository_owner == 'HariSekhon' 57 | name: Checkov 58 | uses: HariSekhon/GitHub-Actions/.github/workflows/checkov.yaml@master 59 | with: 60 | debug: ${{ github.event.inputs.debug }} 61 | -------------------------------------------------------------------------------- /.github/workflows/codeowners.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | # ============================================================================ # 15 | # C o d e O w n e r s 16 | # ============================================================================ # 17 | 18 | --- 19 | name: CodeOwners 20 | 21 | on: # yamllint disable-line rule:truthy 22 | push: 23 | branches: 24 | - master 25 | - main 26 | paths: 27 | - CODEOWNERS 28 | - .github/CODEOWNERS 29 | pull_request: 30 | branches: 31 | - master 32 | - main 33 | paths: 34 | - CODEOWNERS 35 | - .github/CODEOWNERS 36 | workflow_dispatch: 37 | inputs: 38 | debug: 39 | type: boolean 40 | required: false 41 | default: false 42 | schedule: 43 | - cron: '0 0 * * 1' 44 | 45 | permissions: 46 | contents: read 47 | 48 | concurrency: 49 | group: ${{ github.workflow }}-${{ github.ref }} 50 | cancel-in-progress: true 51 | 52 | jobs: 53 | validate: 54 | # github.event.repository context not available in scheduled workflows 55 | #if: github.event.repository.fork == false 56 | if: github.repository_owner == 'HariSekhon' 57 | name: Validate CODEOWNERS 58 | uses: HariSekhon/GitHub-Actions/.github/workflows/codeowners.yaml@master 59 | with: 60 | debug: ${{ github.event.inputs.debug }} 61 | -------------------------------------------------------------------------------- /.github/workflows/debian.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: Debian 16 | 17 | on: # yamllint disable-line rule:truthy 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/debian.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | container: debian:latest 84 | caches: apt pip cpanm 85 | debug: ${{ github.event.inputs.debug }} 86 | -------------------------------------------------------------------------------- /.github/workflows/debian_10.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: Debian 10 16 | 17 | on: # yamllint disable-line rule:truthy 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/debian_10.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | container: debian:10 84 | caches: apt pip cpanm 85 | debug: ${{ github.event.inputs.debug }} 86 | -------------------------------------------------------------------------------- /.github/workflows/debian_11.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: Debian 11 16 | 17 | on: # yamllint disable-line rule:truthy 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/debian_11.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | container: debian:11 84 | caches: apt pip cpanm 85 | debug: ${{ github.event.inputs.debug }} 86 | -------------------------------------------------------------------------------- /.github/workflows/debian_12.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: Debian 12 16 | 17 | on: # yamllint disable-line rule:truthy 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/debian_12.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | container: debian:12 84 | caches: apt pip cpanm 85 | debug: ${{ github.event.inputs.debug }} 86 | -------------------------------------------------------------------------------- /.github/workflows/debian_8.yaml.disabled: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: Debian 8 16 | 17 | on: 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/debian_8.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | container: debian:8 84 | caches: apt pip cpanm 85 | debug: ${{ github.event.inputs.debug }} 86 | -------------------------------------------------------------------------------- /.github/workflows/debian_9.yaml.disabled: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: Debian 9 16 | 17 | on: 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/debian_9.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | container: debian:9 84 | caches: apt pip cpanm 85 | debug: ${{ github.event.inputs.debug }} 86 | -------------------------------------------------------------------------------- /.github/workflows/fedora.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: Fedora 16 | 17 | on: # yamllint disable-line rule:truthy 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/fedora.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | container: fedora 84 | caches: yum pip cpanm 85 | debug: ${{ github.event.inputs.debug }} 86 | -------------------------------------------------------------------------------- /.github/workflows/fork-sync.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | # ============================================================================ # 15 | # F o r k S y n c 16 | # ============================================================================ # 17 | 18 | # For a fork of the original repo, activate to keep it up to date via straight GitHub sync to the default branch 19 | 20 | --- 21 | name: Fork Sync 22 | 23 | on: # yamllint disable-line rule:truthy 24 | workflow_dispatch: 25 | inputs: 26 | debug: 27 | type: boolean 28 | required: false 29 | default: false 30 | schedule: 31 | - cron: '0 */3 * * *' 32 | 33 | permissions: 34 | contents: write 35 | 36 | concurrency: 37 | group: ${{ github.workflow }}-${{ github.ref }} 38 | cancel-in-progress: false 39 | 40 | jobs: 41 | fork_sync: 42 | # github.event.repository context not available in scheduled workflows 43 | #if: github.event.repository.fork == true 44 | if: github.repository_owner != 'HariSekhon' 45 | name: Fork Sync 46 | uses: HariSekhon/GitHub-Actions/.github/workflows/fork-sync.yaml@master 47 | with: 48 | debug: ${{ github.event.inputs.debug }} 49 | -------------------------------------------------------------------------------- /.github/workflows/fork-update-pr.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | # ============================================================================ # 15 | # F o r k U p d a t e P R 16 | # ============================================================================ # 17 | 18 | # For a fork of the original repo, activate to keep its branches up to date via Pull Requests 19 | # 20 | # To be used in conjunction with the adjacent fork-sync.yaml which keeps the default branch up to date 21 | 22 | --- 23 | name: Fork Update PR 24 | 25 | on: # yamllint disable-line rule:truthy 26 | workflow_dispatch: 27 | inputs: 28 | debug: 29 | type: boolean 30 | required: false 31 | default: false 32 | schedule: 33 | - cron: '0 10 * * 1' 34 | 35 | permissions: 36 | contents: write 37 | pull-requests: write 38 | 39 | concurrency: 40 | group: ${{ github.workflow }}-${{ github.ref }} 41 | cancel-in-progress: false 42 | 43 | jobs: 44 | fork_update_pr: 45 | # github.event.repository context not available in scheduled workflows 46 | #if: github.event.repository.fork == true 47 | if: github.repository_owner != 'HariSekhon' 48 | name: Fork Update PR 49 | uses: HariSekhon/GitHub-Actions/.github/workflows/fork-update-pr.yaml@master 50 | with: 51 | debug: ${{ github.event.inputs.debug }} 52 | -------------------------------------------------------------------------------- /.github/workflows/golang.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | name: Golang 15 | 16 | on: # yamllint disable-line rule:truthy 17 | push: 18 | branches: 19 | - master 20 | - main 21 | paths: 22 | - '**/*.go' 23 | - go.mod 24 | - go.sum 25 | - .github/workflows/golang.yaml 26 | pull_request: 27 | branches: 28 | - master 29 | - main 30 | paths: 31 | - '**/*.go' 32 | - go.mod 33 | - go.sum 34 | - .github/workflows/golang.yaml 35 | workflow_dispatch: 36 | inputs: 37 | debug: 38 | type: boolean 39 | required: false 40 | default: false 41 | schedule: 42 | - cron: '0 7 * * *' 43 | 44 | permissions: 45 | contents: read 46 | 47 | concurrency: 48 | group: ${{ github.workflow }}-${{ github.ref }} 49 | cancel-in-progress: true 50 | 51 | jobs: 52 | build: 53 | # github.event.repository context not available in scheduled workflows 54 | #if: github.event.repository.fork == false 55 | if: github.repository_owner == 'HariSekhon' 56 | name: Golang 57 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 58 | with: 59 | container: golang:latest 60 | caches: apt golang 61 | debug: ${{ github.event.inputs.debug }} 62 | -------------------------------------------------------------------------------- /.github/workflows/golang_1.10.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | name: Golang 1.10 15 | 16 | on: # yamllint disable-line rule:truthy 17 | push: 18 | branches: 19 | - master 20 | - main 21 | paths: 22 | - '**/*.go' 23 | - go.mod 24 | - go.sum 25 | - .github/workflows/golang_1.10.yaml 26 | pull_request: 27 | branches: 28 | - master 29 | - main 30 | paths: 31 | - '**/*.go' 32 | - go.mod 33 | - go.sum 34 | - .github/workflows/golang_1.10.yaml 35 | workflow_dispatch: 36 | inputs: 37 | debug: 38 | type: boolean 39 | required: false 40 | default: false 41 | schedule: 42 | - cron: '0 7 * * *' 43 | 44 | permissions: 45 | contents: read 46 | 47 | concurrency: 48 | group: ${{ github.workflow }}-${{ github.ref }} 49 | cancel-in-progress: true 50 | 51 | jobs: 52 | build: 53 | # github.event.repository context not available in scheduled workflows 54 | #if: github.event.repository.fork == false 55 | if: github.repository_owner == 'HariSekhon' 56 | name: Golang 1.10 57 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 58 | with: 59 | container: golang:1.10 60 | caches: apt golang 61 | debug: ${{ github.event.inputs.debug }} 62 | -------------------------------------------------------------------------------- /.github/workflows/golang_1.11.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | name: Golang 1.11 15 | 16 | on: # yamllint disable-line rule:truthy 17 | push: 18 | branches: 19 | - master 20 | - main 21 | paths: 22 | - '**/*.go' 23 | - go.mod 24 | - go.sum 25 | - .github/workflows/golang_1.11.yaml 26 | pull_request: 27 | branches: 28 | - master 29 | - main 30 | paths: 31 | - '**/*.go' 32 | - go.mod 33 | - go.sum 34 | - .github/workflows/golang_1.11.yaml 35 | workflow_dispatch: 36 | inputs: 37 | debug: 38 | type: boolean 39 | required: false 40 | default: false 41 | schedule: 42 | - cron: '0 7 * * *' 43 | 44 | permissions: 45 | contents: read 46 | 47 | concurrency: 48 | group: ${{ github.workflow }}-${{ github.ref }} 49 | cancel-in-progress: true 50 | 51 | jobs: 52 | build: 53 | # github.event.repository context not available in scheduled workflows 54 | #if: github.event.repository.fork == false 55 | if: github.repository_owner == 'HariSekhon' 56 | name: Golang 1.11 57 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 58 | with: 59 | container: golang:1.11 60 | caches: apt golang 61 | debug: ${{ github.event.inputs.debug }} 62 | -------------------------------------------------------------------------------- /.github/workflows/golang_1.12.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | name: Golang 1.12 15 | 16 | on: # yamllint disable-line rule:truthy 17 | push: 18 | branches: 19 | - master 20 | - main 21 | paths: 22 | - '**/*.go' 23 | - go.mod 24 | - go.sum 25 | - .github/workflows/golang_1.12.yaml 26 | pull_request: 27 | branches: 28 | - master 29 | - main 30 | paths: 31 | - '**/*.go' 32 | - go.mod 33 | - go.sum 34 | - .github/workflows/golang_1.12.yaml 35 | workflow_dispatch: 36 | inputs: 37 | debug: 38 | type: boolean 39 | required: false 40 | default: false 41 | schedule: 42 | - cron: '0 7 * * *' 43 | 44 | permissions: 45 | contents: read 46 | 47 | concurrency: 48 | group: ${{ github.workflow }}-${{ github.ref }} 49 | cancel-in-progress: true 50 | 51 | jobs: 52 | build: 53 | # github.event.repository context not available in scheduled workflows 54 | #if: github.event.repository.fork == false 55 | if: github.repository_owner == 'HariSekhon' 56 | name: Golang 1.12 57 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 58 | with: 59 | container: golang:1.12 60 | caches: apt golang 61 | debug: ${{ github.event.inputs.debug }} 62 | -------------------------------------------------------------------------------- /.github/workflows/golang_1.13.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | name: Golang 1.13 15 | 16 | on: # yamllint disable-line rule:truthy 17 | push: 18 | branches: 19 | - master 20 | - main 21 | paths: 22 | - '**/*.go' 23 | - go.mod 24 | - go.sum 25 | - .github/workflows/golang_1.13.yaml 26 | pull_request: 27 | branches: 28 | - master 29 | - main 30 | paths: 31 | - '**/*.go' 32 | - go.mod 33 | - go.sum 34 | - .github/workflows/golang_1.13.yaml 35 | workflow_dispatch: 36 | inputs: 37 | debug: 38 | type: boolean 39 | required: false 40 | default: false 41 | schedule: 42 | - cron: '0 7 * * *' 43 | 44 | permissions: 45 | contents: read 46 | 47 | concurrency: 48 | group: ${{ github.workflow }}-${{ github.ref }} 49 | cancel-in-progress: true 50 | 51 | jobs: 52 | build: 53 | # github.event.repository context not available in scheduled workflows 54 | #if: github.event.repository.fork == false 55 | if: github.repository_owner == 'HariSekhon' 56 | name: Golang 1.13 57 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 58 | with: 59 | container: golang:1.13 60 | caches: apt golang 61 | debug: ${{ github.event.inputs.debug }} 62 | -------------------------------------------------------------------------------- /.github/workflows/golang_1.14.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | name: Golang 1.14 15 | 16 | on: # yamllint disable-line rule:truthy 17 | push: 18 | branches: 19 | - master 20 | - main 21 | paths: 22 | - '**/*.go' 23 | - go.mod 24 | - go.sum 25 | - .github/workflows/golang_1.14.yaml 26 | pull_request: 27 | branches: 28 | - master 29 | - main 30 | paths: 31 | - '**/*.go' 32 | - go.mod 33 | - go.sum 34 | - .github/workflows/golang_1.14.yaml 35 | workflow_dispatch: 36 | inputs: 37 | debug: 38 | type: boolean 39 | required: false 40 | default: false 41 | schedule: 42 | - cron: '0 7 * * *' 43 | 44 | permissions: 45 | contents: read 46 | 47 | concurrency: 48 | group: ${{ github.workflow }}-${{ github.ref }} 49 | cancel-in-progress: true 50 | 51 | jobs: 52 | build: 53 | # github.event.repository context not available in scheduled workflows 54 | #if: github.event.repository.fork == false 55 | if: github.repository_owner == 'HariSekhon' 56 | name: Golang 1.14 57 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 58 | with: 59 | container: golang:1.14 60 | caches: apt golang 61 | debug: ${{ github.event.inputs.debug }} 62 | -------------------------------------------------------------------------------- /.github/workflows/golang_1.15.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | name: Golang 1.15 15 | 16 | on: # yamllint disable-line rule:truthy 17 | push: 18 | branches: 19 | - master 20 | - main 21 | paths: 22 | - '**/*.go' 23 | - go.mod 24 | - go.sum 25 | - .github/workflows/golang_1.15.yaml 26 | pull_request: 27 | branches: 28 | - master 29 | - main 30 | paths: 31 | - '**/*.go' 32 | - go.mod 33 | - go.sum 34 | - .github/workflows/golang_1.15.yaml 35 | workflow_dispatch: 36 | inputs: 37 | debug: 38 | type: boolean 39 | required: false 40 | default: false 41 | schedule: 42 | - cron: '0 7 * * *' 43 | 44 | permissions: 45 | contents: read 46 | 47 | concurrency: 48 | group: ${{ github.workflow }}-${{ github.ref }} 49 | cancel-in-progress: true 50 | 51 | jobs: 52 | build: 53 | # github.event.repository context not available in scheduled workflows 54 | #if: github.event.repository.fork == false 55 | if: github.repository_owner == 'HariSekhon' 56 | name: Golang 1.15 57 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 58 | with: 59 | container: golang:1.15 60 | caches: apt golang 61 | debug: ${{ github.event.inputs.debug }} 62 | -------------------------------------------------------------------------------- /.github/workflows/golang_1.16.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | name: Golang 1.16 15 | 16 | on: # yamllint disable-line rule:truthy 17 | push: 18 | branches: 19 | - master 20 | - main 21 | paths: 22 | - '**/*.go' 23 | - go.mod 24 | - go.sum 25 | - .github/workflows/golang_1.16.yaml 26 | pull_request: 27 | branches: 28 | - master 29 | - main 30 | paths: 31 | - '**/*.go' 32 | - go.mod 33 | - go.sum 34 | - .github/workflows/golang_1.16.yaml 35 | workflow_dispatch: 36 | inputs: 37 | debug: 38 | type: boolean 39 | required: false 40 | default: false 41 | schedule: 42 | - cron: '0 7 * * *' 43 | 44 | permissions: 45 | contents: read 46 | 47 | concurrency: 48 | group: ${{ github.workflow }}-${{ github.ref }} 49 | cancel-in-progress: true 50 | 51 | jobs: 52 | build: 53 | # github.event.repository context not available in scheduled workflows 54 | #if: github.event.repository.fork == false 55 | if: github.repository_owner == 'HariSekhon' 56 | name: Golang 1.16 57 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 58 | with: 59 | container: golang:1.16 60 | caches: apt golang 61 | debug: ${{ github.event.inputs.debug }} 62 | -------------------------------------------------------------------------------- /.github/workflows/golang_1.17.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | name: Golang 1.17 15 | 16 | on: # yamllint disable-line rule:truthy 17 | push: 18 | branches: 19 | - master 20 | - main 21 | paths: 22 | - '**/*.go' 23 | - go.mod 24 | - go.sum 25 | - .github/workflows/golang_1.17.yaml 26 | pull_request: 27 | branches: 28 | - master 29 | - main 30 | paths: 31 | - '**/*.go' 32 | - go.mod 33 | - go.sum 34 | - .github/workflows/golang_1.17.yaml 35 | workflow_dispatch: 36 | inputs: 37 | debug: 38 | type: boolean 39 | required: false 40 | default: false 41 | schedule: 42 | - cron: '0 7 * * *' 43 | 44 | permissions: 45 | contents: read 46 | 47 | concurrency: 48 | group: ${{ github.workflow }}-${{ github.ref }} 49 | cancel-in-progress: true 50 | 51 | jobs: 52 | build: 53 | # github.event.repository context not available in scheduled workflows 54 | #if: github.event.repository.fork == false 55 | if: github.repository_owner == 'HariSekhon' 56 | name: Golang 1.17 57 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 58 | with: 59 | container: golang:1.17 60 | caches: apt golang 61 | debug: ${{ github.event.inputs.debug }} 62 | -------------------------------------------------------------------------------- /.github/workflows/golang_1.18.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | name: Golang 1.18 15 | 16 | on: # yamllint disable-line rule:truthy 17 | push: 18 | branches: 19 | - master 20 | - main 21 | paths: 22 | - '**/*.go' 23 | - go.mod 24 | - go.sum 25 | - .github/workflows/golang_1.18.yaml 26 | pull_request: 27 | branches: 28 | - master 29 | - main 30 | paths: 31 | - '**/*.go' 32 | - go.mod 33 | - go.sum 34 | - .github/workflows/golang_1.18.yaml 35 | workflow_dispatch: 36 | inputs: 37 | debug: 38 | type: boolean 39 | required: false 40 | default: false 41 | schedule: 42 | - cron: '0 7 * * *' 43 | 44 | permissions: 45 | contents: read 46 | 47 | concurrency: 48 | group: ${{ github.workflow }}-${{ github.ref }} 49 | cancel-in-progress: true 50 | 51 | jobs: 52 | build: 53 | # github.event.repository context not available in scheduled workflows 54 | #if: github.event.repository.fork == false 55 | if: github.repository_owner == 'HariSekhon' 56 | name: Golang 1.18 57 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 58 | with: 59 | container: golang:1.18 60 | caches: apt golang 61 | debug: ${{ github.event.inputs.debug }} 62 | -------------------------------------------------------------------------------- /.github/workflows/golang_1.2.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | name: Golang 1.2 15 | 16 | on: # yamllint disable-line rule:truthy 17 | push: 18 | branches: 19 | - master 20 | - main 21 | paths: 22 | - '**/*.go' 23 | - go.mod 24 | - go.sum 25 | - .github/workflows/golang_1.2.yaml 26 | pull_request: 27 | branches: 28 | - master 29 | - main 30 | paths: 31 | - '**/*.go' 32 | - go.mod 33 | - go.sum 34 | - .github/workflows/golang_1.2.yaml 35 | workflow_dispatch: 36 | inputs: 37 | debug: 38 | type: boolean 39 | required: false 40 | default: false 41 | schedule: 42 | - cron: '0 7 * * *' 43 | 44 | permissions: 45 | contents: read 46 | 47 | concurrency: 48 | group: ${{ github.workflow }}-${{ github.ref }} 49 | cancel-in-progress: true 50 | 51 | jobs: 52 | build: 53 | # github.event.repository context not available in scheduled workflows 54 | #if: github.event.repository.fork == false 55 | if: github.repository_owner == 'HariSekhon' 56 | name: Golang 1.2 57 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 58 | with: 59 | container: golang:1.2 60 | caches: apt golang 61 | debug: ${{ github.event.inputs.debug }} 62 | -------------------------------------------------------------------------------- /.github/workflows/golang_1.3.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | name: Golang 1.3 15 | 16 | on: # yamllint disable-line rule:truthy 17 | push: 18 | branches: 19 | - master 20 | - main 21 | paths: 22 | - '**/*.go' 23 | - go.mod 24 | - go.sum 25 | - .github/workflows/golang_1.3.yaml 26 | pull_request: 27 | branches: 28 | - master 29 | - main 30 | paths: 31 | - '**/*.go' 32 | - go.mod 33 | - go.sum 34 | - .github/workflows/golang_1.3.yaml 35 | workflow_dispatch: 36 | inputs: 37 | debug: 38 | type: boolean 39 | required: false 40 | default: false 41 | schedule: 42 | - cron: '0 7 * * *' 43 | 44 | permissions: 45 | contents: read 46 | 47 | concurrency: 48 | group: ${{ github.workflow }}-${{ github.ref }} 49 | cancel-in-progress: true 50 | 51 | jobs: 52 | build: 53 | # github.event.repository context not available in scheduled workflows 54 | #if: github.event.repository.fork == false 55 | if: github.repository_owner == 'HariSekhon' 56 | name: Golang 1.3 57 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 58 | with: 59 | container: golang:1.3 60 | caches: apt golang 61 | debug: ${{ github.event.inputs.debug }} 62 | -------------------------------------------------------------------------------- /.github/workflows/golang_1.4.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | name: Golang 1.4 15 | 16 | on: # yamllint disable-line rule:truthy 17 | push: 18 | branches: 19 | - master 20 | - main 21 | paths: 22 | - '**/*.go' 23 | - go.mod 24 | - go.sum 25 | - .github/workflows/golang_1.4.yaml 26 | pull_request: 27 | branches: 28 | - master 29 | - main 30 | paths: 31 | - '**/*.go' 32 | - go.mod 33 | - go.sum 34 | - .github/workflows/golang_1.4.yaml 35 | workflow_dispatch: 36 | inputs: 37 | debug: 38 | type: boolean 39 | required: false 40 | default: false 41 | schedule: 42 | - cron: '0 7 * * *' 43 | 44 | permissions: 45 | contents: read 46 | 47 | concurrency: 48 | group: ${{ github.workflow }}-${{ github.ref }} 49 | cancel-in-progress: true 50 | 51 | jobs: 52 | build: 53 | # github.event.repository context not available in scheduled workflows 54 | #if: github.event.repository.fork == false 55 | if: github.repository_owner == 'HariSekhon' 56 | name: Golang 1.4 57 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 58 | with: 59 | container: golang:1.4 60 | caches: apt golang 61 | debug: ${{ github.event.inputs.debug }} 62 | -------------------------------------------------------------------------------- /.github/workflows/golang_1.5.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | name: Golang 1.5 15 | 16 | on: # yamllint disable-line rule:truthy 17 | push: 18 | branches: 19 | - master 20 | - main 21 | paths: 22 | - '**/*.go' 23 | - go.mod 24 | - go.sum 25 | - .github/workflows/golang_1.5.yaml 26 | pull_request: 27 | branches: 28 | - master 29 | - main 30 | paths: 31 | - '**/*.go' 32 | - go.mod 33 | - go.sum 34 | - .github/workflows/golang_1.5.yaml 35 | workflow_dispatch: 36 | inputs: 37 | debug: 38 | type: boolean 39 | required: false 40 | default: false 41 | schedule: 42 | - cron: '0 7 * * *' 43 | 44 | permissions: 45 | contents: read 46 | 47 | concurrency: 48 | group: ${{ github.workflow }}-${{ github.ref }} 49 | cancel-in-progress: true 50 | 51 | jobs: 52 | build: 53 | # github.event.repository context not available in scheduled workflows 54 | #if: github.event.repository.fork == false 55 | if: github.repository_owner == 'HariSekhon' 56 | name: Golang 1.5 57 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 58 | with: 59 | container: golang:1.5 60 | caches: apt golang 61 | debug: ${{ github.event.inputs.debug }} 62 | -------------------------------------------------------------------------------- /.github/workflows/golang_1.6.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | name: Golang 1.6 15 | 16 | on: # yamllint disable-line rule:truthy 17 | push: 18 | branches: 19 | - master 20 | - main 21 | paths: 22 | - '**/*.go' 23 | - go.mod 24 | - go.sum 25 | - .github/workflows/golang_1.6.yaml 26 | pull_request: 27 | branches: 28 | - master 29 | - main 30 | paths: 31 | - '**/*.go' 32 | - go.mod 33 | - go.sum 34 | - .github/workflows/golang_1.6.yaml 35 | workflow_dispatch: 36 | inputs: 37 | debug: 38 | type: boolean 39 | required: false 40 | default: false 41 | schedule: 42 | - cron: '0 7 * * *' 43 | 44 | permissions: 45 | contents: read 46 | 47 | concurrency: 48 | group: ${{ github.workflow }}-${{ github.ref }} 49 | cancel-in-progress: true 50 | 51 | jobs: 52 | build: 53 | # github.event.repository context not available in scheduled workflows 54 | #if: github.event.repository.fork == false 55 | if: github.repository_owner == 'HariSekhon' 56 | name: Golang 1.6 57 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 58 | with: 59 | container: golang:1.6 60 | caches: apt golang 61 | debug: ${{ github.event.inputs.debug }} 62 | -------------------------------------------------------------------------------- /.github/workflows/golang_1.7.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | name: Golang 1.7 15 | 16 | on: # yamllint disable-line rule:truthy 17 | push: 18 | branches: 19 | - master 20 | - main 21 | paths: 22 | - '**/*.go' 23 | - go.mod 24 | - go.sum 25 | - .github/workflows/golang_1.7.yaml 26 | pull_request: 27 | branches: 28 | - master 29 | - main 30 | paths: 31 | - '**/*.go' 32 | - go.mod 33 | - go.sum 34 | - .github/workflows/golang_1.7.yaml 35 | workflow_dispatch: 36 | inputs: 37 | debug: 38 | type: boolean 39 | required: false 40 | default: false 41 | schedule: 42 | - cron: '0 7 * * *' 43 | 44 | permissions: 45 | contents: read 46 | 47 | concurrency: 48 | group: ${{ github.workflow }}-${{ github.ref }} 49 | cancel-in-progress: true 50 | 51 | jobs: 52 | build: 53 | # github.event.repository context not available in scheduled workflows 54 | #if: github.event.repository.fork == false 55 | if: github.repository_owner == 'HariSekhon' 56 | name: Golang 1.7 57 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 58 | with: 59 | container: golang:1.7 60 | caches: apt golang 61 | debug: ${{ github.event.inputs.debug }} 62 | -------------------------------------------------------------------------------- /.github/workflows/golang_1.8.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | name: Golang 1.8 15 | 16 | on: # yamllint disable-line rule:truthy 17 | push: 18 | branches: 19 | - master 20 | - main 21 | paths: 22 | - '**/*.go' 23 | - go.mod 24 | - go.sum 25 | - .github/workflows/golang_1.8.yaml 26 | pull_request: 27 | branches: 28 | - master 29 | - main 30 | paths: 31 | - '**/*.go' 32 | - go.mod 33 | - go.sum 34 | - .github/workflows/golang_1.8.yaml 35 | workflow_dispatch: 36 | inputs: 37 | debug: 38 | type: boolean 39 | required: false 40 | default: false 41 | schedule: 42 | - cron: '0 7 * * *' 43 | 44 | permissions: 45 | contents: read 46 | 47 | concurrency: 48 | group: ${{ github.workflow }}-${{ github.ref }} 49 | cancel-in-progress: true 50 | 51 | jobs: 52 | build: 53 | # github.event.repository context not available in scheduled workflows 54 | #if: github.event.repository.fork == false 55 | if: github.repository_owner == 'HariSekhon' 56 | name: Golang 1.8 57 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 58 | with: 59 | container: golang:1.8 60 | caches: apt golang 61 | debug: ${{ github.event.inputs.debug }} 62 | -------------------------------------------------------------------------------- /.github/workflows/golang_1.9.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | name: Golang 1.9 15 | 16 | on: # yamllint disable-line rule:truthy 17 | push: 18 | branches: 19 | - master 20 | - main 21 | paths: 22 | - '**/*.go' 23 | - go.mod 24 | - go.sum 25 | - .github/workflows/golang_1.9.yaml 26 | pull_request: 27 | branches: 28 | - master 29 | - main 30 | paths: 31 | - '**/*.go' 32 | - go.mod 33 | - go.sum 34 | - .github/workflows/golang_1.9.yaml 35 | workflow_dispatch: 36 | inputs: 37 | debug: 38 | type: boolean 39 | required: false 40 | default: false 41 | schedule: 42 | - cron: '0 7 * * *' 43 | 44 | permissions: 45 | contents: read 46 | 47 | concurrency: 48 | group: ${{ github.workflow }}-${{ github.ref }} 49 | cancel-in-progress: true 50 | 51 | jobs: 52 | build: 53 | # github.event.repository context not available in scheduled workflows 54 | #if: github.event.repository.fork == false 55 | if: github.repository_owner == 'HariSekhon' 56 | name: Golang 1.9 57 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 58 | with: 59 | container: golang:1.9 60 | caches: apt golang 61 | debug: ${{ github.event.inputs.debug }} 62 | -------------------------------------------------------------------------------- /.github/workflows/grype.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: 2023-05-13 01:07:56 +0100 (Sat, 13 May 2023) 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | # ============================================================================ # 15 | # G r y p e 16 | # ============================================================================ # 17 | 18 | --- 19 | name: Grype 20 | 21 | on: # yamllint disable-line rule:truthy 22 | push: 23 | branches: 24 | - master 25 | - main 26 | paths-ignore: 27 | - '**/*.md' 28 | pull_request: 29 | branches: 30 | - master 31 | - main 32 | paths-ignore: 33 | - '**/*.md' 34 | workflow_dispatch: 35 | inputs: 36 | debug: 37 | type: boolean 38 | required: false 39 | default: false 40 | schedule: 41 | - cron: '0 0 * * 1' 42 | 43 | permissions: 44 | actions: read 45 | contents: read 46 | security-events: write 47 | 48 | concurrency: 49 | group: ${{ github.workflow }}-${{ github.ref }} 50 | cancel-in-progress: true 51 | 52 | jobs: 53 | Grype: 54 | # github.event.repository context not available in scheduled workflows 55 | #if: github.event.repository.fork == false 56 | if: github.repository_owner == 'HariSekhon' 57 | name: Grype 58 | uses: HariSekhon/GitHub-Actions/.github/workflows/grype.yaml@master 59 | with: 60 | debug: ${{ github.event.inputs.debug }} 61 | -------------------------------------------------------------------------------- /.github/workflows/json.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | # ============================================================================ # 15 | # J S O N 16 | # ============================================================================ # 17 | 18 | # Validate any JSON files found in the repo 19 | 20 | --- 21 | name: JSON 22 | 23 | on: # yamllint disable-line rule:truthy 24 | push: 25 | branches: 26 | - master 27 | - main 28 | paths: 29 | - '**/*.json' 30 | - .github/workflows/json.yaml 31 | pull_request: 32 | branches: 33 | - master 34 | - main 35 | paths: 36 | - '**/*.json' 37 | - .github/workflows/json.yaml 38 | workflow_dispatch: 39 | inputs: 40 | debug: 41 | type: boolean 42 | required: false 43 | default: false 44 | schedule: 45 | - cron: '0 0 * * 1' 46 | 47 | permissions: 48 | contents: read 49 | 50 | jobs: 51 | check_json: 52 | # github.event.repository context not available in scheduled workflows 53 | #if: github.event.repository.fork == false 54 | if: github.repository_owner == 'HariSekhon' 55 | name: Check JSON 56 | uses: HariSekhon/GitHub-Actions/.github/workflows/json.yaml@master 57 | with: 58 | debug: ${{ github.event.inputs.debug }} 59 | -------------------------------------------------------------------------------- /.github/workflows/kics.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: 2022-02-01 19:36:08 +0000 (Tue, 01 Feb 2022) 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | # ============================================================================ # 15 | # K i c s 16 | # ============================================================================ # 17 | 18 | --- 19 | name: Kics 20 | 21 | on: # yamllint disable-line rule:truthy 22 | push: 23 | branches: 24 | - master 25 | - main 26 | paths-ignore: 27 | - '**/*.md' 28 | pull_request: 29 | branches: 30 | - master 31 | - main 32 | paths-ignore: 33 | - '**/*.md' 34 | workflow_dispatch: 35 | inputs: 36 | debug: 37 | type: boolean 38 | required: false 39 | default: false 40 | schedule: 41 | - cron: '0 0 * * 1' 42 | 43 | permissions: 44 | actions: read 45 | contents: read 46 | security-events: write 47 | 48 | concurrency: 49 | group: ${{ github.workflow }}-${{ github.ref }} 50 | cancel-in-progress: true 51 | 52 | jobs: 53 | kics: 54 | # github.event.repository context not available in scheduled workflows 55 | #if: github.event.repository.fork == false 56 | if: github.repository_owner == 'HariSekhon' 57 | name: Kics 58 | uses: HariSekhon/GitHub-Actions/.github/workflows/kics.yaml@master 59 | with: 60 | debug: ${{ github.event.inputs.debug }} 61 | -------------------------------------------------------------------------------- /.github/workflows/mac.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: Mac 16 | 17 | on: # yamllint disable-line rule:truthy 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/alpine.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | runs-on: macos-latest 84 | caches: brew pip cpanm 85 | debug: ${{ github.event.inputs.debug }} 86 | -------------------------------------------------------------------------------- /.github/workflows/mac_11.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: Mac 11 16 | 17 | on: # yamllint disable-line rule:truthy 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/alpine.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | runs-on: macos-11 84 | caches: brew pip cpanm 85 | debug: ${{ github.event.inputs.debug }} 86 | -------------------------------------------------------------------------------- /.github/workflows/mac_12.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: Mac 12 16 | 17 | on: # yamllint disable-line rule:truthy 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/alpine.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | runs-on: macos-12 84 | caches: brew pip cpanm 85 | debug: ${{ github.event.inputs.debug }} 86 | -------------------------------------------------------------------------------- /.github/workflows/markdown.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: 2023-04-14 23:53:43 +0100 (Fri, 14 Apr 2023) 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | # ============================================================================ # 15 | # M a r k D o w n 16 | # ============================================================================ # 17 | 18 | --- 19 | name: Markdown 20 | 21 | on: # yamllint disable-line rule:truthy 22 | push: 23 | branches: 24 | - master 25 | - main 26 | paths: 27 | - '**/*.md' 28 | - .mdlrc 29 | - .mdl.rb 30 | - .markdownlint.rb 31 | - .github/workflows/markdown.yaml 32 | pull_request: 33 | branches: 34 | - master 35 | - main 36 | paths: 37 | - '**/*.md' 38 | - .mdlrc 39 | - .mdl.rb 40 | - .markdownlint.rb 41 | - .github/workflows/markdown.yaml 42 | workflow_dispatch: 43 | 44 | permissions: 45 | contents: read 46 | pull-requests: read 47 | 48 | jobs: 49 | Markdown: 50 | # github.event.repository context not available in scheduled workflows 51 | #if: github.event.repository.fork == false 52 | if: github.repository_owner == 'HariSekhon' 53 | name: Markdown 54 | uses: HariSekhon/GitHub-Actions/.github/workflows/markdown.yaml@master 55 | -------------------------------------------------------------------------------- /.github/workflows/semgrep-cloud.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | # ============================================================================ # 15 | # S e m g r e p C l o u d W o r k f l o w 16 | # ============================================================================ # 17 | 18 | # Logs results to https://semgrep.dev/ 19 | 20 | --- 21 | name: Semgrep Cloud 22 | 23 | on: # yamllint disable-line rule:truthy 24 | push: 25 | branches: 26 | - master 27 | - main 28 | paths-ignore: 29 | - '**/*.md' 30 | pull_request: 31 | branches: 32 | - master 33 | - main 34 | paths-ignore: 35 | - '**/*.md' 36 | workflow_dispatch: 37 | inputs: 38 | debug: 39 | type: boolean 40 | required: false 41 | default: false 42 | schedule: 43 | - cron: '0 0 * * 1' 44 | 45 | permissions: 46 | contents: read 47 | 48 | concurrency: 49 | group: ${{ github.workflow }}-${{ github.ref }} 50 | cancel-in-progress: true 51 | 52 | jobs: 53 | semgrep: 54 | # github.event.repository context not available in scheduled workflows 55 | #if: github.event.repository.fork == false 56 | if: github.repository_owner == 'HariSekhon' 57 | name: Semgrep Cloud 58 | uses: HariSekhon/GitHub-Actions/.github/workflows/semgrep-cloud.yaml@master 59 | secrets: 60 | SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }} 61 | with: 62 | debug: ${{ github.event.inputs.debug }} 63 | -------------------------------------------------------------------------------- /.github/workflows/semgrep.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | # ============================================================================ # 15 | # S e m g r e p G i t H u b W o r k f l o w 16 | # ============================================================================ # 17 | 18 | # Generates code scanning alerts in GitHub's Security tab -> Code scanning alerts 19 | 20 | # https://semgrep.dev/docs/semgrep-ci/sample-ci-configs/#github-actions 21 | 22 | --- 23 | name: Semgrep 24 | 25 | on: # yamllint disable-line rule:truthy 26 | push: 27 | branches: 28 | - master 29 | - main 30 | paths-ignore: 31 | - '**/*.md' 32 | pull_request: 33 | branches: 34 | - master 35 | - main 36 | paths-ignore: 37 | - '**/*.md' 38 | workflow_dispatch: 39 | inputs: 40 | debug: 41 | type: boolean 42 | required: false 43 | default: false 44 | schedule: 45 | - cron: '0 0 * * 1' 46 | 47 | permissions: 48 | actions: read 49 | contents: read 50 | security-events: write 51 | 52 | concurrency: 53 | group: ${{ github.workflow }}-${{ github.ref }} 54 | cancel-in-progress: true 55 | 56 | jobs: 57 | semgrep: 58 | # github.event.repository context not available in scheduled workflows 59 | #if: github.event.repository.fork == false 60 | if: github.repository_owner == 'HariSekhon' 61 | name: Semgrep GitHub Security Tab 62 | uses: HariSekhon/GitHub-Actions/.github/workflows/semgrep.yaml@master 63 | with: 64 | debug: ${{ github.event.inputs.debug }} 65 | -------------------------------------------------------------------------------- /.github/workflows/shellcheck.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | # ============================================================================ # 15 | # S h e l l C h e c k 16 | # ============================================================================ # 17 | 18 | # Validate any shell scripts found in the repo 19 | 20 | --- 21 | name: ShellCheck 22 | 23 | on: # yamllint disable-line rule:truthy 24 | push: 25 | branches: 26 | - master 27 | - main 28 | paths: 29 | - '**/*.sh' 30 | - .github/workflows/shellcheck.yaml 31 | pull_request: 32 | branches: 33 | - master 34 | - main 35 | paths: 36 | - '**/*.sh' 37 | - .github/workflows/shellcheck.yaml 38 | workflow_dispatch: 39 | inputs: 40 | debug: 41 | type: boolean 42 | required: false 43 | default: false 44 | 45 | permissions: 46 | contents: read 47 | 48 | concurrency: 49 | group: ${{ github.workflow }}-${{ github.ref }} 50 | cancel-in-progress: true 51 | 52 | jobs: 53 | shellcheck: 54 | # github.event.repository context not available in scheduled workflows 55 | #if: github.event.repository.fork == false 56 | if: github.repository_owner == 'HariSekhon' 57 | name: ShellCheck 58 | uses: HariSekhon/GitHub-Actions/.github/workflows/shellcheck.yaml@master 59 | with: 60 | debug: ${{ github.event.inputs.debug }} 61 | -------------------------------------------------------------------------------- /.github/workflows/trivy.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: 2022-02-02 11:27:37 +0000 (Wed, 02 Feb 2022) 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | # ============================================================================ # 15 | # T r i v y 16 | # ============================================================================ # 17 | 18 | # Scan files in the local repo 19 | 20 | --- 21 | name: Trivy 22 | 23 | on: # yamllint disable-line rule:truthy 24 | push: 25 | branches: 26 | - master 27 | - main 28 | paths-ignore: 29 | - '**/*.md' 30 | pull_request: 31 | branches: 32 | - master 33 | - main 34 | paths-ignore: 35 | - '**/*.md' 36 | workflow_dispatch: 37 | inputs: 38 | debug: 39 | type: boolean 40 | required: false 41 | default: false 42 | schedule: 43 | - cron: '0 0 * * 1' 44 | 45 | permissions: 46 | actions: read 47 | contents: read 48 | security-events: write 49 | 50 | concurrency: 51 | group: ${{ github.workflow }}-${{ github.ref }} 52 | cancel-in-progress: true 53 | 54 | jobs: 55 | trivy: 56 | # github.event.repository context not available in scheduled workflows 57 | #if: github.event.repository.fork == false 58 | if: github.repository_owner == 'HariSekhon' 59 | name: Trivy 60 | uses: HariSekhon/GitHub-Actions/.github/workflows/trivy.yaml@master 61 | with: 62 | debug: ${{ github.event.inputs.debug }} 63 | -------------------------------------------------------------------------------- /.github/workflows/ubuntu.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: Ubuntu 16 | 17 | on: # yamllint disable-line rule:truthy 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/ubuntu.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | container: ubuntu:latest 84 | caches: apt pip cpanm 85 | debug: ${{ github.event.inputs.debug }} 86 | -------------------------------------------------------------------------------- /.github/workflows/ubuntu_14.04.yaml.disabled: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: Ubuntu 14.04 16 | 17 | on: 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/ubuntu_14.04.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | container: ubuntu:14.04 84 | caches: apt pip cpanm 85 | debug: ${{ github.event.inputs.debug }} 86 | -------------------------------------------------------------------------------- /.github/workflows/ubuntu_16.04.yaml.disabled: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: Ubuntu 16.04 16 | 17 | on: 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/ubuntu_16.04.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | container: ubuntu:16.04 84 | caches: apt pip cpanm 85 | debug: ${{ github.event.inputs.debug }} 86 | -------------------------------------------------------------------------------- /.github/workflows/ubuntu_18.04.yaml.disabled: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: Ubuntu 18.04 16 | 17 | on: 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/ubuntu_18.04.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | container: ubuntu:18.04 84 | caches: apt pip cpanm 85 | debug: ${{ github.event.inputs.debug }} 86 | -------------------------------------------------------------------------------- /.github/workflows/ubuntu_20.04.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: Ubuntu 20.04 16 | 17 | on: # yamllint disable-line rule:truthy 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/ubuntu_20.04.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | container: ubuntu:20.04 84 | caches: apt pip cpanm 85 | debug: ${{ github.event.inputs.debug }} 86 | -------------------------------------------------------------------------------- /.github/workflows/ubuntu_22.04.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: Ubuntu 22.04 16 | 17 | on: # yamllint disable-line rule:truthy 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/ubuntu_22.04.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | container: ubuntu:22.04 84 | caches: apt pip cpanm 85 | debug: ${{ github.event.inputs.debug }} 86 | -------------------------------------------------------------------------------- /.github/workflows/ubuntu_github.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | --- 15 | name: GitHub Actions Ubuntu 16 | 17 | on: # yamllint disable-line rule:truthy 18 | push: 19 | branches: 20 | - master 21 | paths-ignore: 22 | - '**/*.md' 23 | - '.github/workflows/*' 24 | - '!.github/workflows/ubuntu_github.yaml' 25 | - '**/Dockerfile' 26 | - '**/Jenkinsfile' 27 | - '**/.envrc*' 28 | - .checkov.yaml 29 | - .dockerignore 30 | - .gcloudignore 31 | - .editorconfig 32 | - '.gitconfig*' 33 | - .gitignore 34 | - .grype.yaml 35 | - .hound.yml 36 | - .terraformignore 37 | - Jenkinsfile 38 | - .appveyor.yml 39 | - .buildkite/pipeline.yml 40 | - .circleci/config.yml 41 | - .cirrus.yml 42 | - .concourse.yml 43 | - .drone.yml 44 | - .gitlab-ci.yml 45 | - .gocd.yml 46 | - .scrutinizer.yml 47 | - .semaphore/semaphore.yml 48 | - .travis.yml 49 | - .werckerignore 50 | - azure-pipelines.yml 51 | - bitbucket-pipelines.yml 52 | - buddy.yml 53 | - buildspec.yml 54 | - cloudbuild.yaml 55 | - codefresh.yml 56 | - codeship.yml 57 | - shippable.yml 58 | - wercker.yml 59 | workflow_dispatch: 60 | inputs: 61 | debug: 62 | type: boolean 63 | required: false 64 | default: false 65 | schedule: 66 | - cron: '0 7 * * *' 67 | 68 | permissions: 69 | contents: read 70 | 71 | concurrency: 72 | group: ${{ github.workflow }}-${{ github.ref }} 73 | cancel-in-progress: true 74 | 75 | jobs: 76 | build: 77 | # github.event.repository context not available in scheduled workflows 78 | #if: github.event.repository.fork == false 79 | if: github.repository_owner == 'HariSekhon' 80 | name: Build 81 | uses: HariSekhon/GitHub-Actions/.github/workflows/make.yaml@master 82 | with: 83 | caches: apt pip cpanm 84 | debug: ${{ github.event.inputs.debug }} 85 | -------------------------------------------------------------------------------- /.github/workflows/validate.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | # ============================================================================ # 15 | # V a l i d a t i o n 16 | # ============================================================================ # 17 | 18 | # Run all custom validations against files in the repo 19 | 20 | --- 21 | name: Validation 22 | 23 | on: # yamllint disable-line rule:truthy 24 | push: 25 | branches: 26 | - master 27 | - main 28 | paths-ignore: 29 | - '**/*.md' 30 | pull_request: 31 | branches: 32 | - master 33 | - main 34 | paths-ignore: 35 | - '**/*.md' 36 | workflow_dispatch: 37 | inputs: 38 | debug: 39 | type: boolean 40 | required: false 41 | default: false 42 | #schedule: 43 | # - cron: '0 0 * * 1' 44 | 45 | permissions: 46 | contents: read 47 | 48 | concurrency: 49 | group: ${{ github.workflow }}-${{ github.ref }} 50 | cancel-in-progress: true 51 | 52 | jobs: 53 | validate: 54 | # github.event.repository context not available in scheduled workflows 55 | #if: github.event.repository.fork == false 56 | if: github.repository_owner == 'HariSekhon' 57 | name: Validate 58 | uses: HariSekhon/GitHub-Actions/.github/workflows/validate.yaml@master 59 | with: 60 | debug: ${{ github.event.inputs.debug }} 61 | -------------------------------------------------------------------------------- /.github/workflows/xml.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | # ============================================================================ # 15 | # X M L 16 | # ============================================================================ # 17 | 18 | # Validate any XML files found in the repo 19 | 20 | --- 21 | name: XML 22 | 23 | on: # yamllint disable-line rule:truthy 24 | push: 25 | branches: 26 | - master 27 | - main 28 | paths: 29 | - '**/*.xml' 30 | - .github/workflows/xml.yaml 31 | pull_request: 32 | branches: 33 | - master 34 | - main 35 | paths: 36 | - '**/*.xml' 37 | - .github/workflows/xml.yaml 38 | workflow_dispatch: 39 | inputs: 40 | debug: 41 | type: boolean 42 | required: false 43 | default: false 44 | schedule: 45 | - cron: '0 0 * * 1' 46 | 47 | permissions: 48 | contents: read 49 | 50 | jobs: 51 | check_xml: 52 | # github.event.repository context not available in scheduled workflows 53 | #if: github.event.repository.fork == false 54 | if: github.repository_owner == 'HariSekhon' 55 | name: Check XML 56 | uses: HariSekhon/GitHub-Actions/.github/workflows/xml.yaml@master 57 | -------------------------------------------------------------------------------- /.github/workflows/yaml.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: Tue Feb 4 09:53:28 2020 +0000 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | # ============================================================================ # 15 | # Y A M L 16 | # ============================================================================ # 17 | 18 | # Validate any YAML files found in the repo 19 | 20 | --- 21 | name: YAML 22 | 23 | on: # yamllint disable-line rule:truthy 24 | push: 25 | branches: 26 | - master 27 | - main 28 | paths: 29 | - '**/*.yml' 30 | - '**/*.yaml' 31 | - .github/workflows/yaml.yaml 32 | pull_request: 33 | branches: 34 | - master 35 | - main 36 | paths: 37 | - '**/*.yml' 38 | - '**/*.yaml' 39 | - .github/workflows/yaml.yaml 40 | workflow_dispatch: 41 | inputs: 42 | debug: 43 | type: boolean 44 | required: false 45 | default: false 46 | schedule: 47 | - cron: '0 0 * * 1' 48 | 49 | permissions: 50 | contents: read 51 | 52 | concurrency: 53 | group: ${{ github.workflow }}-${{ github.ref }} 54 | cancel-in-progress: true 55 | 56 | jobs: 57 | check_yaml: 58 | # github.event.repository context not available in scheduled workflows 59 | #if: github.event.repository.fork == false 60 | if: github.repository_owner == 'HariSekhon' 61 | name: Check YAML 62 | uses: HariSekhon/GitHub-Actions/.github/workflows/yaml.yaml@master 63 | with: 64 | debug: ${{ github.event.inputs.debug }} 65 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | bin.darwin.amd64/ 3 | bin.linux.amd64/ 4 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | # vim:ts=2:sts=2:sw=2:et 2 | # 3 | # Author: Hari Sekhon 4 | # Date: Sun Feb 23 19:02:10 2020 +0000 5 | # 6 | # https://github.com/HariSekhon/DevOps-Golang-tools 7 | # 8 | # License: see accompanying Hari Sekhon LICENSE file 9 | # 10 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 11 | # to help improve or steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | # ============================================================================ # 17 | # G i t L a b C I 18 | # ============================================================================ # 19 | 20 | # https://docs.gitlab.com/ee/ci/yaml/README.html 21 | 22 | #include: '.gitlab/*.y*ml' 23 | 24 | image: ubuntu:18.04 25 | 26 | job: 27 | before_script: 28 | - setup/ci_bootstrap.sh 29 | script: 30 | - make init && make ci test 31 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "bash-tools"] 2 | path = bash-tools 3 | url = https://github.com/HariSekhon/DevOps-Bash-tools 4 | [submodule "templates"] 5 | path = templates 6 | url = https://github.com/HariSekhon/Templates 7 | [submodule "sql"] 8 | path = sql 9 | url = https://github.com/HariSekhon/SQL-scripts 10 | -------------------------------------------------------------------------------- /.mdl.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # vim:ts=4:sts=4:sw=4:et:filetype=ruby 3 | # 4 | # Author: Hari Sekhon 5 | # Date: 2024-08-22 01:58:12 +0200 (Thu, 22 Aug 2024) 6 | # 7 | # https///github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | all 17 | #exclude_rule 'MD001' 18 | #exclude_rule 'MD003' 19 | #exclude_rule 'MD005' 20 | exclude_rule 'MD007' # leave 2 space indentation for lists, 3 space is ugly af 21 | #exclude_rule 'MD012' 22 | exclude_rule 'MD013' # long lines cannot be split if they are URLs 23 | #exclude_rule 'MD022' 24 | #exclude_rule 'MD025' 25 | #exclude_rule 'MD031' 26 | #exclude_rule 'MD032' 27 | exclude_rule 'MD033' # inline HTML is important for formatting 28 | exclude_rule 'MD036' # emphasis used instead of header for footer Ported from lines 29 | #exclude_rule 'MD039' 30 | #exclude_rule 'MD056' 31 | -------------------------------------------------------------------------------- /.mdlrc: -------------------------------------------------------------------------------- 1 | mdlrc_dir = File.expand_path('..', __FILE__) 2 | 3 | style_file = File.join(mdlrc_dir, '.mdl.rb') 4 | 5 | style style_file 6 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: 2024-08-08 17:34:56 +0300 (Thu, 08 Aug 2024) 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https///github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | # ============================================================================ # 17 | # P r e - C o m m i t 18 | # ============================================================================ # 19 | 20 | --- 21 | fail_fast: false 22 | #exclude: *.tmp$ 23 | 24 | repos: 25 | 26 | # will accept anything that 'git clone' understands 27 | # this means you can set this to a local git repo to develop your own hook repos interactively 28 | - repo: https://github.com/pre-commit/pre-commit-hooks 29 | rev: v4.6.0 30 | hooks: 31 | - id: check-yaml 32 | # Common errors 33 | #- id: end-of-file-fixer # ruins .gitignore Icon\r 34 | - id: trailing-whitespace 35 | args: [--markdown-linebreak-ext=md] 36 | # Git style 37 | - id: check-added-large-files 38 | - id: check-merge-conflict 39 | - id: check-vcs-permalinks 40 | #- id: forbid-new-submodules 41 | # Cross platform 42 | - id: check-case-conflict 43 | - id: mixed-line-ending 44 | args: [--fix=lf] 45 | # Security 46 | - id: detect-aws-credentials 47 | args: ['--allow-missing-credentials'] 48 | 49 | # rewrites python files with useless changes like changing single quotes to double quotes 50 | #- repo: https://github.com/psf/black 51 | # rev: 24.8.0 52 | # hooks: 53 | # - id: black 54 | 55 | # Git secrets Leaks 56 | - repo: https://github.com/awslabs/git-secrets.git 57 | # the release tags for 1.2.0, 1.2.1 and 1.3.0 are broken with this error: 58 | # 59 | # /Users/hari/.cache/pre-commit/repo......./.pre-commit-hooks.yaml is not a file 60 | # 61 | rev: 5357e18 62 | hooks: 63 | - id: git-secrets 64 | 65 | - repo: https://github.com/markdownlint/markdownlint 66 | rev: v0.12.0 67 | hooks: 68 | - id: markdownlint 69 | name: Markdownlint 70 | description: Run markdownlint on your Markdown files 71 | entry: mdl 72 | args: [-s, .mdl.rb] 73 | language: ruby 74 | files: \.(md|mdown|markdown)$ 75 | -------------------------------------------------------------------------------- /.semaphore/semaphore.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: 2020-03-16 14:02:53 +0000 (Mon, 16 Mar 2020) 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | # ============================================================================ # 17 | # S e m a p h o r e C I 18 | # ============================================================================ # 19 | 20 | # https://docs.semaphoreci.com/reference/pipeline-yaml-reference/ 21 | 22 | version: v1.0 23 | name: DevOps-Golang-tools 24 | agent: 25 | # https://docs.semaphoreci.com/reference/machine-types#linux 26 | machine: 27 | type: e1-standard-2 28 | os_image: ubuntu2004 29 | execution_time_limit: 30 | hours: 3 31 | blocks: 32 | - name: Linux build 33 | run: 34 | when: "branch = 'master' AND change_in('/', {exclude: ['**/*.md']})" 35 | #execution_time_limit: 36 | # hours: 2 37 | task: 38 | #env_vars: 39 | # $PATH selects /usr/bin/python and /usr/local/bin/pip which are mismatched versions of Python 40 | #- name: PYTHON 41 | # value: python3 42 | #- name: PIP 43 | # value: pip3 44 | prologue: 45 | commands: 46 | - cache restore 47 | # prevents it getting stuck on config merge prompt on installing openssh-client pulling in openssh-server 48 | # 49 | # causes error: 50 | # 51 | # Not replacing deleted config file /etc/ssh/sshd_config 52 | # 53 | #- sudo rm -f /etc/ssh/sshd_config 54 | - export DEBIAN_FRONTEND=noninteractive 55 | - sudo -E apt-get update 56 | - sudo -E apt-get upgrade -y -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confnew" 57 | - sudo dpkg --configure -a --force-confmiss --force-confnew 58 | #- echo "openssh-server openssh-server/conffile-diff select keep" | sudo debconf-set-selections 59 | #- sudo dpkg --configure -a --force-confdef --force-confold 60 | #- sudo apt-get upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" 61 | - sudo apt-get install -y openssh-server 62 | # each job is separate and could be run on a separate machine so all steps must be together 63 | jobs: 64 | - name: build 65 | commands: 66 | - checkout 67 | - setup/ci_bootstrap.sh 68 | - make init 69 | - make ci 70 | - make test 71 | epilogue: 72 | commands: 73 | - cache store 74 | - name: Mac build 75 | run: 76 | when: "branch = 'master'" 77 | task: 78 | # because otherwise on Mac it uses /usr/bin/python (2.7) but /usr/local/bin/pip (python 3.8) 79 | #env_vars: 80 | # to match /usr/local/bin/pip version from $PATH 81 | #- name: PYTHON 82 | # value: python3 83 | # must be quoted to force string, otherwise pipeline fails to run with this parsing error: 84 | # Error: [{"Type mismatch. Expected String but got Integer.", "#/blocks/1/task/env_vars/1/value"}] 85 | #- name: DEBUG 86 | # value: "1" 87 | agent: 88 | # https://docs.semaphoreci.com/reference/machine-types#macos 89 | machine: 90 | type: a1-standard-4 91 | os_image: macos-xcode15 92 | prologue: 93 | commands: 94 | - cache restore 95 | # fix for: 96 | # pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. 97 | - brew install openssl 98 | - brew reinstall python 99 | - brew reinstall wget 100 | # avoid Mac SSL errors: 101 | # 102 | # ERROR: Loading command: install (LoadError) 103 | # dlopen(/Users/semaphore/.rbenv/versions/2.5.1/lib/ruby/2.5.0/x86_64-darwin18/openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib 104 | # Referenced from: /Users/semaphore/.rbenv/versions/2.5.1/lib/ruby/2.5.0/x86_64-darwin18/openssl.bundle 105 | # Reason: image not found - /Users/semaphore/.rbenv/versions/2.5.1/lib/ruby/2.5.0/x86_64-darwin18/openssl.bundle 106 | # ERROR: While executing gem ... (NoMethodError) 107 | # undefined method `invoke_with_build_args' for nil:NilClass# 108 | # 109 | - rbenv global system 110 | # also considered this: 111 | # - for version in $(rbenv versions | grep -v system | sed 's/^\*//'); do yes | rbenv uninstall "$version"; rbenv install "$version"; done 112 | # 113 | # fix for python vs pip version mismatch 114 | - ln -svf -- /usr/local/bin/python3 /usr/local/bin/python 115 | jobs: 116 | - name: build 117 | commands: 118 | - checkout 119 | - make init 120 | - make ci 121 | - make test 122 | epilogue: 123 | commands: 124 | - cache store 125 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # vim:ts=2:sts=2:sw=2:et 2 | # 3 | # Author: Hari Sekhon 4 | # Date: 2014-11-29 01:02:47 +0000 (Sat, 29 Nov 2014) 5 | # 6 | # https://github.com/HariSekhon/DevOps-Golang-tools 7 | # 8 | # License: see accompanying Hari Sekhon LICENSE file 9 | # 10 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 11 | # to help improve or steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | # ============================================================================ # 17 | # T r a v i s C I 18 | # ============================================================================ # 19 | 20 | # https://docs.travis-ci.com/user/customizing-the-build/ 21 | 22 | --- 23 | version: ~> 1.0 24 | 25 | # ============================================= 26 | # https://docs.travis-ci.com/user/languages/go/ 27 | language: go 28 | go: 29 | - 1.x 30 | - 1.9.x 31 | - 1.10.x 32 | - 1.11.x 33 | - 1.12.x 34 | - 1.13.x 35 | - 1.14.x 36 | - 1.15.x 37 | - master 38 | 39 | # ====================================================== 40 | # https://docs.travis-ci.com/user/environment-variables/ 41 | env: 42 | # - DEBUG=1 43 | - DOCKER_COMPOSE_VERSION=1.16.1 44 | 45 | # ============================================== 46 | # https://docs.travis-ci.com/user/notifications/ 47 | notifications: 48 | email: false 49 | 50 | # ================================================================================= 51 | # https://docs.travis-ci.com/user/customizing-the-build/#building-specific-branches 52 | # https://docs.travis-ci.com/user/conditional-builds-stages-jobs 53 | #branches: 54 | # only: 55 | # - master 56 | 57 | # ======================================== 58 | # https://docs.travis-ci.com/user/caching/ 59 | 60 | before_cache: 61 | - rm -f $HOME/.cache/pip/log/debug.log 62 | 63 | cache: 64 | - pip 65 | - directories: 66 | - $HOME/.cache 67 | - $HOME/.cpan 68 | - $HOME/.cpanm 69 | - $HOME/.gem 70 | - $HOME/go/pkg 71 | - pkg 72 | - bash-tools/pytools_checks 73 | 74 | # ============================================== 75 | # https://docs.travis-ci.com/user/job-lifecycle/ 76 | 77 | # avoid package checksum mismatches when installing packages 78 | before_install: 79 | - sudo rm -f "${TRAVIS_ROOT}/etc/apt/apt.conf.d/99-travis-apt-proxy" 80 | - sudo rm -rf "${TRAVIS_ROOT}/var/lib/apt/lists/"* 81 | 82 | install: 83 | - travis_retry make 84 | 85 | script: 86 | - travis_retry make test 87 | 88 | #after_success: 89 | # - coveralls 90 | -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | // vim:ts=4:sts=4:sw=4:et:filetype=groovy:syntax=groovy 2 | // 3 | // Author: Hari Sekhon 4 | // Date: 2017-06-28 12:39:02 +0200 (Wed, 28 Jun 2017) 5 | // 6 | // https://github.com/HariSekhon/DevOps-Golang-tools 7 | // 8 | // License: see accompanying Hari Sekhon LICENSE file 9 | // 10 | // If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 11 | // 12 | // https://www.linkedin.com/in/HariSekhon 13 | // 14 | 15 | // ========================================================================== // 16 | // J e n k i n s P i p e l i n e 17 | // ========================================================================== // 18 | 19 | // Epic Jenkinsfile template: 20 | // 21 | // https://github.com/HariSekhon/Templates/blob/master/Jenkinsfile 22 | 23 | 24 | // Official Documentation: 25 | // 26 | // https://jenkins.io/doc/book/pipeline/syntax/ 27 | // 28 | // https://www.jenkins.io/doc/pipeline/steps/ 29 | // 30 | // https://www.jenkins.io/doc/pipeline/steps/workflow-basic-steps/ 31 | 32 | 33 | pipeline { 34 | // to run on Docker or Kubernetes, see the master Jenkinsfile template listed at the top 35 | agent any 36 | 37 | options { 38 | timestamps() 39 | 40 | timeout(time: 2, unit: 'HOURS') 41 | } 42 | 43 | triggers { 44 | cron('H 10 * * 1-5') 45 | pollSCM('H/2 * * * *') 46 | } 47 | 48 | stages { 49 | stage ('Checkout') { 50 | steps { 51 | checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '', url: 'https://github.com/HariSekhon/DevOps-Golang-tools']]]) 52 | } 53 | } 54 | 55 | stage('Build') { 56 | steps { 57 | echo "Running ${env.JOB_NAME} Build ${env.BUILD_ID} on ${env.JENKINS_URL}" 58 | echo 'Building...' 59 | timeout(time: 10, unit: 'MINUTES') { 60 | retry(3) { 61 | // sh 'apt update -q' 62 | // sh 'apt install -qy make' 63 | // sh 'make init' 64 | sh """ 65 | setup/ci_bootstrap.sh && 66 | make init 67 | """ 68 | } 69 | } 70 | timeout(time: 180, unit: 'MINUTES') { 71 | sh 'make ci' 72 | } 73 | } 74 | } 75 | 76 | stage('Test') { 77 | options { 78 | retry(2) 79 | } 80 | steps { 81 | echo 'Testing...' 82 | timeout(time: 120, unit: 'MINUTES') { 83 | sh 'make test' 84 | } 85 | } 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2020 Hari Sekhon 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: 2013-02-03 10:25:36 +0000 (Sun, 03 Feb 2013) 4 | # 5 | # https://github.com/HariSekhon/DevOps-Golang-tools 6 | # 7 | # License: see accompanying LICENSE file 8 | # 9 | # https://www.linkedin.com/in/HariSekhon 10 | # 11 | 12 | # =================== 13 | # bootstrap commands: 14 | 15 | # setup/bootstrap.sh 16 | # 17 | # OR 18 | # 19 | # Alpine: 20 | # 21 | # apk add --no-cache git make && git clone https://github.com/HariSekhon/DevOps-Golang-tools go-tools && cd go-tools && make 22 | # 23 | # Debian / Ubuntu: 24 | # 25 | # apt-get update && apt-get install -y make git && git clone https://github.com/HariSekhon/DevOps-Golang-tools go-tools && cd go-tools && make 26 | # 27 | # RHEL / CentOS: 28 | # 29 | # yum install -y make git && git clone https://github.com/HariSekhon/DevOps-Golang-tools go-tools && cd go-tools && make 30 | 31 | # =================== 32 | 33 | # would fail bootstrapping on Alpine 34 | #SHELL := /usr/bin/env bash 35 | 36 | ifneq ("$(wildcard bash-tools/Makefile.in)", "") 37 | include bash-tools/Makefile.in 38 | endif 39 | 40 | REPO := HariSekhon/DevOps-Golang-tools 41 | 42 | # must not be a directory with go.mod 43 | export GOPATH := $(HOME)/go 44 | # use default or allow to be overridden by cross-compiling targets (golang-linux, golang-darwin) 45 | ifndef GOBIN 46 | export GOBIN := $(PWD)/bin 47 | endif 48 | 49 | CODE_FILES := $(shell find . -type f -name '*.go' | grep -v -e bash-tools -e /lib/ -e /src/) 50 | 51 | .PHONY: build 52 | build: init 53 | @echo ========================= 54 | @echo DevOps Golang Tools Build 55 | @echo ========================= 56 | @$(MAKE) git-summary 57 | 58 | @#$(MAKE) system-packages-golang 59 | # provides OS specific build packages for compiling golang modules, such as gcc, and distro specific stdlib packages, build-essential on debian/ubuntu etc 60 | $(MAKE) system-packages 61 | @bash-tools/packages/install_packages_if_absent.sh golang 62 | 63 | $(MAKE) golang 64 | 65 | .PHONY: init 66 | init: 67 | git submodule update --init --recursive 68 | 69 | .PHONY: golang 70 | golang: golang-version 71 | ./compile.sh 72 | @echo 'BUILD SUCCESSFUL (go-tools)' 73 | 74 | .PHONY: go 75 | go: golang 76 | @: 77 | 78 | .PHONY: golang-mac 79 | golang-mac: golang-darwin 80 | @: 81 | 82 | .PHONY: golang-darwin 83 | golang-darwin: 84 | GOOS=darwin GOARCH=amd64 GOBIN="$$GOPATH/bin.darwin.amd64" $(MAKE) golang 85 | 86 | .PHONY: darwin 87 | darwin: golang-darwin 88 | @: 89 | 90 | # doesn't work yet, issues with -race and also runtime/cgo(__TEXT/__text): relocation target x_cgo_inittls not defined 91 | .PHONY: golang-linux 92 | golang-linux: 93 | GOOS=linux GOARCH=amd64 GOBIN="$$GOPATH/bin.linux.amd64" CGO_ENABLED=1 $(MAKE) golang 94 | 95 | .PHONY: linux 96 | linux: golang-linux 97 | @: 98 | 99 | .PHONY: test-lib 100 | test-lib: 101 | cd lib && $(MAKE) test 102 | 103 | .PHONY: test 104 | test: # test-lib 105 | tests/all.sh 106 | 107 | .PHONY: basic-test 108 | basic-test: test-lib 109 | bash-tools/checks/check_all.sh 110 | 111 | .PHONY: install 112 | install: build 113 | @echo "No installation needed, just add '$(PWD)' to your \$$PATH" 114 | 115 | .PHONY: clean 116 | clean: go-clean 117 | @rm -vfr bin bin.darwin.amd64 bin.linux.amd64 118 | 119 | .PHONY: deep-clean 120 | deep-clean: clean 121 | @#cd go-lib && $(MAKE) deep-clean 122 | @echo "Deep cleaning, removing pkg/*" 123 | @rm -fr pkg/* 124 | 125 | # ============================================================================ # 126 | # I n d i v i d u a l B u i l d s 127 | # ============================================================================ # 128 | 129 | # Classic Make - individual binaries targets with no-rebuild without clean 130 | 131 | # Magic to create dynamic targets 132 | %:: %.go 133 | @$(MAKE) bin/$@ 134 | %.go: % 135 | @#$(MAKE) $< 136 | # :: means terminal - don't call implicit %.go target, just require the file exists in order for this dynamic target 137 | bin/%:: %.go 138 | go install -race $< 139 | 140 | 141 | .PHONY: all 142 | all: colors httpfirst uniq2 welcome 143 | @: 144 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | # vim:ts=2:sts=2:sw=2:et 2 | # 3 | # Author: Hari Sekhon 4 | # Date: Sun Feb 23 19:02:10 2020 +0000 5 | # 6 | # https://github.com/HariSekhon/DevOps-Golang-tools 7 | # 8 | # License: see accompanying Hari Sekhon LICENSE file 9 | # 10 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback 11 | # to help improve or steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | # ============================================================================ # 17 | # A z u r e D e v O p s P i p e l i n e 18 | # ============================================================================ # 19 | 20 | # https://aka.ms/yaml 21 | 22 | trigger: 23 | - master 24 | 25 | variables: 26 | # ubuntu version 27 | os_version: '22.04' 28 | 29 | pool: 30 | # there is no /dev/stderr on this azure build! 31 | #vmImage: 'ubuntu-latest' 32 | #vmImage: 'ubuntu-22.04' 33 | vmImage: 'ubuntu-$(os_version)' 34 | 35 | # unprivileged container without sudo, cannot install dependencies 36 | #container: ubuntu:22.04 37 | 38 | steps: 39 | - script: cat /etc/*-release 40 | displayName: OS Release 41 | 42 | # requires script as first key, otherwise parsing breaks with error message: Unexpected value 'displayName' 43 | - script: env | sort 44 | displayName: Environment 45 | 46 | # doesn't work in container due to unprivileged execution and lack of sudo 47 | #- script: sudo apt-get update && sudo apt-get install -y git make 48 | # displayName: install git & make 49 | 50 | #- script: make 51 | # displayName: build 52 | 53 | # doesn't work in vmImage build due to lack of access to normal /dev/stderr device 54 | # tee: /dev/stderr: No such device or address 55 | #- script: make test 56 | # displayName: test 57 | 58 | # hacky workaround to Azure Pipelines ubuntu environment limitations of unprivileged container and no /dev/stderr in vmImage :-( 59 | - script: | 60 | sudo docker run -v "$PWD":/code "ubuntu:$(os_version)" /bin/bash -c ' 61 | set -ex 62 | cd /code 63 | setup/ci_bootstrap.sh 64 | if [ -x setup/ci_git_set_dir_safe.sh ]; then 65 | setup/ci_git_set_dir_safe.sh 66 | fi 67 | make init 68 | make ci test 69 | ' 70 | displayName: docker build 71 | -------------------------------------------------------------------------------- /bitbucket-pipelines.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: 2020-02-24 17:08:57 +0000 (Mon, 24 Feb 2020) 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | # ============================================================================ # 17 | # B i t b u c k e t C I / C D P i p e l i n e 18 | # ============================================================================ # 19 | 20 | # Reference: 21 | # 22 | # https://support.atlassian.com/bitbucket-cloud/docs/configure-bitbucket-pipelinesyml/ 23 | 24 | # Languages: 25 | # 26 | # https://confluence.atlassian.com/x/5Q4SMw 27 | 28 | # You can specify a custom docker image from Docker Hub as your build environment. 29 | image: atlassian/default-image:2 30 | 31 | pipelines: 32 | default: 33 | - step: 34 | script: 35 | - setup/ci_bootstrap.sh 36 | - make init 37 | - make ci 38 | - make test 39 | -------------------------------------------------------------------------------- /boot: -------------------------------------------------------------------------------- 1 | setup/bootstrap.sh -------------------------------------------------------------------------------- /buddy.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: 2020-03-16 14:02:53 +0000 (Mon, 16 Mar 2020) 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | # ============================================================================ # 17 | # B u d d y C I 18 | # ============================================================================ # 19 | 20 | # https://buddy.works/docs/yaml/yaml-schema 21 | 22 | --- 23 | - pipeline: "Build" 24 | trigger_mode: "ON_EVERY_PUSH" 25 | ref_name: "master" 26 | ref_type: "BRANCH" 27 | target_site_url: "https://github.com/HariSekhon/DevOps-Golang-tools" 28 | trigger_condition: "ALWAYS" 29 | actions: 30 | - action: "Execute: make ci test" 31 | type: "BUILD" 32 | working_directory: "/buddy/DevOps-Golang-tools" 33 | docker_image_name: "library/ubuntu" 34 | docker_image_tag: "18.04" 35 | #setup_commands: 36 | # this step gets cached, which results in 37 | # E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? 38 | # - apt update 39 | # - apt install -qy git make 40 | execute_commands: 41 | - setup/ci_bootstrap.sh 42 | - make init 43 | - make ci 44 | - make test 45 | volume_mappings: 46 | - "/:/buddy/DevOps-Golang-tools" 47 | shell: "BASH" 48 | trigger_condition: "ALWAYS" 49 | -------------------------------------------------------------------------------- /cicd/.concourse.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: 2020-03-21 11:06:48 +0000 (Sat, 21 Mar 2020) 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | # ============================================================================ # 17 | # C o n c o u r s e C I 18 | # ============================================================================ # 19 | 20 | # https://concourse-ci.org/golang-library-example.html 21 | 22 | # https://resource-types.concourse-ci.org/ 23 | # https://concourse-ci.org/resource-types.html 24 | resources: 25 | - name: github 26 | icon: github-circle 27 | type: git 28 | source: 29 | uri: https://github.com/HariSekhon/DevOps-Golang-tools 30 | branch: master 31 | #- name: daily 32 | # type: time 33 | # source: 34 | # interval: 1d 35 | 36 | # https://concourse-ci.org/jobs.html 37 | jobs: 38 | - name: build 39 | public: false 40 | plan: 41 | - get: github # from resource above 42 | trigger: true 43 | #version: every # build every git commit, default: latest 44 | - task: build 45 | config: 46 | platform: linux 47 | image_resource: 48 | type: docker-image 49 | source: 50 | repository: ubuntu 51 | tag: latest 52 | inputs: 53 | - name: github 54 | path: code 55 | params: 56 | CONCOURSE: 1 57 | run: 58 | path: /bin/bash 59 | args: 60 | - -c 61 | - | 62 | cd code && 63 | setup/ci_bootstrap.sh && 64 | make init && 65 | make ci test 66 | -------------------------------------------------------------------------------- /cicd/.gocd.yml: -------------------------------------------------------------------------------- 1 | # vim:ts=2:sts=2:sw=2:et 2 | # 3 | # Author: Hari Sekhon 4 | # Date: 2020-03-21 11:14:07 +0000 (Sat, 21 Mar 2020) 5 | # 6 | # https://github.com/HariSekhon/DevOps-Golang-tools 7 | # 8 | # License: see accompanying Hari Sekhon LICENSE file 9 | # 10 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help improve or steer this or other code I publish 11 | # 12 | # https://www.linkedin.com/in/HariSekhon 13 | # 14 | 15 | # ============================================================================ # 16 | # G o C D 17 | # ============================================================================ # 18 | 19 | # https://github.com/tomzo/gocd-yaml-config-plugin#setup 20 | 21 | # https://docs.gocd.org/current/configuration/configuration_reference.html 22 | 23 | --- 24 | format_version: 3 25 | pipelines: 26 | DevOps-Golang-tools: 27 | group: defaultGroup 28 | label_template: ${COUNT} 29 | lock_behavior: none 30 | display_order: -1 31 | materials: 32 | git: 33 | git: https://github.com/HariSekhon/DevOps-Golang-tools 34 | shallow_clone: false 35 | auto_update: true 36 | branch: master 37 | stages: 38 | - build-and-test: 39 | fetch_materials: true 40 | keep_artifacts: false 41 | clean_workspace: false 42 | approval: 43 | type: success 44 | allow_only_on_success: false 45 | jobs: 46 | #apt-update: 47 | # timeout: 10 48 | # tasks: 49 | # - exec: 50 | # command: apt 51 | # arguments: 52 | # - update 53 | # run_if: passed 54 | #install-make: 55 | # timeout: 10 56 | # tasks: 57 | # - exec: 58 | # command: apt 59 | # arguments: 60 | # - install 61 | # - -qy 62 | # - git 63 | # - make 64 | # run_if: passed 65 | ci-bootstrap: 66 | timeout: 10 67 | tasks: 68 | - exec: 69 | command: setup/ci_bootstrap.sh 70 | run_if: passed 71 | init: 72 | timeout: 10 73 | tasks: 74 | - exec: 75 | command: make 76 | arguments: 77 | - init 78 | run_if: passed 79 | build: 80 | timeout: 60 81 | tasks: 82 | - exec: 83 | command: make 84 | arguments: 85 | - ci 86 | run_if: passed 87 | test: 88 | timeout: 60 89 | tasks: 90 | - exec: 91 | command: make 92 | arguments: 93 | - test 94 | run_if: passed 95 | -------------------------------------------------------------------------------- /cicd/buildspec.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: 2020-12-19 15:32:28 +0000 (Sat, 19 Dec 2020) 4 | # 5 | # https://github.com/HariSekhon/DevOps-Golang-tools 6 | # 7 | # License: see accompanying Hari Sekhon LICENSE file 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | # ============================================================================ # 15 | # A W S C o d e B u i l d 16 | # ============================================================================ # 17 | 18 | # References: 19 | # 20 | # https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html 21 | 22 | # Operating System should be set to Ubuntu, not Amazon Linux 2 23 | # - this is both recommended since programming language runtimes are now included in standard image of ubuntu, but also to avoid this error: 24 | # 25 | # /usr/bin/amazon-linux-extras 26 | # /root/.pyenv/versions/3.8.3/bin/python: No module named amazon_linux_extras 27 | 28 | version: 0.2 29 | 30 | # only on Linux, the user to run as - global setting, alternatively set inside a phase section below for localized user 31 | #run-as: linux-username 32 | 33 | env: 34 | shell: bash 35 | # don't store sensitive stuff like AWS secret keys in variables, use parameter-store or secrets-manager 36 | # any environment variables replace existing environment variables, ie. beware if setting PATH that it'll replace the existing PATH with a non-interpolated literal 37 | # project env vars take precedence over these, with start build vars taking highest precedence 38 | #variables: 39 | # DEBUG: "1" 40 | #exported-variables: 41 | # - DEBUG 42 | 43 | phases: 44 | # install prerequisites / languages / frameworks / packages to allow build to work 45 | install: 46 | #commands: 47 | # - setup/ci_bootstrap.sh 48 | # languages to install 49 | runtime-versions: 50 | #java: openjdk11 51 | # AWS LTS release of OpenJDK 11 52 | java: corretto11 53 | golang: 1.14 54 | python: 3.8 55 | ruby: 2.7 56 | # eg. sign in to Amazon ECR or install package dependencies 57 | pre_build: 58 | commands: 59 | - setup/ci_bootstrap.sh 60 | build: 61 | commands: 62 | - echo Build started on `date` 63 | - make 64 | - echo Build completed on `date` 65 | - make test 66 | - echo Tests completed on `date` 67 | -------------------------------------------------------------------------------- /cicd/cloudbuild.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: 2020-12-19 16:27:26 +0000 (Sat, 19 Dec 2020) 4 | # 5 | # https://github.com/HariSekhon/DevOps-Golang-tools 6 | # 7 | # License: see accompanying Hari Sekhon LICENSE file 8 | # 9 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 10 | # 11 | # https://www.linkedin.com/in/HariSekhon 12 | # 13 | 14 | # ============================================================================ # 15 | # G C P C l o u d B u i l d 16 | # ============================================================================ # 17 | 18 | # References: 19 | # 20 | # https://cloud.google.com/cloud-build/docs/build-config 21 | # 22 | # https://cloud.google.com/cloud-build/docs/build-debug-locally 23 | 24 | 25 | # gcloud builds submit --config cloudbuild.yaml . 26 | # 27 | # cloud-build-local --config cloudbuild.yml --dryrun=false . 28 | 29 | # tars $PWD to bucket called ${PROJECT_ID}_cloudbuild 30 | 31 | timeout: 3660s 32 | 33 | steps: 34 | - name: ubuntu:18.04 35 | entrypoint: bash 36 | args: 37 | - '-c' 38 | - | 39 | setup/ci_bootstrap.sh && 40 | make build test 41 | timeout: 3600s 42 | -------------------------------------------------------------------------------- /codefresh.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: 2020-02-24 17:43:07 +0000 (Mon, 24 Feb 2020) 4 | # 5 | # vim:ts=2:sts=2:sw=2:et 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | # ============================================================================ # 17 | # C o d e f r e s h C I 18 | # ============================================================================ # 19 | 20 | # https://codefresh.io/docs/docs/codefresh-yaml/ 21 | 22 | version: "1.0" 23 | stages: 24 | - "checkout" 25 | - "build" 26 | steps: 27 | checkout: 28 | type: "git-clone" 29 | description: "Cloning main repository..." 30 | repo: '${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}' 31 | revision: "${{CF_REVISION}}" 32 | stage: "checkout" 33 | build: 34 | title: Running docker image 35 | type: freestyle 36 | working_directory: '${{CF_REPO_NAME}}' 37 | arguments: 38 | image: 'ubuntu:18.04' 39 | commands: 40 | - setup/ci_bootstrap.sh 41 | - make init 42 | - make ci 43 | - make test 44 | -------------------------------------------------------------------------------- /colors.go: -------------------------------------------------------------------------------- 1 | ///bin/sh -c true; exec /usr/bin/env go run "$0" "$@" 2 | // vim:ts=4:sts=4:sw=4:noet 3 | // 4 | // Author: Hari Sekhon 5 | // Date: 2020-06-04 15:11:25 +0100 (Thu, 04 Jun 2020) 6 | // Original Date: 2014-06-07 22:17:09 +0100 (Sat, 07 Jun 2014) 7 | // Ported from Perl version in DevOps Perl tools repo 8 | // 9 | // https://github.com/HariSekhon/DevOps-Golang-tools 10 | // 11 | // License: see accompanying Hari Sekhon LICENSE file 12 | // 13 | // If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 14 | // 15 | // https://www.linkedin.com/in/HariSekhon 16 | // 17 | 18 | package main 19 | 20 | import ( 21 | "flag" 22 | "fmt" 23 | //"log" 24 | log "github.com/sirupsen/logrus" 25 | "os" 26 | "path" 27 | ) 28 | 29 | const description = ` 30 | Program to show all the ASCII terminal code Foreground/Background color combinations in a terminal to make it easy to pick for writing fancy programs 31 | 32 | Ported from an original Perl version from 2014 in the DevOps Perl tools repo: https://github.com/HariSekhon/DevOps-Perl-tools 33 | 34 | Tested on Mac OS X and Linux 35 | ` 36 | 37 | var prog = path.Base(os.Args[0]) 38 | 39 | // effects 4 = underline, 5 = blink, look ugly - added only in verbose mode 40 | var effects = []int{0, 1} 41 | 42 | const text = "hari" 43 | const length = len(text) + 2 44 | 45 | func main() { 46 | flag.Usage = func() { 47 | fmt.Fprintf(os.Stderr, "%s\n\nusage: %s [options]\n\n", description, prog) 48 | flag.PrintDefaults() 49 | os.Exit(3) 50 | } 51 | var debug = flag.Bool("D", false, "Debug mode") 52 | var verbose = flag.Bool("v", false, "Verbose mode (print underlines and blinking effects too)") 53 | flag.Parse() 54 | if *debug || os.Getenv("DEBUG") != "" { 55 | log.SetLevel(log.DebugLevel) 56 | log.Debug("debug logging enabled") 57 | } 58 | 59 | if *verbose { 60 | effects = []int{0, 1, 4, 5} 61 | } 62 | fmt.Println() 63 | fmt.Println(`ASCII Terminal Codes Color Key: 64 | 65 | EF = Effect [1 = bold, 4 = underline, 5 = blink (only shown in verbose mode)] 66 | TXT = Foreground text color 67 | BG = Background solid color 68 | `) 69 | 70 | headerFormatString := fmt.Sprintf("%5s BG %%-%ds", "", length) 71 | fmt.Printf(headerFormatString, "none") 72 | for bg := 40; bg <= 47; bg++ { 73 | formatString := fmt.Sprintf(" %%%ddm ", length-1) 74 | fmt.Printf(formatString, bg) 75 | } 76 | fmt.Printf("\n%5s\n", "EF;TXT") 77 | printLine(0) 78 | printLine(1) 79 | for txtcode := 30; txtcode <= 37; txtcode++ { 80 | printLine(txtcode) 81 | } 82 | fmt.Println() 83 | } 84 | 85 | func printLine(txtcode int) { 86 | var effectTxt string 87 | for _, effect := range effects { 88 | if effect == 0 { 89 | effectTxt = fmt.Sprintf("%d", txtcode) 90 | } else { 91 | effectTxt = fmt.Sprintf("%d;%d", effect, txtcode) 92 | } 93 | fmt.Printf(" %4sm ", effectTxt) 94 | fmt.Printf("\033[0m\033[%dm %s \033[0m ", txtcode, text) 95 | for bg := 40; bg <= 47; bg++ { 96 | fmt.Printf("\033[%d;%dm\033[%dm %s \033[0m ", effect, txtcode, bg, text) 97 | } 98 | fmt.Println() 99 | if txtcode == 0 || txtcode == 1 { 100 | break 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /compile.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # vim:ts=4:sts=4:sw=4:et 3 | # 4 | # Author: Hari Sekhon 5 | # Date: 2021-01-01 22:07:48 +0000 (Fri, 01 Jan 2021) 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | set -euo pipefail 17 | [ -n "${DEBUG:-}" ] && set -x 18 | srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 19 | 20 | # shellcheck disable=SC1090 21 | . "$srcdir/bash-tools/lib/utils.sh" 22 | 23 | # shellcheck disable=SC2034,SC2154 24 | usage_description=" 25 | Compiles Go programs in the adjacent directory 26 | 27 | Handles different versions of Golang to work with older versions 28 | 29 | - go get's dependencies from go.mod manually if the Golang version doesn't support 'go mod' 30 | " 31 | 32 | # used by usage() in lib/utils.sh 33 | # shellcheck disable=SC2034 34 | usage_args="" 35 | 36 | help_usage "$@" 37 | 38 | cd "$srcdir" 39 | 40 | # must not be a directory with go.mod 41 | export GOPATH=~/go 42 | export GOBIN="${GOBIN:-$PWD/bin}" 43 | 44 | if ! is_golang_min_version 1.9; then 45 | echo "Golang version is < 1.9, downloading newer version" 46 | echo 47 | "$srcdir/bash-tools/install/install_golang.sh" 48 | export PATH="$HOME/bin/go/bin:$PATH" 49 | export GOROOT="$HOME/bin/go" 50 | fi 51 | 52 | readlink_go="$(readlink -f "$(command -v go)")" 53 | 54 | # fix for GitHub Actions Ubuntu latest which has broken environment: 55 | # 56 | # GOROOT="/opt/hostedtoolcache/go/1.14.13/x64" 57 | # 58 | # but first in $PATH: 59 | # 60 | # /usr/bin/go -> /usr/lib/go-1.10/bin/go 61 | # 62 | if [[ "$readlink_go" =~ /go-.+/bin/go$ ]]; then 63 | export GOROOT="${readlink_go%/bin/go}" 64 | fi 65 | 66 | echo 67 | echo "go env:" 68 | echo 69 | go env 70 | echo 71 | echo "GOPATH = ${GOPATH:-}" 72 | echo "GOBIN = ${GOBIN:-}" 73 | echo 74 | # which is better than command -v, ensure executable 75 | # shellcheck disable=SC2230 76 | command -v go 77 | ls -l "$readlink_go" 78 | echo 79 | go version 80 | echo 81 | echo 82 | 83 | # for older versions of Go that don't support 'go mod' 84 | if ! go help mod &>/dev/null; then 85 | awk '/require/{gsub("v", "", $3); print $2}' go.mod | 86 | xargs -L 1 go get 87 | echo 88 | else 89 | # golang 1.11.13 seems to fail, try to download deps explicitly 90 | echo "go mod download" 91 | go mod download 92 | echo 93 | fi 94 | 95 | opts=() 96 | # race detector doesn't work with musl on Alpine 97 | if ! grep -qi Alpine /etc/*release &>/dev/null; then 98 | opts+=(-race) 99 | fi 100 | 101 | for x in *.go; do 102 | #echo "go build -race -o bin/ $x"; 103 | #go build -race -o bin/ "$x" || 104 | echo "go install ${opts[*]} $x"; 105 | go install "${opts[@]}" "$x" 106 | echo 107 | done 108 | echo "Golang compile succeeded" 109 | -------------------------------------------------------------------------------- /diffnet.go: -------------------------------------------------------------------------------- 1 | ///bin/sh -c true; exec /usr/bin/env go run "$0" "$@" 2 | // vim:ts=4:sts=4:sw=4:noet 3 | // 4 | // Author: Hari Sekhon 5 | // Date: 2024-08-19 08:51:51 +0200 (Mon, 19 Aug 2024) 6 | // Original Date: 2012-12-29 10:53:23 +0000 (Sat, 29 Dec 2012) 7 | // 8 | // https///github.com/HariSekhon/DevOps-Golang-tools 9 | // 10 | // License: see accompanying Hari Sekhon LICENSE file 11 | // 12 | // If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 13 | // 14 | // https://www.linkedin.com/in/HariSekhon 15 | // 16 | 17 | /* 18 | * Filter program to print net line additions/removals from diff / patch files or stdin" 19 | * 20 | * This is a rewrite of a perl version I used for over a decade from 21 | * 22 | * https://github.com/HariSekhon/DevOps-Perl-tools 23 | * 24 | * which was itself was a rewrite of a shell version I used for years before that in my extensive 25 | * and borderline ridiculously over developed but immensely cool bashrc 26 | * (nearly 4500 lines at the time I've split this off) 27 | * (6500 with aliases files + an additional 21,000 lines of supporting scripts) 28 | * that eventually evolved into this huge repo: 29 | * 30 | * https://github.com/HariSekhon/DevOps-Bash-tools 31 | * 32 | */ 33 | 34 | // TODO: use counters so that I don't discount 2 removals for 1 addition etc 35 | 36 | package main 37 | 38 | import ( 39 | "bufio" 40 | "flag" 41 | "fmt" 42 | "log" 43 | "os" 44 | "regexp" 45 | "sort" 46 | "strings" 47 | ) 48 | 49 | // Command line options 50 | var ( 51 | additionsOnly = flag.Bool("a", false, "Show only additions") 52 | removalsOnly = flag.Bool("r", false, "Show only removals") 53 | blocks = flag.Bool("b", false, "Show changes in blocks of additions first and then removals") 54 | ignoreCase = flag.Bool("i", false, "Ignore case in comparisons") 55 | ignoreWhitespace = flag.Bool("w", false, "Ignore whitespace in comparisons") 56 | addPrefix string 57 | removePrefix string 58 | ignoreWhitespaceRe = regexp.MustCompile(`\s+`) 59 | ) 60 | 61 | // Utility functions for case and whitespace handling 62 | func transformations(str string) string { 63 | if *ignoreCase { 64 | str = strings.ToLower(str) 65 | } 66 | if *ignoreWhitespace { 67 | str = ignoreWhitespaceRe.ReplaceAllString(str, "") 68 | } 69 | return str 70 | } 71 | 72 | // Process a diff file and collect additions and removals 73 | func diffnet(scanner *bufio.Scanner) { 74 | additions := make(map[int]string) 75 | removals := make(map[int]string) 76 | 77 | lineNum := 0 78 | for scanner.Scan() { 79 | line := scanner.Text() 80 | lineNum++ 81 | 82 | if strings.HasPrefix(line, "---") || strings.HasPrefix(line, "+++") || strings.HasPrefix(line, "@@") { 83 | continue 84 | } 85 | 86 | // Detect prefixes if not yet set 87 | if addPrefix == "" && (strings.HasPrefix(line, "+") || strings.HasPrefix(line, ">")) { 88 | addPrefix = string(line[0]) 89 | } 90 | if removePrefix == "" && (strings.HasPrefix(line, "-") || strings.HasPrefix(line, "<")) { 91 | removePrefix = string(line[0]) 92 | } 93 | 94 | if (strings.HasPrefix(line, "+") || strings.HasPrefix(line, ">")) { 95 | additions[lineNum] = line[1:] 96 | } else if (strings.HasPrefix(line, "-") || strings.HasPrefix(line, "<")) { 97 | removals[lineNum] = line[1:] 98 | } 99 | } 100 | 101 | // Output based on flags 102 | if *blocks || *additionsOnly || *removalsOnly { 103 | if !*removalsOnly { 104 | printChanges(additions, removals, addPrefix) 105 | } 106 | if !*additionsOnly { 107 | printChanges(removals, additions, removePrefix) 108 | } 109 | } else { 110 | printCombinedChanges(additions, removals) 111 | } 112 | } 113 | 114 | // Print additions or removals based on flag settings 115 | func printChanges(main, opposite map[int]string, prefix string) { 116 | keys := sortedKeys(main) 117 | for _, i := range keys { 118 | // Print if not found in the opposite map (removals for additions, etc.) 119 | if !containsTransform(opposite, main[i]) { 120 | fmt.Println(prefix + main[i]) 121 | } 122 | } 123 | } 124 | 125 | // Print combined changes when both additions and removals are processed together 126 | func printCombinedChanges(additions, removals map[int]string) { 127 | allKeys := append(sortedKeys(additions), sortedKeys(removals)...) 128 | sort.Ints(allKeys) 129 | seen := make(map[int]bool) 130 | for _, i := range allKeys { 131 | if seen[i] { 132 | continue 133 | } 134 | seen[i] = true 135 | if add, ok := additions[i]; ok { 136 | if !containsTransform(removals, add) { 137 | fmt.Println(addPrefix + add) 138 | } 139 | } else if rem, ok := removals[i]; ok { 140 | if !containsTransform(additions, rem) { 141 | fmt.Println(removePrefix + rem) 142 | } 143 | } 144 | } 145 | } 146 | 147 | // Check if a transformed string exists in the map 148 | func containsTransform(data map[int]string, value string) bool { 149 | transformedValue := transformations(value) 150 | for _, v := range data { 151 | if transformations(v) == transformedValue { 152 | return true 153 | } 154 | } 155 | return false 156 | } 157 | 158 | // Get sorted keys of a map (line numbers) 159 | func sortedKeys(data map[int]string) []int { 160 | keys := make([]int, 0, len(data)) 161 | for k := range data { 162 | keys = append(keys, k) 163 | } 164 | sort.Ints(keys) 165 | return keys 166 | } 167 | 168 | func main() { 169 | flag.Parse() 170 | 171 | if *additionsOnly && *removalsOnly { 172 | log.Fatal("Error: --additions-only and --removals-only are mutually exclusive!") 173 | } 174 | 175 | if flag.NArg() == 0 { 176 | // Read from stdin 177 | scanner := bufio.NewScanner(os.Stdin) 178 | diffnet(scanner) 179 | } else { 180 | // Read from provided files 181 | for _, filename := range flag.Args() { 182 | file, err := os.Open(filename) 183 | if err != nil { 184 | log.Fatalf("Error opening file %s: %v", filename, err) 185 | } 186 | defer file.Close() 187 | 188 | scanner := bufio.NewScanner(file) 189 | diffnet(scanner) 190 | } 191 | } 192 | } 193 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/harisekhon/go-tools 2 | 3 | go 1.14 4 | 5 | require github.com/sirupsen/logrus v1.6.0 6 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 2 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 3 | github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= 4 | github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= 5 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 6 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 7 | github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= 8 | github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= 9 | github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= 10 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 11 | golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc= 12 | golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 13 | -------------------------------------------------------------------------------- /httpfirst.go: -------------------------------------------------------------------------------- 1 | ///bin/sh -c true; exec /usr/bin/env go run "$0" "$@" 2 | // vim:ts=4:sts=4:sw=4:noet 3 | // args: duckduckgo.com google.com 4 | // 5 | // Author: Hari Sekhon 6 | // Date: 2020-05-17 16:07:00 +0100 (Sun, 17 May 2020) 7 | // 8 | // https://github.com/HariSekhon/DevOps-Golang-tools 9 | // 10 | // License: see accompanying Hari Sekhon LICENSE file 11 | // 12 | // If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 13 | // 14 | // https://www.linkedin.com/in/HariSekhon 15 | // 16 | 17 | package main 18 | 19 | import ( 20 | "flag" 21 | "fmt" 22 | log "github.com/sirupsen/logrus" 23 | "io/ioutil" 24 | "net/http" 25 | "os" 26 | "path" 27 | "regexp" 28 | ) 29 | 30 | const description = ` 31 | Returns the first HTTP(s) server argument to respond and serve its default page without error 32 | 33 | See also much more mature version find_active_server.py in DevOps Python tools - https://github.com/HariSekhon/DevOps-Python-tools 34 | ` 35 | 36 | var prog = path.Base(os.Args[0]) 37 | 38 | func main() { 39 | flag.Usage = func() { 40 | fmt.Fprintf(os.Stderr, "%s\n\nusage: %s [ ...]\n\n", description, prog) 41 | flag.PrintDefaults() 42 | os.Exit(3) 43 | } 44 | var debug = flag.Bool("D", false, "Debug mode") 45 | flag.Parse() 46 | if *debug || os.Getenv("DEBUG") != "" { 47 | log.SetLevel(log.DebugLevel) 48 | log.Debug("debug logging enabled") 49 | } 50 | 51 | //urls := os.Args[1:] 52 | urls := flag.Args() 53 | if len(urls) < 1 { 54 | //fmt.Printf("usage: %s [ ...]\n", path.Base(os.Args[0])) 55 | //os.Exit(3) 56 | flag.Usage() 57 | } 58 | for _, url := range urls { 59 | matched, _ := regexp.MatchString("^-", url) 60 | if matched { 61 | flag.Usage() 62 | } 63 | } 64 | 65 | results := make(chan string) 66 | 67 | httpPrefixRegex := regexp.MustCompile("(?i)^https?://") 68 | 69 | for _, url := range urls { 70 | if !httpPrefixRegex.MatchString(url) { 71 | url = "http://" + url 72 | } 73 | go getURL(url, results) 74 | } 75 | // print first result 76 | // will hang if none succeed - add timeout and more professional handlings like my find_active_server.py program 77 | fmt.Println(<-results) 78 | } 79 | 80 | func getURL(url string, results chan string) { 81 | res, err := http.Get(url) 82 | if err != nil { 83 | // ignore 84 | //panic(err) 85 | return 86 | } 87 | defer res.Body.Close() 88 | 89 | _, err = ioutil.ReadAll(res.Body) 90 | if err != nil { 91 | // ignore 92 | //panic(err) 93 | return 94 | } 95 | results <- url 96 | } 97 | -------------------------------------------------------------------------------- /kics.config: -------------------------------------------------------------------------------- 1 | # 2 | # Author: Hari Sekhon 3 | # Date: 2023-05-05 18:05:53 +0100 (Fri, 05 May 2023) 4 | # 5 | # vim:ts=2:sts=2:sw=2:et:filetype=yaml 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | # ============================================================================ # 17 | # K i c s C o n f i g 18 | # ============================================================================ # 19 | 20 | # https://github.com/Checkmarx/kics/blob/master/docs/configuration-file.md 21 | 22 | --- 23 | #path: assets/iac_samples 24 | verbose: true 25 | log-file: true 26 | #type: 27 | # - Dockerfile 28 | # - Kubernetes 29 | #queries-path: "assets/queries" 30 | exclude-paths: 31 | # ignore submodules - handle them in the source repos only 32 | - bash-tools/ 33 | - github-actions/ 34 | - haproxy-configs/ 35 | - jenkins/ 36 | - kubernetes-templates/ 37 | - lib/ 38 | - pylib/ 39 | - spotify-tools/ 40 | - sql/ 41 | - sql-keywords/ 42 | - templates/ 43 | - terraform-templates/ 44 | #output-path: "results" 45 | -------------------------------------------------------------------------------- /pldd.go: -------------------------------------------------------------------------------- 1 | ///bin/sh -c true; exec /usr/bin/env go run "$0" "$@" 2 | // vim:ts=4:sts=4:sw=4:noet 3 | // 4 | // Author: Hari Sekhon 5 | // Date: 2024-09-16 02:22:33 +0200 (Mon, 16 Sep 2024) 6 | // 7 | // https///github.com/HariSekhon/DevOps-Golang-tools 8 | // 9 | // License: see accompanying Hari Sekhon LICENSE file 10 | // 11 | // If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 12 | // 13 | // https://www.linkedin.com/in/HariSekhon 14 | // 15 | 16 | package main 17 | 18 | import ( 19 | "bufio" 20 | "flag" 21 | "fmt" 22 | "io/ioutil" 23 | "os" 24 | "path" 25 | "path/filepath" 26 | "strconv" 27 | "strings" 28 | ) 29 | 30 | const description = ` 31 | On Linux parses the /proc//maps to list all dyanmic so libraries that a program is using 32 | 33 | The runtime equivalent of the classic Linux ldd command 34 | 35 | Because sometimes the system pldd command gives results like this: 36 | 37 | pldd: cannot attach to process 32781: Operation not permitted 38 | ` 39 | 40 | var prog = path.Base(os.Args[0]) 41 | 42 | func main() { 43 | flag.Usage = func() { 44 | fmt.Fprintf(os.Stderr, "%s\n\nusage: %s \n\n", description, prog) 45 | flag.PrintDefaults() 46 | os.Exit(3) 47 | } 48 | flag.Parse() 49 | args := flag.Args() 50 | 51 | if len(args) != 1 { 52 | flag.Usage() 53 | } 54 | 55 | pid := args[0] 56 | 57 | if !isNumeric(pid) { 58 | fmt.Printf("Error: PID '%s' is not a valid number.\n", pid) 59 | os.Exit(1) 60 | } 61 | 62 | // Get the maximum possible PID from the system 63 | maxPid, err := getMaxPid() 64 | if err != nil { 65 | fmt.Printf("Error reading max PID: %v\n", err) 66 | os.Exit(1) 67 | } 68 | 69 | // Convert PID to integer and validate range 70 | pidNum, err := strconv.Atoi(pid) 71 | if err != nil || pidNum <= 0 || pidNum > maxPid { 72 | fmt.Printf("Error: PID '%s' is not in the valid range of 1 to %d.\n", pid, maxPid) 73 | os.Exit(1) 74 | } 75 | 76 | procMapsPath := fmt.Sprintf("/proc/%s/maps", pid) 77 | 78 | file, err := os.Open(procMapsPath) 79 | if err != nil { 80 | fmt.Printf("Failed to open %s: %v\n", procMapsPath, err) 81 | return 82 | } 83 | defer file.Close() 84 | 85 | // use a map to dedupe .so libraries 86 | soFiles := make(map[string]bool) 87 | 88 | scanner := bufio.NewScanner(file) 89 | for scanner.Scan() { 90 | line := scanner.Text() 91 | fields := strings.Fields(line) 92 | if len(fields) == 0 { 93 | continue 94 | } 95 | 96 | // last field contains the file path 97 | libPath := fields[len(fields)-1] 98 | 99 | // if the path contains in '.so' its a shared library 100 | if strings.HasSuffix(libPath, ".so") || strings.Contains(libPath, ".so.") { 101 | // get the absolute path of the shared library 102 | absPath, err := filepath.EvalSymlinks(libPath) 103 | if err != nil { 104 | absPath = libPath 105 | } 106 | 107 | // dedupe .so against map 108 | if !soFiles[absPath] { 109 | soFiles[absPath] = true 110 | fmt.Println(absPath) 111 | } 112 | } 113 | } 114 | 115 | if err := scanner.Err(); err != nil { 116 | fmt.Printf("Error reading %s: %v\n", procMapsPath, err) 117 | } 118 | } 119 | 120 | func isNumeric(arg string) bool { 121 | _, err := strconv.Atoi(arg) 122 | return err == nil 123 | } 124 | 125 | // get the maximum possible PID from /proc/sys/kernel/pid_max 126 | func getMaxPid() (int, error) { 127 | data, err := ioutil.ReadFile("/proc/sys/kernel/pid_max") 128 | if err != nil { 129 | return 0, err 130 | } 131 | maxPidStr := strings.TrimSpace(string(data)) 132 | return strconv.Atoi(maxPidStr) 133 | } 134 | -------------------------------------------------------------------------------- /setup/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # vim:ts=4:sts=4:sw=4:et 3 | # 4 | # Author: Hari Sekhon 5 | # Date: 2019-10-16 10:33:03 +0100 (Wed, 16 Oct 2019) 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | # Alpine / Wget: 17 | # 18 | # wget -O- https://raw.githubusercontent.com/HariSekhon/DevOps-Golang-tools/master/setup/bootstrap.sh | sh 19 | # 20 | # Curl: 21 | # 22 | # curl https://raw.githubusercontent.com/HariSekhon/DevOps-Golang-tools/master/setup/bootstrap.sh | sh 23 | 24 | set -eu 25 | [ -n "${DEBUG:-}" ] && set -x 26 | srcdir="$(dirname "$0")" 27 | 28 | repo="https://github.com/HariSekhon/DevOps-Golang-tools" 29 | 30 | directory="go-tools" 31 | 32 | sudo="" 33 | [ "$(whoami)" = "root" ] || sudo=sudo 34 | 35 | if [ "$(uname -s)" = Darwin ]; then 36 | echo "Bootstrapping on Mac OS X: $repo" 37 | if ! type brew >/dev/null 2>&1; then 38 | curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install | $sudo ruby 39 | fi 40 | elif [ "$(uname -s)" = Linux ]; then 41 | echo "Bootstrapping on Linux: $repo" 42 | if type apk >/dev/null 2>&1; then 43 | $sudo apk --no-cache add bash git make curl wget 44 | elif type apt-get >/dev/null 2>&1; then 45 | if [ -n "${CI:-}" ]; then 46 | export DEBIAN_FRONTEND=noninteractive 47 | fi 48 | opts="-o DPkg::Lock::Timeout=1200" 49 | if [ -z "${PS1:-}" ]; then 50 | opts="$opts -qq" 51 | fi 52 | $sudo apt-get update $opts 53 | $sudo apt-get install $opts -y git make curl wget --no-install-recommends 54 | elif type yum >/dev/null 2>&1; then 55 | if grep -qi 'NAME=.*CentOS' /etc/*release; then 56 | echo "CentOS EOL detected, replacing yum base URL to vault to re-enable package installs" 57 | $sudo sed -i 's/^[[:space:]]*mirrorlist/#mirrorlist/' /etc/yum.repos.d/CentOS-Linux-* 58 | $sudo sed -i 's|^#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|' /etc/yum.repos.d/CentOS-Linux-* 59 | fi 60 | $sudo yum install -y git make curl wget 61 | else 62 | echo "Package Manager not found on Linux, cannot bootstrap" 63 | exit 1 64 | fi 65 | else 66 | echo "Only Mac & Linux are supported for conveniently bootstrapping all install scripts at this time" 67 | exit 1 68 | fi 69 | 70 | if [ "${srcdir##*/}" = setup ]; then 71 | cd "$srcdir/.." 72 | else 73 | # if this is an empty directory eg. a cache mount, then remove it to get a proper checkout 74 | rmdir "$directory" 2>/dev/null || : 75 | if [ -d "$directory" ]; then 76 | cd "$directory" 77 | git pull 78 | else 79 | git clone "$repo" "$directory" 80 | cd "$directory" 81 | fi 82 | fi 83 | 84 | if [ -z "${NO_MAKE:-}" ]; then 85 | make 86 | fi 87 | -------------------------------------------------------------------------------- /setup/ci_bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # vim:ts=4:sts=4:sw=4:et 3 | # 4 | # Author: Hari Sekhon 5 | # Date: 2020-06-02 17:43:35 +0100 (Tue, 02 Jun 2020) 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | # Designed to bootstrap all CI systems with retries to make sure the networking, package lists and package repos works before proceeding 17 | # 18 | # Minimizes CI build failures due to temporary networking blips, which happens more often than you would think when you have a large number of CI builds across a lot of disparate systems 19 | 20 | set -eu 21 | [ -n "${DEBUG:-}" ] && set -x 22 | 23 | max_tries=10 24 | interval=60 # secs 25 | 26 | sudo="" 27 | # EUID undefined in posix sh 28 | #[ $EUID = 0 ] || sudo=sudo 29 | [ "$(whoami)" = root ] || sudo=sudo 30 | 31 | retry(){ 32 | # no local in posix sh 33 | count=0 34 | while true; do 35 | # no let or bare (()) in posix sh, must discard output rather than execute it 36 | _=$((count+=1)) 37 | printf "%s try %d: " "$(date '+%F %T')" "$count" 38 | echo "$*" 39 | "$@" && 40 | break; 41 | echo 42 | if [ "$count" -ge "$max_tries" ]; then 43 | echo "$count tries failed, aborting..." 44 | exit 1 45 | fi 46 | echo "sleeping for $interval secs before retrying" 47 | sleep "$interval" 48 | echo 49 | done 50 | } 51 | 52 | if [ "$(uname -s)" = Darwin ]; then 53 | echo "Bootstrapping Mac" 54 | # removing adjacent dependency to be able to curl from github to avoid submodule circular dependency (git / submodule / install git & make) 55 | #retry "$srcdir/../install/install_homebrew.sh" 56 | if command -v brew 2>&1; then 57 | # fix for CI runners on Mac with shallow homebrew clone - which is failing all the BuildKite builds 58 | for git_root in /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask; do 59 | if [ -d "$git_root" ]; then 60 | # find out if Homebrew is a shallow git checkout and if so fix it 61 | if [ -f "$(git -C "$git_root" rev-parse --git-dir)/shallow" ] || 62 | [ "$(git -C "$git_root" rev-parse --is-shallow-repository)" = true ]; then 63 | git -C "$git_root" fetch --unshallow 64 | fi 65 | fi 66 | done 67 | retry brew update 68 | fi 69 | elif [ "$(uname -s)" = Linux ]; then 70 | echo "Bootstrapping Linux" 71 | if type apk >/dev/null 2>&1; then 72 | retry $sudo apk update 73 | retry $sudo apk add --no-progress bash git make 74 | elif type apt-get >/dev/null 2>&1; then 75 | opts="-q -o DPkg::Lock::Timeout=1200" 76 | retry $sudo apt-get update $opts 77 | retry $sudo apt-get install $opts -y git make 78 | elif type yum >/dev/null 2>&1; then 79 | #retry $sudo yum makecache 80 | retry $sudo yum install -qy git make 81 | else 82 | echo "Package Manager not found on Linux, cannot bootstrap" 83 | exit 1 84 | fi 85 | else 86 | echo "Only Mac & Linux are supported for conveniently bootstrapping all install scripts at this time" 87 | exit 1 88 | fi 89 | 90 | #retry make init 91 | 92 | # not calling make because in some CI systems we call 'make ci' which includes retries but in others with more restrictive build minutes we only run 'make' for a single shot build 93 | # 94 | #make 95 | -------------------------------------------------------------------------------- /setup/ci_git_set_dir_safe.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # vim:ts=4:sts=4:sw=4:et 3 | # 4 | # Author: Hari Sekhon 5 | # Date: 2022-08-03 20:07:09 +0100 (Wed, 03 Aug 2022) 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 12 | # 13 | # https://www.linkedin.com/in/HariSekhon 14 | # 15 | 16 | # Necessary for some CI/CD systems like Azure DevOps Pipelines which have incorrect ownership on the git checkout dir triggering this error: 17 | # 18 | # fatal: detected dubious ownership in repository at '/code/sql' 19 | 20 | # standalone script without lib dependency so it can be called directly from bootstrapped CI before submodules, since that is the exact problem that needs to be solved to allow CI/CD systems with incorrect ownership of the checkout directory to be able to checkout the necessary git submodules 21 | 22 | set -euo pipefail 23 | [ -n "${DEBUG:-}" ] && set -x 24 | srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 25 | 26 | dir="${1:-$srcdir/..}" 27 | 28 | cd "$dir" 29 | 30 | echo "Setting directory as safe: $PWD" 31 | git config --global --add safe.directory "$PWD" 32 | 33 | while read -r submodule_dir; do 34 | dir="$PWD/$submodule_dir" 35 | echo "Setting directory as safe: $dir" 36 | git config --global --add safe.directory "$dir" 37 | done < <(git submodule | awk '{print $2}') 38 | 39 | echo "Done" 40 | -------------------------------------------------------------------------------- /setup/gocd_config_repo.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "DevOps-Golang-tools", 3 | "plugin_id": "yaml.config.plugin", 4 | "material": { 5 | "type": "git", 6 | "attributes": { 7 | "url": "https://github.com/HariSekhon/DevOps-Golang-tools", 8 | "branch": "master", 9 | "auto_update": true 10 | } 11 | }, 12 | "configuration": [ 13 | { 14 | "key": "file_pattern", 15 | "value": "cicd/*.gocd.y*ml" 16 | } 17 | ], 18 | "rules": [ 19 | { 20 | "directive": "allow", 21 | "action": "*", 22 | "type": "*", 23 | "resource": "*" 24 | } 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /setup/jenkins-job.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | hudson.triggers.SCMTrigger 9 | hudson.triggers.TimerTrigger 10 | 11 | 12 | 13 | 14 | 15 | 16 | false 17 | 18 | 19 | 20 | https://github.com/HariSekhon/DevOps-Golang-tools/ 21 | 22 | 23 | 24 | 25 | 26 | H 10 * * 1-5 27 | 28 | 29 | H/2 * * * * 30 | false 31 | 32 | 33 | 34 | 35 | 36 | 37 | 2 38 | 39 | 40 | https://github.com/HariSekhon/DevOps-Golang-tools 41 | 42 | 43 | 44 | 45 | */master 46 | 47 | 48 | false 49 | 50 | 51 | 52 | Jenkinsfile 53 | true 54 | 55 | 56 | false 57 | -------------------------------------------------------------------------------- /teamcity/.teamcity.vcs.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "TeamCity", 3 | "name": "TeamCity", 4 | "vcsName": "jetbrains.git", 5 | "href": "/httpAuth/app/rest/vcs-roots/id:TeamCity", 6 | "project": { 7 | "id": "_Root", 8 | "name": "", 9 | "description": "Contains all other projects", 10 | "href": "/httpAuth/app/rest/projects/id:_Root", 11 | "webUrl": "http://localhost:8111/project.html?projectId=_Root" 12 | }, 13 | "properties": { 14 | "count": 9, 15 | "property": [ 16 | { 17 | "name": "agentCleanFilesPolicy", 18 | "value": "ALL_UNTRACKED" 19 | }, 20 | { 21 | "name": "agentCleanPolicy", 22 | "value": "ON_BRANCH_CHANGE" 23 | }, 24 | { 25 | "name": "authMethod", 26 | "value": "ANONYMOUS" 27 | }, 28 | { 29 | "name": "branch", 30 | "value": "master" 31 | }, 32 | { 33 | "name": "ignoreKnownHosts", 34 | "value": "true" 35 | }, 36 | { 37 | "name": "submoduleCheckout", 38 | "value": "CHECKOUT" 39 | }, 40 | { 41 | "name": "url", 42 | "value": "https://github.com/HariSekhon/TeamCity-CI" 43 | }, 44 | { 45 | "name": "useAlternates", 46 | "value": "true" 47 | }, 48 | { 49 | "name": "usernameStyle", 50 | "value": "USERID" 51 | } 52 | ] 53 | }, 54 | "vcsRootInstances": { 55 | "href": "/httpAuth/app/rest/vcs-root-instances?locator=vcsRoot:(id:TeamCity)" 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /teamcity/.teamcity.vcs.oauth.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "TeamCity", 3 | "name": "TeamCity", 4 | "vcsName": "jetbrains.git", 5 | "href": "/httpAuth/app/rest/vcs-roots/id:TeamCity", 6 | "project": { 7 | "id": "_Root", 8 | "name": "", 9 | "description": "Contains all other projects", 10 | "href": "/httpAuth/app/rest/projects/id:_Root", 11 | "webUrl": "http://localhost:8111/project.html?projectId=_Root" 12 | }, 13 | "properties": { 14 | "count": 9, 15 | "property": [ 16 | { 17 | "name": "agentCleanFilesPolicy", 18 | "value": "ALL_UNTRACKED" 19 | }, 20 | { 21 | "name": "agentCleanPolicy", 22 | "value": "ON_BRANCH_CHANGE" 23 | }, 24 | { 25 | "name": "authMethod", 26 | "value": "PASSWORD" 27 | }, 28 | { 29 | "name": "branch", 30 | "value": "master" 31 | }, 32 | { 33 | "name": "ignoreKnownHosts", 34 | "value": "true" 35 | }, 36 | { 37 | "name": "submoduleCheckout", 38 | "value": "CHECKOUT" 39 | }, 40 | { 41 | "name": "url", 42 | "value": "https://github.com/HariSekhon/TeamCity-CI" 43 | }, 44 | { 45 | "name": "useAlternates", 46 | "value": "true" 47 | }, 48 | { 49 | "name": "username", 50 | "value": "HariSekhon" 51 | }, 52 | { 53 | "name": "usernameStyle", 54 | "value": "USERID" 55 | } 56 | ] 57 | }, 58 | "vcsRootInstances": { 59 | "href": "/httpAuth/app/rest/vcs-root-instances?locator=vcsRoot:(id:TeamCity)" 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /teamcity/.teamcity.vcs.ssh.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "TeamCity", 3 | "name": "TeamCity", 4 | "vcsName": "jetbrains.git", 5 | "href": "/app/rest/vcs-roots/id:TeamCity", 6 | "project": { 7 | "id": "_Root", 8 | "name": "", 9 | "description": "Contains all other projects", 10 | "href": "/app/rest/projects/id:_Root", 11 | "webUrl": "http://localhost:8111/project.html?projectId=_Root" 12 | }, 13 | "properties": { 14 | "count": 11, 15 | "property": [ 16 | { 17 | "name": "agentCleanFilesPolicy", 18 | "value": "ALL_UNTRACKED" 19 | }, 20 | { 21 | "name": "agentCleanPolicy", 22 | "value": "ON_BRANCH_CHANGE" 23 | }, 24 | { 25 | "name": "authMethod", 26 | "value": "TEAMCITY_SSH_KEY" 27 | }, 28 | { 29 | "name": "branch", 30 | "value": "refs/heads/master" 31 | }, 32 | { 33 | "name": "ignoreKnownHosts", 34 | "value": "true" 35 | }, 36 | { 37 | "name": "submoduleCheckout", 38 | "value": "CHECKOUT" 39 | }, 40 | { 41 | "name": "teamcitySshKey", 42 | "value": "VCS SSH Key" 43 | }, 44 | { 45 | "name": "url", 46 | "value": "github.com:HariSekhon/TeamCity-CI" 47 | }, 48 | { 49 | "name": "useAlternates", 50 | "value": "true" 51 | }, 52 | { 53 | "name": "username", 54 | "value": "git" 55 | }, 56 | { 57 | "name": "usernameStyle", 58 | "value": "USERID" 59 | } 60 | ] 61 | }, 62 | "vcsRootInstances": { 63 | "href": "/app/rest/vcs-root-instances?locator=vcsRoot:(id:TeamCity)" 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /tests/all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # vim:ts=4:sts=4:sw=4:et 3 | # 4 | # Author: Hari Sekhon 5 | # Date: 2015-11-05 23:29:15 +0000 (Thu, 05 Nov 2015) 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn 12 | # and optionally send me feedback to help improve or steer this or other code I publish 13 | # 14 | # https://www.linkedin.com/in/HariSekhon 15 | # 16 | 17 | set -euo pipefail 18 | [ -n "${DEBUG:-}" ] && set -x 19 | srcdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 20 | 21 | cd "$srcdir/.." 22 | 23 | # shellcheck disable=SC1090 24 | . "$srcdir/../bash-tools/lib/utils.sh" 25 | 26 | export PROJECT="devops-golang-tools" 27 | 28 | section "DevOps Golang Tools ALL Tests" 29 | 30 | #bash-tools/checks/check_all.sh 31 | 32 | #tests/help.sh 33 | 34 | bash-tools/checks/run_tests.sh 35 | -------------------------------------------------------------------------------- /tests/data/uniq.txt: -------------------------------------------------------------------------------- 1 | one 2 | two 3 | one 4 | three 5 | one 6 | TWO 7 | -------------------------------------------------------------------------------- /tests/excluded.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # shellcheck disable=SC2230 3 | # vim:ts=4:sts=4:sw=4:et 4 | # 5 | # Author: Hari Sekhon 6 | # Date: 2015-05-25 01:38:24 +0100 (Mon, 25 May 2015) 7 | # 8 | # https://github.com/HariSekhon/DevOps-Golang-tools 9 | # 10 | # License: see accompanying Hari Sekhon LICENSE file 11 | # 12 | # If you're using my code you're welcome to connect with me on LinkedIn 13 | # and optionally send me feedback to help improve or steer this or other code I publish 14 | # 15 | # https://www.linkedin.com/in/HariSekhon 16 | # 17 | 18 | # intended only to be sourced by utils.sh 19 | # 20 | # split from utils.sh as this is specific to this repo 21 | 22 | set -eu 23 | [ -n "${DEBUG:-}" ] && set -x 24 | 25 | isExcluded(){ 26 | local prog="$1" 27 | # false positive 28 | # shellcheck disable=SC2049 29 | [[ "$prog" =~ ^\* ]] && return 0 30 | # this external git check is expensive, skip it when in CI as using fresh git checkouts 31 | is_CI && return 1 32 | if type -P git &>/dev/null; then 33 | commit="$(git log "$prog" | head -n1 | grep 'commit')" 34 | if [ -z "$commit" ]; then 35 | return 0 36 | fi 37 | fi 38 | return 1 39 | } 40 | -------------------------------------------------------------------------------- /tests/test_colors.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # vim:ts=4:sts=4:sw=4:et 3 | # 4 | # Author: Hari Sekhon 5 | # Date: 2015-07-28 18:47:41 +0100 (Tue, 28 Jul 2015) 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn 12 | # and optionally send me feedback to help improve or steer this or other code I publish 13 | # 14 | # https://www.linkedin.com/in/HariSekhon 15 | # 16 | 17 | set -euo pipefail 18 | [ -n "${DEBUG:-}" ] && set -x 19 | srcdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 20 | 21 | cd "$srcdir/.."; 22 | 23 | # shellcheck disable=SC1091 24 | . ./tests/utils.sh 25 | 26 | build colors 27 | 28 | # $bin defined in utils.sh 29 | # shellcheck disable=SC2154 30 | run "$bin/colors" 31 | 32 | run "$bin/colors" -v 33 | -------------------------------------------------------------------------------- /tests/test_uniq2.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # vim:ts=4:sts=4:sw=4:et 3 | # 4 | # Author: Hari Sekhon 5 | # Date: 2020-06-02 12:37:27 +0100 (Tue, 02 Jun 2020) 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn 12 | # and optionally send me feedback to help improve or steer this or other code I publish 13 | # 14 | # https://www.linkedin.com/in/HariSekhon 15 | # 16 | 17 | set -eu 18 | [ -n "${DEBUG:-}" ] && set -x 19 | srcdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 20 | 21 | cd "$srcdir/.." 22 | 23 | # shellcheck disable=SC1091 24 | . ./tests/utils.sh 25 | 26 | section "Testing Uniq2" 27 | 28 | build uniq2 29 | 30 | # $bin defined in tests/utils.sh 31 | # shellcheck disable=SC2154 32 | run "$bin/uniq2" < tests/data/uniq.txt 33 | 34 | run "$bin/uniq2" tests/data/uniq.txt 35 | 36 | run "$bin/uniq2" -c tests/data/uniq.txt 37 | 38 | run "$bin/uniq2" -w tests/data/uniq.txt 39 | 40 | run "$bin/uniq2" -c -w tests/data/uniq.txt 41 | -------------------------------------------------------------------------------- /tests/test_welcome.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # vim:ts=4:sts=4:sw=4:et 3 | # 4 | # Author: Hari Sekhon 5 | # Date: 2015-11-05 23:29:15 +0000 (Thu, 05 Nov 2015) 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn 12 | # and optionally send me feedback to help improve or steer this or other code I publish 13 | # 14 | # https://www.linkedin.com/in/HariSekhon 15 | # 16 | 17 | set -eu 18 | [ -n "${DEBUG:-}" ] && set -x 19 | srcdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 20 | 21 | cd "$srcdir/.." 22 | 23 | # shellcheck disable=SC1091 24 | . ./tests/utils.sh 25 | 26 | section "Testing Welcome" 27 | 28 | # Fedora doesn't have /var/log/wtmp 29 | if ! [ -f /var/log/wtmp ]; then 30 | echo "/var/log/wtmp doesn't exist, touching..." 31 | # defined in bash-tools/lib/utils.sh 32 | # shellcheck disable=SC2154 33 | $sudo touch /var/log/wtmp || : 34 | fi 35 | 36 | build welcome 37 | 38 | # $bin defined in tests/utils.sh 39 | # shellcheck disable=SC2154 40 | run "$bin/welcome" 41 | 42 | run "$bin/welcome" -q 43 | -------------------------------------------------------------------------------- /tests/utils.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # vim:ts=4:sts=4:sw=4:et 3 | # 4 | # Author: Hari Sekhon 5 | # Date: 2015-05-25 01:38:24 +0100 (Mon, 25 May 2015) 6 | # 7 | # https://github.com/HariSekhon/DevOps-Golang-tools 8 | # 9 | # License: see accompanying Hari Sekhon LICENSE file 10 | # 11 | # If you're using my code you're welcome to connect with me on LinkedIn 12 | # and optionally send me feedback to help improve or steer this or other code I publish 13 | # 14 | # https://www.linkedin.com/in/HariSekhon 15 | # 16 | 17 | set -eu 18 | [ -n "${DEBUG:-}" ] && set -x 19 | srcdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 20 | 21 | # shellcheck disable=SC1090 22 | . "$srcdir/excluded.sh" 23 | 24 | # shellcheck disable=SC1090 25 | . "$srcdir/../bash-tools/lib/utils.sh" 26 | 27 | export COMPOSE_PROJECT_NAME="go-tools" 28 | 29 | # shellcheck disable=SC1090 30 | . "$srcdir/excluded.sh" 31 | 32 | #export GOBIN="$srcdir/../bin" 33 | bin="${GOBIN:-$srcdir/../bin}" 34 | 35 | if [ "$(uname -s)" = Darwin ]; then 36 | readlink(){ greadlink "$@"; } 37 | fi 38 | 39 | build(){ 40 | local target="$1" 41 | if [ -n "${REBUILD:-}" ]; then 42 | echo "forcing rebuild of $bin/$target" 43 | echo 44 | pushd "$srcdir/.." 45 | if is_CI; then 46 | set -x 47 | fi 48 | GOBIN="$(readlink -f "$bin")" 49 | GOBIN="$GOBIN" go install -race "$target.go" 50 | popd 51 | if is_CI; then 52 | set +x 53 | fi 54 | elif [ -f "$bin/$target" ]; then 55 | echo "$bin/$target detected" 56 | else 57 | echo "$bin/$target not detected, building now" 58 | echo 59 | make 60 | fi 61 | echo 62 | } 63 | -------------------------------------------------------------------------------- /timestamp_epoch_to_human.go: -------------------------------------------------------------------------------- 1 | ///bin/sh -c true; exec /usr/bin/env go run "$0" "$@" 2 | // vim:ts=4:sts=4:sw=4:noet 3 | // 4 | // Author: Hari Sekhon 5 | // Date: 2023-06-14 22:44:00 +0100 (Wed, 14 Jun 2023) 6 | // 7 | // https://github.com/HariSekhon/DevOps-Golang-tools 8 | // 9 | // License: see accompanying Hari Sekhon LICENSE file 10 | // 11 | // If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 12 | // 13 | // https://www.linkedin.com/in/HariSekhon 14 | // 15 | 16 | package main 17 | 18 | import ( 19 | "bufio" 20 | "flag" 21 | "fmt" 22 | "log" 23 | "os" 24 | "path" 25 | "regexp" 26 | "strconv" 27 | "strings" 28 | "time" 29 | ) 30 | 31 | const description = ` 32 | Converts epoch timestamp from logs such as External Secrets pod logs into a human readable format 33 | 34 | Works like a standard unix filter program - takes either a filename or standard input and prints to standard output replacing the epoch with human readable time 35 | ` 36 | 37 | var prog = path.Base(os.Args[0]) 38 | 39 | func readline() string { 40 | in := bufio.NewReader(os.Stdin) 41 | line, err := in.ReadString('\n') 42 | if err != nil { 43 | log.Fatal(err) 44 | } 45 | line = strings.TrimSpace(line) 46 | return line 47 | } 48 | 49 | func main() { 50 | flag.Usage = func() { 51 | fmt.Fprintf(os.Stderr, "%s\n\nusage: %s []\n\n", description, prog) 52 | flag.PrintDefaults() 53 | os.Exit(3) 54 | } 55 | //var debug = flag.Bool("D", false, "Debug mode") 56 | flag.Parse() 57 | //if *debug || os.Getenv("DEBUG") != "" { 58 | // log.SetLevel(log.DebugLevel) 59 | // log.Debug("debug logging enabled") 60 | //} 61 | 62 | var scanner *bufio.Scanner 63 | if len(os.Args) > 1 { 64 | filename := os.Args[1] 65 | filehandle, err := os.Open(filename) 66 | if err != nil { 67 | //fmt.Fprintf(os.Stderr, "error: %s\n", err) 68 | //os.Exit(1) 69 | log.Fatal(err) 70 | } 71 | defer filehandle.Close() 72 | scanner = bufio.NewScanner(filehandle) 73 | } else { 74 | scanner = bufio.NewScanner(os.Stdin) 75 | } 76 | 77 | re := regexp.MustCompile(`\b\d{10}(?:\.\d{1,7})?\b`) 78 | 79 | for scanner.Scan() { 80 | line := scanner.Text() 81 | matches := re.FindAllString(line, -1) 82 | for _, match := range matches { 83 | epoch, err := strconv.ParseFloat(match, 64) 84 | if err == nil { 85 | seconds := int64(epoch) 86 | milliseconds := int64((epoch - float64(seconds)) * 1000) 87 | 88 | t := time.Unix(seconds, milliseconds*int64(time.Millisecond)) 89 | //convertedTime := t.Format("2006-01-02 15:04:05.000") 90 | convertedTime := t.Format(time.RFC3339) 91 | 92 | line = strings.Replace(line, match, convertedTime, 1) 93 | } 94 | } 95 | fmt.Println(line) 96 | } 97 | 98 | if err := scanner.Err(); err != nil { 99 | log.Fatal(err) 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /uniq2.go: -------------------------------------------------------------------------------- 1 | ///bin/sh -c true; exec /usr/bin/env go run "$0" "$@" 2 | // vim:ts=4:sts=4:sw=4:noet 3 | // 4 | // Author: Hari Sekhon 5 | // Date: 2020-06-01 20:11:40 +0100 (Mon, 01 Jun 2020) 6 | // Original Date: 2015-02-07 16:06:33 +0000 (Sat, 07 Feb 2015) 7 | // 8 | // https://github.com/HariSekhon/DevOps-Golang-tools 9 | // 10 | // License: see accompanying Hari Sekhon LICENSE file 11 | // 12 | // If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 13 | // 14 | // https://www.linkedin.com/in/HariSekhon 15 | // 16 | 17 | package main 18 | 19 | import ( 20 | "bufio" 21 | "flag" 22 | "fmt" 23 | log "github.com/sirupsen/logrus" 24 | "io" 25 | "os" 26 | "path" 27 | "strings" 28 | ) 29 | 30 | const description = ` 31 | Filter program to print only non-repeated lines in input - unlike the unix command 'uniq' lines do not have to be adjacent, this is order preserving compared to 'sort | uniq'. I rustled this up quickly after needing to parse unique missing modules for building but maintaining order as some modules depend on others being built first 32 | 33 | Works as a standard unix filter program taking either standard input or files supplied as arguments 34 | 35 | Since this must maintain unique lines in memory for comparison, do not use this on very large files/inputs 36 | 37 | Port of Perl program uniq_order_preserved.pl written early 2015 which can be found in the adjacent DevOps Perl tools repo 38 | 39 | Tested on Mac OS X and Linux 40 | ` 41 | 42 | var prog = path.Base(os.Args[0]) 43 | 44 | func main() { 45 | flag.Usage = func() { 46 | fmt.Fprintf(os.Stderr, "%s\n\nusage: %s [file1] [file2] ...\n\n", description, prog) 47 | flag.PrintDefaults() 48 | os.Exit(3) 49 | } 50 | var debug = flag.Bool("D", false, "Debug mode") 51 | var ignoreCase = flag.Bool("c", false, "Ignore case in comparisons") 52 | var ignoreWhitespace = flag.Bool("w", false, "Ignore whitespace in comparisons") 53 | flag.Parse() 54 | if *debug || os.Getenv("DEBUG") != "" { 55 | log.SetLevel(log.DebugLevel) 56 | log.Debug("debug logging enabled") 57 | } 58 | 59 | if len(flag.Args()) < 1 { 60 | printUniq("-", *ignoreCase, *ignoreWhitespace) 61 | } else { 62 | for _, filename := range flag.Args() { 63 | printUniq(filename, *ignoreCase, *ignoreWhitespace) 64 | } 65 | } 66 | } 67 | 68 | var uniqMap = make(map[string]bool) 69 | 70 | // returns True if line is uniq, False if it's been seen before 71 | func uniq(line string, ignoreCase bool, ignoreWhitespace bool) bool { 72 | if ignoreWhitespace { 73 | line = strings.TrimSpace(line) 74 | } 75 | if ignoreCase { 76 | line = strings.ToLower(line) 77 | } 78 | _, exists := uniqMap[line] 79 | if exists { 80 | return false 81 | } 82 | uniqMap[line] = true 83 | return true 84 | } 85 | 86 | func printUniq(filename string, ignoreCase bool, ignoreWhitespace bool) { 87 | if filename == "-" { 88 | stdin := bufio.NewReader(os.Stdin) 89 | processLines(stdin, ignoreCase, ignoreWhitespace) 90 | return 91 | } 92 | 93 | filehandle, err := os.Open(filename) 94 | if err != nil { 95 | log.Error(err) 96 | return 97 | } 98 | defer filehandle.Close() 99 | processLines(filehandle, ignoreCase, ignoreWhitespace) 100 | } 101 | 102 | func processLines(reader io.Reader, ignoreCase bool, ignoreWhitespace bool) { 103 | var line string 104 | scanner := bufio.NewScanner(reader) 105 | for scanner.Scan() { 106 | line = scanner.Text() 107 | if uniq(line, ignoreCase, ignoreWhitespace) { 108 | fmt.Println(line) 109 | } 110 | } 111 | if err := scanner.Err(); err != nil { 112 | log.Fatal(err) 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /welcome.go: -------------------------------------------------------------------------------- 1 | ///bin/sh -c true; exec /usr/bin/env go run "$0" "$@" 2 | // vim:ts=4:sts=4:sw=4:noet 3 | // 4 | // Author: Hari Sekhon 5 | // Date: 2020-04-24 14:14:44 +0100 (Fri, 24 Apr 2020) 6 | // 7 | // https://github.com/HariSekhon/DevOps-Golang-tools 8 | // 9 | // License: see accompanying Hari Sekhon LICENSE file 10 | // 11 | // If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish 12 | // 13 | // https://www.linkedin.com/in/HariSekhon 14 | // 15 | 16 | package main 17 | 18 | import ( 19 | "bufio" 20 | "bytes" 21 | "flag" 22 | "fmt" 23 | //"log" 24 | // drop in replacement, with more levels and .SetLevel() 25 | log "github.com/sirupsen/logrus" 26 | "math/rand" 27 | "os" 28 | "os/exec" 29 | "os/signal" 30 | "os/user" 31 | "path" 32 | "regexp" 33 | "strings" 34 | "syscall" 35 | "time" 36 | ) 37 | 38 | const description = ` 39 | Prints a slick welcome message with last login time 40 | 41 | Tested on Mac OS X and Linux 42 | ` 43 | 44 | var prog = path.Base(os.Args[0]) 45 | 46 | // not compatible with logrus nor necessary, use Fprintf(os.Stderr, ...) instead 47 | //var stderr = log.New(os.Stderr, "", 0) 48 | 49 | func main() { 50 | flag.Usage = func() { 51 | fmt.Fprintf(os.Stderr, "%s\n\nusage: %s [options]\n\n", description, prog) 52 | flag.PrintDefaults() 53 | os.Exit(3) 54 | } 55 | var debug = flag.Bool("D", false, "Debug mode") 56 | var quick = flag.Bool("q", false, "Quick - print instantly without fancy scrolling effect, saves 2-3 seconds (you can also Control-C to make output complete instantly)") 57 | flag.Parse() 58 | if *debug || os.Getenv("DEBUG") != "" { 59 | log.SetLevel(log.DebugLevel) 60 | log.Debug("debug logging enabled") 61 | } 62 | msg := constructMsg() 63 | keyboardInterruptHandler(msg) 64 | // if we're being run in buffered 'go run', just print quickly without spinner 65 | matched, _ := regexp.MatchString("/go-build\\d+/[^/]+/exe/[^/]+$", os.Args[0]) 66 | if *quick || os.Getenv("QUICK") != "" || matched { 67 | fmt.Println(msg) 68 | } else { 69 | printWithSpinner(msg) 70 | } 71 | } 72 | 73 | func titlecaseUser(user string) string { 74 | if user == "root" { 75 | user = strings.ToUpper(user) 76 | } else { 77 | matched, _ := regexp.MatchString("\\d$", user) 78 | if len(user) < 4 && matched { 79 | // probably not a real name 80 | // pass 81 | } else { 82 | user = strings.Title(user) 83 | } 84 | } 85 | return user 86 | } 87 | 88 | func constructMsg() string { 89 | user, err := user.Current() 90 | if err != nil { 91 | log.Fatal(err) 92 | } 93 | var username string 94 | username = user.Username 95 | username = titlecaseUser(username) 96 | msg := fmt.Sprintf("Welcome %s - ", username) 97 | msgNoLastLoginInfo := "no last login information available!" 98 | /* 99 | last, err := os.Executable("last") 100 | if err != nil { 101 | msg += msgNoLastLoginInfo 102 | return msg 103 | } 104 | */ 105 | regexSkip := regexp.MustCompile("^(?:reboot|wtmp)|^\\s*$") 106 | var stdoutBuf, stderrBuf bytes.Buffer 107 | cmd := exec.Command("last", "-100") 108 | cmd.Stdout = &stdoutBuf 109 | cmd.Stderr = &stderrBuf 110 | err = cmd.Run() 111 | if err != nil { 112 | msg += msgNoLastLoginInfo 113 | msg += fmt.Sprintf(" ('last' command failed to execute: %s)", err) 114 | return msg 115 | } 116 | stdout, stderr := string(stdoutBuf.Bytes()), string(stderrBuf.Bytes()) 117 | if strings.TrimSpace(stderr) != "" { 118 | msg += msgNoLastLoginInfo 119 | msg += fmt.Sprintf(" ('last' stderr: %s)", stderr) 120 | return msg 121 | } 122 | lines := strings.Split(stdout, "\n") 123 | lastLine := "" 124 | for _, line := range lines { 125 | if regexSkip.MatchString(line) { 126 | continue 127 | } 128 | lastLine = line 129 | break 130 | } 131 | if lastLine != "" { 132 | msg += "last login was " 133 | regexLastUser := regexp.MustCompile("\\s+.*$") 134 | lastUser := regexLastUser.ReplaceAllString(lastLine, "") 135 | if lastUser == "root" { 136 | lastUser = "ROOT" 137 | } 138 | regexDate := regexp.MustCompile(".*(\\w{3}\\s+\\w{3}\\s+\\d+)") 139 | lastLine = regexDate.ReplaceAllString(lastLine, "$1") 140 | if lastUser == "ROOT" { 141 | msg += "ROOT" 142 | } else if strings.ToLower(lastUser) == strings.ToLower(username) { 143 | msg += "by you" 144 | } else { 145 | msg += fmt.Sprintf("by %s", lastUser) 146 | } 147 | msg += fmt.Sprintf(" => %s", lastLine) 148 | } else { 149 | msg += "no last login information available!" 150 | } 151 | return msg 152 | } 153 | 154 | func printWithSpinner(msg string) { 155 | if strings.TrimSpace(os.Getenv("QUICK")) != "" { 156 | fmt.Println(msg) 157 | return 158 | } 159 | stdout := bufio.NewWriter(os.Stdout) 160 | // many non-ASCII character sets we don't care about 161 | // unicode.Lower.R16 - 16-bit code-points for lowercase chars 162 | // unicode.. 163 | chars := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345689@#$%^&*()" 164 | charlist := []rune(chars) 165 | sleepDuration, err := time.ParseDuration("0.0085s") 166 | if err != nil { 167 | log.Fatal(err) 168 | } 169 | for _, char := range msg { 170 | fmt.Printf(" ") 171 | j := 0 172 | for { 173 | var randomChar rune 174 | if j > 3 { 175 | randomChar = char 176 | } else { 177 | randomIndex := rand.Intn(len(charlist)) 178 | randomChar = charlist[randomIndex] 179 | } 180 | fmt.Printf("\b%s", string(char)) 181 | stdout.Flush() 182 | if char == randomChar { 183 | break 184 | } 185 | j++ 186 | time.Sleep(sleepDuration) 187 | } 188 | } 189 | fmt.Println() 190 | } 191 | 192 | func keyboardInterruptHandler(msg string) { 193 | c := make(chan os.Signal) 194 | signal.Notify(c, os.Interrupt, syscall.SIGTERM) 195 | go func() { 196 | <-c 197 | fmt.Printf("\r") 198 | fmt.Println(msg) 199 | os.Exit(0) 200 | }() 201 | } 202 | --------------------------------------------------------------------------------