2021-10-18 16:49:44 +00:00
|
|
|
SHELL:=bash
|
2016-03-13 09:14:28 +00:00
|
|
|
PREFIX?="/usr"
|
2019-03-21 20:10:13 +00:00
|
|
|
DESTDIR?=
|
2016-03-12 21:35:05 +00:00
|
|
|
|
2016-03-12 19:21:04 +00:00
|
|
|
#
|
|
|
|
# Building:
|
|
|
|
#
|
|
|
|
|
2016-05-14 11:03:33 +00:00
|
|
|
.PHONY: all
|
2016-02-21 13:26:17 +00:00
|
|
|
all: build
|
|
|
|
|
2016-05-14 11:03:33 +00:00
|
|
|
.PHONY: clean
|
2016-02-21 13:26:17 +00:00
|
|
|
clean:
|
2021-05-04 18:58:36 +00:00
|
|
|
@rm -f git-secret
|
2016-02-21 13:26:17 +00:00
|
|
|
|
2016-05-14 11:03:33 +00:00
|
|
|
.PHONY: build
|
2021-10-15 11:17:14 +00:00
|
|
|
build:
|
|
|
|
@cat src/version.sh > git-secret
|
|
|
|
@cat src/_utils/*.sh src/commands/*.sh >> git-secret
|
|
|
|
@cat src/main.sh >> git-secret
|
|
|
|
@chmod +x git-secret; sync
|
2016-02-21 13:26:17 +00:00
|
|
|
|
2016-05-14 11:03:33 +00:00
|
|
|
.PHONY: install
|
|
|
|
install:
|
2021-10-18 16:49:44 +00:00
|
|
|
"${SHELL}" ./utils/install.sh "${DESTDIR}${PREFIX}"
|
2016-05-14 11:03:33 +00:00
|
|
|
|
2016-06-28 21:00:15 +00:00
|
|
|
.PHONY: uninstall
|
|
|
|
uninstall:
|
2021-10-18 16:49:44 +00:00
|
|
|
"${SHELL}" ./utils/uninstall.sh "${DESTDIR}${PREFIX}"
|
2016-06-28 21:00:15 +00:00
|
|
|
|
2016-03-12 19:21:04 +00:00
|
|
|
#
|
2021-05-03 16:21:33 +00:00
|
|
|
# Testing and linting:
|
2016-03-12 19:21:04 +00:00
|
|
|
#
|
|
|
|
|
2019-03-09 23:49:45 +00:00
|
|
|
# The $(shell echo $${PWD}) construct is to access *nix paths under windows
|
|
|
|
# Under git for windows '$PATH' is set to windows paths, e.g. C:\Something
|
|
|
|
# Using a sub-shell we get the raw *nix paths, e.g. /c/Something
|
2016-05-14 11:03:33 +00:00
|
|
|
.PHONY: test
|
2019-03-04 23:52:53 +00:00
|
|
|
test: clean build
|
2021-05-05 12:59:28 +00:00
|
|
|
export SECRETS_PROJECT_ROOT="$(shell echo $${PWD})"; \
|
2019-03-09 23:49:45 +00:00
|
|
|
export PATH="$(shell echo $${PWD})/vendor/bats-core/bin:$(shell echo $${PWD}):$(shell echo $${PATH})"; \
|
2021-10-18 16:49:44 +00:00
|
|
|
"${SHELL}" ./utils/tests.sh
|
2016-02-21 13:26:17 +00:00
|
|
|
|
2021-05-03 10:56:51 +00:00
|
|
|
# We use this script in CI and you can do this too!
|
|
|
|
# What happens here?
|
2021-05-05 12:59:28 +00:00
|
|
|
# 1. We pass `SECRETS_DOCKER_ENV` variable into this job
|
2021-05-03 10:56:51 +00:00
|
|
|
# 2. Based on it, we select a proper `docker` image to run test on
|
|
|
|
# 3. We execute `make test` inside the `docker` container
|
2021-05-03 14:23:54 +00:00
|
|
|
.PHONY: docker-ci
|
|
|
|
docker-ci: clean
|
2021-05-05 12:59:28 +00:00
|
|
|
@[ -z "${SECRETS_DOCKER_ENV}" ] \
|
|
|
|
&& echo 'SECRETS_DOCKER_ENV is unset' && exit 1 || true
|
2021-05-03 13:18:15 +00:00
|
|
|
docker build \
|
2021-05-05 12:59:28 +00:00
|
|
|
-f ".ci/docker-ci/$${SECRETS_DOCKER_ENV}/Dockerfile" \
|
|
|
|
-t "gitsecret-$${SECRETS_DOCKER_ENV}:latest" .
|
2021-05-03 13:18:15 +00:00
|
|
|
docker run --rm \
|
|
|
|
--volume="$${PWD}:/code" \
|
|
|
|
-w /code \
|
2021-05-05 12:59:28 +00:00
|
|
|
"gitsecret-$${SECRETS_DOCKER_ENV}" \
|
2021-05-03 13:18:15 +00:00
|
|
|
make test
|
2021-05-03 10:56:51 +00:00
|
|
|
|
2021-05-03 16:21:33 +00:00
|
|
|
.PHONY: lint-shell
|
|
|
|
lint-shell:
|
|
|
|
docker pull koalaman/shellcheck:latest
|
|
|
|
docker run \
|
|
|
|
--volume="$${PWD}:/code" \
|
|
|
|
-w /code \
|
2022-02-20 15:39:37 +00:00
|
|
|
-e SHELLCHECK_OPTS='-s bash -S style -a' \
|
2021-05-03 16:21:33 +00:00
|
|
|
--rm koalaman/shellcheck \
|
2021-05-04 09:26:39 +00:00
|
|
|
$$(find src .ci utils tests docs -type f \
|
2021-05-03 16:21:33 +00:00
|
|
|
-name '*.sh' -o -name '*.bash' -o -name '*.bats')
|
|
|
|
|
|
|
|
.PHONY: lint-docker
|
|
|
|
lint-docker:
|
|
|
|
docker pull hadolint/hadolint:latest-alpine
|
|
|
|
docker run \
|
|
|
|
--volume="$${PWD}:/code" \
|
|
|
|
-w /code \
|
|
|
|
--rm hadolint/hadolint \
|
|
|
|
hadolint \
|
2021-05-04 18:58:36 +00:00
|
|
|
--ignore=DL3008 --ignore=DL3018 --ignore=DL3041 --ignore=DL3028 \
|
|
|
|
.ci/*/**/Dockerfile
|
2021-05-03 16:21:33 +00:00
|
|
|
|
2021-05-03 12:43:04 +00:00
|
|
|
.PHONY: lint
|
2021-05-03 16:21:33 +00:00
|
|
|
lint: lint-shell lint-docker
|
2021-05-03 12:43:04 +00:00
|
|
|
|
2016-03-12 19:21:04 +00:00
|
|
|
#
|
2021-05-04 09:26:39 +00:00
|
|
|
# Manuals and docs:
|
2016-03-12 19:21:04 +00:00
|
|
|
#
|
|
|
|
|
Version 0.2.2 pre-release
There are a lot of changes, multiple things were refactored: tests,
some commands, building and meta.
Several critical bugs fixed.
Changes:
1. Fixed #74, when `_user_required` was not working after reimporting keys
2. Closes #73, now it is possible to provide multiple emails to the `killperson` command
3. Closes #72, now it is possible to provide multiple emails to the `tell` command
4. Closes #71, now every doc in this project refer to `git-secret.io` instead of old `gh-pages` website
5. Closes #70, now installation section is removed from main `man` file
6. Closes #69, now "See also" section in the `man`s are clickable
7. Closes #61, added "Manual" section to the manuals
8. Refs #38, added `centos` Dockerfile, but `ci` testing is still failing
9. Refs #52, tests are refactored. Added `clean` command tests, removed a lot of hardcoded things, moved tests execution from `./temp` folder to `/tmp`, added a lot of new check in old tests, and some new test cases
10. Refactored `hide` and `clean` commands to be shorter
11. `shellcheck` is now supported with `make lint`
Additional features are not comming to 0.2.2 after this commit.
2017-02-26 13:38:46 +00:00
|
|
|
.PHONY: clean-man
|
|
|
|
clean-man:
|
2021-05-04 18:58:36 +00:00
|
|
|
@find "man/" -type f ! -name "*.md" -delete
|
Version 0.2.2 pre-release
There are a lot of changes, multiple things were refactored: tests,
some commands, building and meta.
Several critical bugs fixed.
Changes:
1. Fixed #74, when `_user_required` was not working after reimporting keys
2. Closes #73, now it is possible to provide multiple emails to the `killperson` command
3. Closes #72, now it is possible to provide multiple emails to the `tell` command
4. Closes #71, now every doc in this project refer to `git-secret.io` instead of old `gh-pages` website
5. Closes #70, now installation section is removed from main `man` file
6. Closes #69, now "See also" section in the `man`s are clickable
7. Closes #61, added "Manual" section to the manuals
8. Refs #38, added `centos` Dockerfile, but `ci` testing is still failing
9. Refs #52, tests are refactored. Added `clean` command tests, removed a lot of hardcoded things, moved tests execution from `./temp` folder to `/tmp`, added a lot of new check in old tests, and some new test cases
10. Refactored `hide` and `clean` commands to be shorter
11. `shellcheck` is now supported with `make lint`
Additional features are not comming to 0.2.2 after this commit.
2017-02-26 13:38:46 +00:00
|
|
|
|
2016-05-14 11:03:33 +00:00
|
|
|
.PHONY: build-man
|
2021-10-15 11:17:14 +00:00
|
|
|
build-man: build
|
2021-05-03 13:18:15 +00:00
|
|
|
docker pull msoap/ruby-ronn
|
2021-05-04 09:26:39 +00:00
|
|
|
export GITSECRET_VERSION="$$(./git-secret --version)" && docker run \
|
2021-05-03 13:18:15 +00:00
|
|
|
--volume="$${PWD}:/code" \
|
|
|
|
-w /code \
|
|
|
|
--rm msoap/ruby-ronn \
|
|
|
|
ronn --roff \
|
|
|
|
--organization=sobolevn \
|
|
|
|
--manual="git-secret $${GITSECRET_VERSION}" \
|
2021-05-04 09:26:39 +00:00
|
|
|
man/*/*.md
|
|
|
|
|
|
|
|
.PHONY: build-docs
|
|
|
|
build-docs: build-man
|
2021-10-18 16:49:44 +00:00
|
|
|
"${SHELL}" docs/build.sh
|
2021-05-04 09:26:39 +00:00
|
|
|
|
|
|
|
.PHONY: docs
|
|
|
|
docs: build-docs
|
|
|
|
docker pull jekyll/jekyll
|
|
|
|
docker run \
|
|
|
|
--volume="$${PWD}/docs:/code" \
|
|
|
|
-w /code \
|
|
|
|
-p 4000:4000 \
|
|
|
|
--rm jekyll/jekyll \
|
|
|
|
jekyll serve --safe --strict_front_matter
|
2016-02-21 13:26:17 +00:00
|
|
|
|
2021-05-06 11:51:06 +00:00
|
|
|
.PHONY: changelog
|
|
|
|
changelog:
|
|
|
|
@[ -z "${GITHUB_REPOSITORY}" ] \
|
|
|
|
&& echo 'GITHUB_REPOSITORY is unset' && exit 1 || true
|
2021-05-06 11:57:39 +00:00
|
|
|
@[ -z "${GITHUB_TOKEN}" ] \
|
|
|
|
&& echo 'GITHUB_TOKEN is unset' && exit 1 || true
|
2021-05-06 11:51:06 +00:00
|
|
|
docker pull githubchangeloggenerator/github-changelog-generator
|
|
|
|
docker run \
|
|
|
|
--volume="$${PWD}:/code" \
|
|
|
|
-w /code \
|
|
|
|
--entrypoint='' \
|
|
|
|
-e GITHUB_REPOSITORY \
|
|
|
|
-e GITHUB_TOKEN \
|
|
|
|
--rm githubchangeloggenerator/github-changelog-generator \
|
|
|
|
sh ".ci/github_release_script.sh"
|
|
|
|
|
2016-03-12 19:21:04 +00:00
|
|
|
#
|
|
|
|
# Packaging:
|
|
|
|
#
|
|
|
|
|
2021-05-05 12:59:28 +00:00
|
|
|
.PHONY: build-release
|
2021-05-05 17:12:42 +00:00
|
|
|
build-release: clean build-man
|
2021-05-05 12:59:28 +00:00
|
|
|
@[ -z "${SECRETS_RELEASE_TYPE}" ] \
|
|
|
|
&& echo 'SECRETS_RELEASE_TYPE is unset' && exit 1 || true
|
2021-05-04 18:58:36 +00:00
|
|
|
docker build \
|
|
|
|
-f ".ci/releaser/alpine/Dockerfile" \
|
|
|
|
-t "gitsecret-releaser:latest" .
|
|
|
|
docker run \
|
|
|
|
--volume="$${PWD}:/code" \
|
|
|
|
--rm gitsecret-releaser \
|
2021-05-05 12:59:28 +00:00
|
|
|
bash "./utils/$${SECRETS_RELEASE_TYPE}/build.sh"
|
2021-05-04 18:58:36 +00:00
|
|
|
|
|
|
|
.PHONY: release
|
2021-05-05 12:59:28 +00:00
|
|
|
release: build-release
|
2021-05-06 12:19:42 +00:00
|
|
|
@[ -z "${SECRETS_ARTIFACTORY_CREDENTIALS}" ] \
|
|
|
|
&& echo 'SECRETS_ARTIFACTORY_CREDENTIALS is unset' && exit 1 || true
|
2021-05-04 18:58:36 +00:00
|
|
|
docker run \
|
|
|
|
--volume="$${PWD}:/code" \
|
|
|
|
-e SECRETS_ARTIFACTORY_CREDENTIALS \
|
2022-06-05 08:43:25 +00:00
|
|
|
-e SECRETS_DEPLOY_DRY_RUN \
|
2021-05-04 18:58:36 +00:00
|
|
|
--rm gitsecret-releaser \
|
2021-05-05 12:59:28 +00:00
|
|
|
bash "./utils/$${SECRETS_RELEASE_TYPE}/deploy.sh"
|
|
|
|
|
|
|
|
.PHONY: release-ci
|
|
|
|
release-ci:
|
|
|
|
@[ -z "${SECRETS_RELEASE_ENV}" ] \
|
|
|
|
&& echo 'SECRETS_RELEASE_ENV is unset' && exit 1 || true
|
|
|
|
@[ -z "${SECRETS_RELEASE_TYPE}" ] \
|
|
|
|
&& echo 'SECRETS_RELEASE_TYPE is unset' && exit 1 || true
|
|
|
|
docker build \
|
|
|
|
-f ".ci/release-ci/$${SECRETS_RELEASE_ENV}/Dockerfile" \
|
|
|
|
-t "gitsecret-release-$${SECRETS_RELEASE_ENV}:latest" .
|
|
|
|
docker run --rm \
|
|
|
|
--volume="$${PWD}:/code" \
|
|
|
|
-w /code \
|
|
|
|
"gitsecret-release-$${SECRETS_RELEASE_ENV}" \
|
|
|
|
bash -c "set -e; bash "./utils/$${SECRETS_RELEASE_TYPE}/install.sh""
|