From 6aa251e9ecc13cdbe4d41a11a431b8ae980dfff6 Mon Sep 17 00:00:00 2001 From: Histausse Date: Fri, 19 May 2023 18:32:16 +0200 Subject: [PATCH 01/10] add badge --- cookiecutter.json | 4 ++-- {{ cookiecutter.project_slug }}/README.md | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cookiecutter.json b/cookiecutter.json index 34664c8..7441fc8 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -5,12 +5,12 @@ "email": "", "git_user": "", "project_slug": "{{ cookiecutter.project_name.lower().replace(' ', '_').replace('-', '_') }}", - "gitea_url": "", + "gitea_url": "https://git.pains-perdus.fr", "project_url": "{{ cookiecutter.gitea_url }}/{{ cookiecutter.git_user }}/{{ cookiecutter.project_slug }}", "generate_gitea_project": [ true, false ], "configure_ci": [ true, false ], "woodpecker_gitea_user": "ci", - "woodpecker_server": "ci.pains-perdus.fr", + "woodpecker_server": "https://ci.pains-perdus.fr", "git_origin": "{{ cookiecutter.gitea_url.replace('https://', 'gitea@').replace('http://', 'gitea') }}:{{ cookiecutter.git_user }}/{{ cookiecutter.project_slug }}.git", "version": "0.1.0", "open_source_license": ["AGPL-3.0-only", "GPL-3.0-only", "MIT", "BSD-3-Clause", "ISC", "Apache-2.0", "Proprietary"], diff --git a/{{ cookiecutter.project_slug }}/README.md b/{{ cookiecutter.project_slug }}/README.md index 7a4eaf5..1d18504 100644 --- a/{{ cookiecutter.project_slug }}/README.md +++ b/{{ cookiecutter.project_slug }}/README.md @@ -1,5 +1,8 @@ {% set is_open_source = cookiecutter.open_source_license != 'Proprietary' -%} +{% set repo = "/".join(cookiecutter.git_origin.removesuffix(".git").split(":")[-1].split("/")[-2:]) %} # {{ cookiecutter.project_name }} +{% if cookiecutter.configure_ci %}[![CI status badge]({{ cookiecutter.woodpecker_server }}/api/badges/{{ repo }}/status.svg)](https://ci.pains-perdus.fr/histausse/test_ci_template){% endif %} + {{ cookiecutter.project_short_description }} From fc90b3fb71dbe7ffe44f049e32c8f530fc00144f Mon Sep 17 00:00:00 2001 From: Histausse Date: Fri, 19 May 2023 19:35:18 +0200 Subject: [PATCH 02/10] Add CI config --- TODO.md | 1 - hooks/post_gen_project.py | 13 +++++++++++++ {{ cookiecutter.project_slug }}/.woodpecker.yml | 15 ++++++++++++--- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/TODO.md b/TODO.md index a3b6fe0..924f353 100644 --- a/TODO.md +++ b/TODO.md @@ -1,5 +1,4 @@ # TODO: -- add CI - add flake - use bool value for `generate_gitea_project` when the feature is available diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 745f65c..dfa5100 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -1,4 +1,17 @@ import subprocess +import os + +REMOVE_PATHS = [ + {% if cookiecutter.open_source_license == "Proprietary" %} "LICENSE", {% endif %} + {% if cookiecutter.configure_ci == "False" %} ".woodpecker.yml", {% endif %} +] + +for path in REMOVE_PATHS: + if path and os.path.exists(path): + if os.path.isdir(path): + os.rmdir(path) + else: + os.unlink(path) subprocess.call(["git", "init"]) subprocess.call(["git", "checkout", "-b", "main"]) diff --git a/{{ cookiecutter.project_slug }}/.woodpecker.yml b/{{ cookiecutter.project_slug }}/.woodpecker.yml index 300eafc..8fe54b3 100644 --- a/{{ cookiecutter.project_slug }}/.woodpecker.yml +++ b/{{ cookiecutter.project_slug }}/.woodpecker.yml @@ -1,5 +1,14 @@ pipeline: - a-test-step: - image: debian + test: + image: python:${PYTHON_VERSION} + pull: true + environment: + - POETRY_VIRTUALENVS_IN_PROJECT=true commands: - - echo "Testing.." + - pip install poetry + - poetry install + - poetry run pytest + +matrix: + PYTHON_VERSION: + - {{ cookiecutter. python_min_version}} From d23ae91b74c30e90d44c0c53b297af5a40909f63 Mon Sep 17 00:00:00 2001 From: Histausse Date: Sat, 20 May 2023 23:11:08 +0200 Subject: [PATCH 03/10] add flake support --- TODO.md | 2 +- .../.woodpecker.yml | 12 +++++++ {{ cookiecutter.project_slug }}/README.md | 25 ++++++++++++- {{ cookiecutter.project_slug }}/flake.nix | 36 +++++++++++++++++++ 4 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 {{ cookiecutter.project_slug }}/flake.nix diff --git a/TODO.md b/TODO.md index 924f353..038ff67 100644 --- a/TODO.md +++ b/TODO.md @@ -1,4 +1,4 @@ # TODO: -- add flake +- publish to gitea repo: [container](https://docs.gitea.io/en-us/usage/packages/container/) [badge](https://docs.gitea.io/en-us/usage/packages/generic/) - use bool value for `generate_gitea_project` when the feature is available diff --git a/{{ cookiecutter.project_slug }}/.woodpecker.yml b/{{ cookiecutter.project_slug }}/.woodpecker.yml index 8fe54b3..d00a7e9 100644 --- a/{{ cookiecutter.project_slug }}/.woodpecker.yml +++ b/{{ cookiecutter.project_slug }}/.woodpecker.yml @@ -1,5 +1,6 @@ pipeline: test: + group: test image: python:${PYTHON_VERSION} pull: true environment: @@ -9,6 +10,17 @@ pipeline: - poetry install - poetry run pytest + nix: + group: test + image: nixos/nix:latest + pull: true + commands: + - nix build --experimental-features 'nix-command flakes' + - nix build --experimental-features 'nix-command flakes' .#docker + when: + matrix: + PYTHON_VERSION: {{ cookiecutter. python_min_version}} # Still not sure about how to make flake for different python version + matrix: PYTHON_VERSION: - {{ cookiecutter. python_min_version}} diff --git a/{{ cookiecutter.project_slug }}/README.md b/{{ cookiecutter.project_slug }}/README.md index 1d18504..91f75a7 100644 --- a/{{ cookiecutter.project_slug }}/README.md +++ b/{{ cookiecutter.project_slug }}/README.md @@ -1,19 +1,42 @@ {% set is_open_source = cookiecutter.open_source_license != 'Proprietary' -%} {% set repo = "/".join(cookiecutter.git_origin.removesuffix(".git").split(":")[-1].split("/")[-2:]) %} # {{ cookiecutter.project_name }} -{% if cookiecutter.configure_ci %}[![CI status badge]({{ cookiecutter.woodpecker_server }}/api/badges/{{ repo }}/status.svg)](https://ci.pains-perdus.fr/histausse/test_ci_template){% endif %} +{% if cookiecutter.configure_ci == "True" %}[![CI status badge]({{ cookiecutter.woodpecker_server }}/api/badges/{{ repo }}/status.svg)](https://ci.pains-perdus.fr/histausse/test_ci_template){% endif %} {{ cookiecutter.project_short_description }} ## Install + +### With pip + This project can be installed using pip: ``` pip install git+{{ cookiecutter.project_url }}.git ``` +### With Nix + +There is a `flake.nix`, so you can clone the repo and use `nix shell` if you want. + +### Docker/Podman + +You can build a container image using nix. To build the image, in the repo, run: + +``` +nix build -o {{ cookiecutter.project_slug }}.img .#docker +``` + +You can then load the image with: + +``` +podman load < {{ cookiecutter.project_slug }}.img +``` + +(If you want to use the image, notice it uses nix and is very minimal). + {% if is_open_source %} ## License diff --git a/{{ cookiecutter.project_slug }}/flake.nix b/{{ cookiecutter.project_slug }}/flake.nix new file mode 100644 index 0000000..fbaaabc --- /dev/null +++ b/{{ cookiecutter.project_slug }}/flake.nix @@ -0,0 +1,36 @@ +{ + description = "{{ cookiecutter.project_short_description }}"; + + inputs.flake-utils.url = "github:numtide/flake-utils"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + inputs.poetry2nix = { + url = "github:nix-community/poetry2nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { self, nixpkgs, flake-utils, poetry2nix }: + flake-utils.lib.eachDefaultSystem (system: + let + inherit (poetry2nix.legacyPackages.${system}) mkPoetryApplication; + pkgs = nixpkgs.legacyPackages.${system}; + in + { + packages = { + {{ cookiecutter.project_slug }} = mkPoetryApplication { projectDir = self; }; + docker = pkgs.dockerTools.buildImage { + name = "{{ cookiecutter.project_slug }}"; + tag = "latest"; + copyToRoot = pkgs.buildEnv { + name = "{{ cookiecutter.project_slug }}_root_img"; + paths = [ self.packages.${system}.{{ cookiecutter.project_slug }} ]; + pathsToLink = [ "/bin" ]; + }; + }; + default = self.packages.${system}.{{ cookiecutter.project_slug }}; + }; + + devShells.default = pkgs.mkShell { + packages = [ poetry2nix.packages.${system}.poetry ]; + }; + }); +} From 3271450011977060f8e9c463c177476e677e1f92 Mon Sep 17 00:00:00 2001 From: Histausse Date: Sun, 21 May 2023 01:12:35 +0200 Subject: [PATCH 04/10] add some research --- TODO.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/TODO.md b/TODO.md index 038ff67..4924d6c 100644 --- a/TODO.md +++ b/TODO.md @@ -2,3 +2,17 @@ - publish to gitea repo: [container](https://docs.gitea.io/en-us/usage/packages/container/) [badge](https://docs.gitea.io/en-us/usage/packages/generic/) - use bool value for `generate_gitea_project` when the feature is available + +### Package + +``` +curl -i --upload-file README.md --user "histausse:`secret-tool lookup Title 'Gitea Token'`" https://git.pains-perdus.fr/api/packages/histausse/generic/test_flake_poetry2nix/latest/README.md +curl https://git.pains-perdus.fr/api/packages/histausse/generic/test_flake_poetry2nix/latest/README.md +curl -i -X DELETE --user "histausse:`secret-tool lookup Title 'Gitea Token'`" https://git.pains-perdus.fr/api/packages/histausse/generic/test_flake_poetry2nix/latest/pyproject.toml +``` + +``` +podman login -u histausse -p `secret-tool lookup Title 'Gitea Token'` git.pains-perdus.fr +podman push test_flake_poetry2nix:latest git.pains-perdus.fr/histausse/test_flake_poetry2nix:latest + +``` From 09c4d9537680e31c60262f8a1452dbc6a1d84d37 Mon Sep 17 00:00:00 2001 From: Histausse Date: Sun, 21 May 2023 16:48:51 +0200 Subject: [PATCH 05/10] add some reserche --- TODO.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/TODO.md b/TODO.md index 4924d6c..50a3468 100644 --- a/TODO.md +++ b/TODO.md @@ -16,3 +16,30 @@ podman login -u histausse -p `secret-tool lookup Title 'Gitea Token'` git.pains podman push test_flake_poetry2nix:latest git.pains-perdus.fr/histausse/test_flake_poetry2nix:latest ``` + +Put secret in CI: + +``` + connection.request( + "POST", + f"/api/repos/{repo}/secrets", + json.dumps( + { + "name": "test_token", + "value": "loren ispum", + "image": ["test"], + "event": ["push", "tag"], + } + ), + { + "Authorization": f"Bearer {API_KEY}", + "content-type": "application/json", + }, + ) +``` + + +Gen badge: +``` +https://github.com/smarie/python-genbadge/issues +``` From 721d134c6ac2cc509b97786526cd814af971cec5 Mon Sep 17 00:00:00 2001 From: Histausse Date: Tue, 23 May 2023 12:38:31 +0200 Subject: [PATCH 06/10] generate new gitea token for the CI --- hooks/post_gen_project.py | 59 +++++++++++++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 8 deletions(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index dfa5100..e48d01e 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -1,4 +1,6 @@ import subprocess +import http.client +import json import os REMOVE_PATHS = [ @@ -41,6 +43,33 @@ def get_secret(secret_name: str): "please enter you gitea api token:" ) +def get_new_gitea_token( + connection: http.client.HTTPSConnection, new_token_name: str, user: str, token: str +) -> str: + auth = b64encode(f"{user}:{token}".encode("utf-8")).decode("ascii") + connection.request( + "POST", + f"/api/v1/users/{user}/tokens", + json.dumps( + { + "name": new_token_name, + } + ), + { + "Authorization": f"Basic {auth}", + "content-type": "application/json", + }, + ) + response = connection.getresponse() + status = response.status + if status != 201: + print( + f"\033[38;2;255;0;0mInvalid response from gitea while creating a new token: {status} ({response.reason})\033[0m" + ) + exit(1) + data = json.load(response) + return data["sha1"] + if {{cookiecutter.generate_gitea_project}}: try: @@ -48,9 +77,9 @@ if {{cookiecutter.generate_gitea_project}}: except ModuleNotFoundError: print("module `giteapy` is not availabled, repository not created") exit() - API_KEY = get_secret("Gitea Token") + GITEA_API_KEY = get_secret("Gitea Token") configuration = giteapy.Configuration() - configuration.api_key["access_token"] = API_KEY + configuration.api_key["access_token"] = GITEA_API_KEY client = giteapy.ApiClient(configuration) client.configuration.host = "{{ cookiecutter.gitea_url }}/api/v1" api_instance = giteapy.UserApi(client) @@ -61,10 +90,6 @@ if {{cookiecutter.generate_gitea_project}}: if {{cookiecutter.generate_gitea_project}} and {{cookiecutter.configure_ci}}: - import http.client - - # import json - api_instance = giteapy.RepositoryApi(client) options = giteapy.AddCollaboratorOption("read") api_instance.repo_add_collaborator( @@ -73,7 +98,8 @@ if {{cookiecutter.generate_gitea_project}} and {{cookiecutter.configure_ci}}: "{{ cookiecutter.woodpecker_gitea_user }}", body=options, ) - + connection_gitea = http.client.HTTPSConnection("git.pains-perdus.fr") + GITEA_API_KEY = get_new_gitea_token(connection_gitea, "CI {{ cookiecutter.git_user }}/{{ cookiecutter.project_slug }}", "{{ cookiecutter.git_user }}", GITEA_API_KEY) API_KEY = get_secret("Woodpecker Token") WOODPECKER_SERVER = "{{ cookiecutter.woodpecker_server }}".removeprefix("https://") origin = "{{ cookiecutter.git_origin }}" @@ -111,4 +137,21 @@ if {{cookiecutter.generate_gitea_project}} and {{cookiecutter.configure_ci}}: if {{cookiecutter.generate_gitea_project}}: subprocess.call(["git", "remote", "add", "origin", "{{ cookiecutter.git_origin }}"]) - subprocess.call(["git", "push", "-u", "origin", "main"]) + subpr def get_new_gitea_token(): + """""" + connection.request( + "POST", + f"/api/repos/{repo}/secrets", + json.dumps( + { + "name": "test_token", + "value": "loren ispum", + "image": ["test"], + "event": ["push", "tag"], + } + ), + { + "Authorization": f"Bearer {API_KEY}", + "content-type": "application/json", + }, + )ocess.call(["git", "push", "-u", "origin", "main"]) From d6e0d933d8c181b08599db3264446a7458fdca43 Mon Sep 17 00:00:00 2001 From: Histausse Date: Tue, 23 May 2023 12:57:07 +0200 Subject: [PATCH 07/10] push token to woodpecker --- hooks/post_gen_project.py | 72 +++++++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 21 deletions(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index e48d01e..d5a995d 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -2,6 +2,7 @@ import subprocess import http.client import json import os +from base64 import b64encode REMOVE_PATHS = [ {% if cookiecutter.open_source_license == "Proprietary" %} "LICENSE", {% endif %} @@ -66,10 +67,46 @@ def get_new_gitea_token( print( f"\033[38;2;255;0;0mInvalid response from gitea while creating a new token: {status} ({response.reason})\033[0m" ) + print(response.read()) exit(1) data = json.load(response) return data["sha1"] +def push_woodpecker_secret( + connection: http.client.HTTPSConnection, + repo: str, + secret_name: str, + secret: str, + woodpecker_token: str, + images: list[str] | None = None +): + if images is None: images = [] + connection.request( + "POST", + f"/api/repos/{repo}/secrets", + json.dumps( + { + "name": secret_name, + "value": secret, + "image": images, + "event": ["push", "tag"], + } + ), + { + "Authorization": f"Bearer {woodpecker_token}", + "content-type": "application/json", + }, + ) + response = connection.getresponse() + status = response.status + if status != 200: + print( + f"\033[38;2;255;0;0mInvalid response from woodpecker when sending a new secret: {status} ({response.reason})\033[0m" + ) + print(response.read()) + exit(1) + response.read() + if {{cookiecutter.generate_gitea_project}}: try: @@ -100,15 +137,16 @@ if {{cookiecutter.generate_gitea_project}} and {{cookiecutter.configure_ci}}: ) connection_gitea = http.client.HTTPSConnection("git.pains-perdus.fr") GITEA_API_KEY = get_new_gitea_token(connection_gitea, "CI {{ cookiecutter.git_user }}/{{ cookiecutter.project_slug }}", "{{ cookiecutter.git_user }}", GITEA_API_KEY) - API_KEY = get_secret("Woodpecker Token") + WOODPECKER_API_KEY = get_secret("Woodpecker Token") WOODPECKER_SERVER = "{{ cookiecutter.woodpecker_server }}".removeprefix("https://") origin = "{{ cookiecutter.git_origin }}" repo = "/".join(origin.removesuffix(".git").split(":")[-1].split("/")[-2:]) + connection = http.client.HTTPSConnection(WOODPECKER_SERVER) connection.request( "GET", "/api/user/repos?all=true&flush=true", - headers={"Authorization": f"Bearer {API_KEY}"}, + headers={"Authorization": f"Bearer {WOODPECKER_API_KEY}"}, ) response = connection.getresponse() status = response.status @@ -123,7 +161,7 @@ if {{cookiecutter.generate_gitea_project}} and {{cookiecutter.configure_ci}}: "POST", f"/api/repos/{repo}", headers={ - "Authorization": f"Bearer {API_KEY}", + "Authorization": f"Bearer {WOODPECKER_API_KEY}", "referer": f"https://{WOODPECKER_SERVER}/repo/add", }, ) @@ -133,25 +171,17 @@ if {{cookiecutter.generate_gitea_project}} and {{cookiecutter.configure_ci}}: print( f"\033[38;2;255;0;0mInvalid response from woodpecker while linking repo: {status} ({response.reason})\033[0m" ) + print(response.read()) exit(1) + response.read() + push_woodpecker_secret( + connection, + repo, + "gitea_token", + GITEA_API_KEY, + WOODPECKER_API_KEY + ) if {{cookiecutter.generate_gitea_project}}: subprocess.call(["git", "remote", "add", "origin", "{{ cookiecutter.git_origin }}"]) - subpr def get_new_gitea_token(): - """""" - connection.request( - "POST", - f"/api/repos/{repo}/secrets", - json.dumps( - { - "name": "test_token", - "value": "loren ispum", - "image": ["test"], - "event": ["push", "tag"], - } - ), - { - "Authorization": f"Bearer {API_KEY}", - "content-type": "application/json", - }, - )ocess.call(["git", "push", "-u", "origin", "main"]) + subprocess.call(["git", "push", "-u", "origin", "main"]) From 48c95b975ac80e3792b3c477148b5f5e1323f556 Mon Sep 17 00:00:00 2001 From: Histausse Date: Wed, 24 May 2023 12:33:11 +0200 Subject: [PATCH 08/10] push docker with CI --- hooks/post_gen_project.py | 1 + .../.woodpecker.yml | 19 ++++++++++++++++--- {{ cookiecutter.project_slug }}/README.md | 10 +++++++++- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index d5a995d..c2e94cf 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -16,6 +16,7 @@ for path in REMOVE_PATHS: else: os.unlink(path) +subprocess.call(["poetry", "lock"]) subprocess.call(["git", "init"]) subprocess.call(["git", "checkout", "-b", "main"]) subprocess.call(["git", "add", "*"]) diff --git a/{{ cookiecutter.project_slug }}/.woodpecker.yml b/{{ cookiecutter.project_slug }}/.woodpecker.yml index d00a7e9..5cafcce 100644 --- a/{{ cookiecutter.project_slug }}/.woodpecker.yml +++ b/{{ cookiecutter.project_slug }}/.woodpecker.yml @@ -16,11 +16,24 @@ pipeline: pull: true commands: - nix build --experimental-features 'nix-command flakes' - - nix build --experimental-features 'nix-command flakes' .#docker + - nix build -o image_link --experimental-features 'nix-command flakes' .#docker + - cp image_link image when: matrix: - PYTHON_VERSION: {{ cookiecutter. python_min_version}} # Still not sure about how to make flake for different python version + PYTHON_VERSION: {{ cookiecutter.python_min_version}} # Still not sure about how to make flake for different python version + + push_image: + image: quay.io/podman/stable:latest + pull: true + commands: + - podman login -u {{ cookiecutter.git_user }} -p $GITEA_TOKEN {{ cookiecutter.gitea_url.removeprefix('https://') }} + - podman load < image + - podman push {{ cookiecutter.project_slug }}:latest {{ cookiecutter.gitea_url.removeprefix('https://') }}/{{ cookiecutter.git_user }}/{{ cookiecutter.project_slug }}:latest + secrets: [ gitea_token ] + when: + matrix: + PYTHON_VERSION: {{ cookiecutter.python_min_version}} # Still not sure about how to make flake for different python version matrix: PYTHON_VERSION: - - {{ cookiecutter. python_min_version}} + - {{ cookiecutter.python_min_version}} diff --git a/{{ cookiecutter.project_slug }}/README.md b/{{ cookiecutter.project_slug }}/README.md index 91f75a7..f447e57 100644 --- a/{{ cookiecutter.project_slug }}/README.md +++ b/{{ cookiecutter.project_slug }}/README.md @@ -23,6 +23,13 @@ There is a `flake.nix`, so you can clone the repo and use `nix shell` if you wan ### Docker/Podman +{% if cookiecutter.configure_ci == "True" %} +You can run this projet with docker or podman: + +``` +podman run --rm -it {{ cookiecutter.gitea_url.removeprefix('https://') }}/{{ cookiecutter.git_user }}/{{ cookiecutter.project_slug }}:latest {{ cookiecutter.project_slug }} +``` +{% else %} You can build a container image using nix. To build the image, in the repo, run: ``` @@ -34,8 +41,9 @@ You can then load the image with: ``` podman load < {{ cookiecutter.project_slug }}.img ``` +{% endif %} -(If you want to use the image, notice it uses nix and is very minimal). +Notice the image is build with nix and is very minimalist. {% if is_open_source %} ## License From 99cf060e08adee83b3d98f08d68c3b94ee4f8529 Mon Sep 17 00:00:00 2001 From: Histausse Date: Sat, 27 May 2023 18:20:07 +0200 Subject: [PATCH 09/10] fix badge url --- {{ cookiecutter.project_slug }}/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{ cookiecutter.project_slug }}/README.md b/{{ cookiecutter.project_slug }}/README.md index f447e57..b1419ec 100644 --- a/{{ cookiecutter.project_slug }}/README.md +++ b/{{ cookiecutter.project_slug }}/README.md @@ -1,7 +1,7 @@ {% set is_open_source = cookiecutter.open_source_license != 'Proprietary' -%} {% set repo = "/".join(cookiecutter.git_origin.removesuffix(".git").split(":")[-1].split("/")[-2:]) %} # {{ cookiecutter.project_name }} -{% if cookiecutter.configure_ci == "True" %}[![CI status badge]({{ cookiecutter.woodpecker_server }}/api/badges/{{ repo }}/status.svg)](https://ci.pains-perdus.fr/histausse/test_ci_template){% endif %} +{% if cookiecutter.configure_ci == "True" %}[![CI status badge]({{ cookiecutter.woodpecker_server }}/api/badges/{{ repo }}/status.svg)](https://ci.pains-perdus.fr/{{ repo }}){% endif %} {{ cookiecutter.project_short_description }} From ad7b9ec60223c7a06e7868f40077587b9a0656a5 Mon Sep 17 00:00:00 2001 From: Histausse Date: Mon, 19 Jun 2023 12:32:26 +0200 Subject: [PATCH 10/10] config git before first commit --- hooks/post_gen_project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index c2e94cf..9aae08c 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -20,9 +20,9 @@ subprocess.call(["poetry", "lock"]) subprocess.call(["git", "init"]) subprocess.call(["git", "checkout", "-b", "main"]) subprocess.call(["git", "add", "*"]) -subprocess.call(["git", "commit", "-m", "Initial commit"]) subprocess.call(["git", "config", "user.name", "{{ cookiecutter.git_user }}"]) subprocess.call(["git", "config", "user.email", "{{ cookiecutter.email }}"]) +subprocess.call(["git", "commit", "-m", "Initial commit"]) # subprocess.call(["python", "-m", "venv", "venv"])