Fix #51
* fix: correcting regex for formatting string #51 * ci: add cron.yml --------- Co-authored-by: Xyphuz <38447974+wst24365888@users.noreply.github.com>
This commit is contained in:
parent
0ffcc16b61
commit
36d18a6300
6 changed files with 50 additions and 1 deletions
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
@ -25,6 +25,10 @@ jobs:
|
|||
with:
|
||||
python-version: '3.10.4'
|
||||
|
||||
- name: Changing naming convention
|
||||
run: |
|
||||
python3 naming.py
|
||||
|
||||
- name: Setup Poetry
|
||||
uses: abatilo/actions-poetry@v3
|
||||
with:
|
||||
|
|
20
.github/workflows/cron.yml
vendored
Normal file
20
.github/workflows/cron.yml
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
name: CRON
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
jobs:
|
||||
#renew git submodule
|
||||
update:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: update compose-spec submodule
|
||||
run: |
|
||||
git submodule update --init --recursive
|
||||
git submodule update --remote --recursive
|
||||
- name: Commit changes
|
||||
run: |
|
||||
git commit -am "Update submodules" || echo "No changes to commit"
|
||||
git push
|
|
@ -107,7 +107,7 @@ class Parser:
|
|||
container_port = str(int(port_data))
|
||||
host_port = f"0.0.0.0:{container_port}"
|
||||
elif type(port_data) is str:
|
||||
regex = r"((?P<host_ip>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:)|:)?((?P<host_port>\d+(\-\d+)?):)?((?P<container_port>\d+(\-\d+)?))?(/(?P<protocol>\w+))?" # noqa: E501
|
||||
regex = r"((?P<host_ip>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:|(\$\{([^}]+)\}):)|:|)?((?P<host_port>\d+(\-\d+)?):)?((?P<container_port>\d+(\-\d+)?))?(/(?P<protocol>\w+))?" # noqa: E501
|
||||
match = re.match(regex, port_data)
|
||||
|
||||
if match:
|
||||
|
|
20
naming.py
Normal file
20
naming.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
def revise_naming_convention():
|
||||
name_mapping = {
|
||||
"EnvFile1": "EnvFilePath",
|
||||
"Volume1": "AdditionalVolumeOption",
|
||||
"External": "ExternalVolumeNetwork",
|
||||
"External1": "ExternalConfig",
|
||||
}
|
||||
|
||||
with open("./compose_viz/spec/compose_spec.py", "r") as spec_file:
|
||||
spec_content = spec_file.read()
|
||||
|
||||
for origin_name, new_name in name_mapping.items():
|
||||
spec_content.replace(origin_name, new_name)
|
||||
|
||||
return
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
revise_naming_convention()
|
||||
print("Revised naming convention successfully!")
|
|
@ -176,6 +176,10 @@ from compose_viz.parser import Parser
|
|||
host_port="0.0.0.0:7777",
|
||||
container_port="7777",
|
||||
),
|
||||
Port(
|
||||
host_port="${BIND_IP:-127.0.0.1}:8080",
|
||||
container_port="8080",
|
||||
),
|
||||
Port(
|
||||
host_port="127.0.0.1:8080",
|
||||
container_port="80",
|
||||
|
|
|
@ -12,6 +12,7 @@ services:
|
|||
- "127.0.0.1:5000-5010:5000-5010"
|
||||
- "6060:6060/udp"
|
||||
- ":7777"
|
||||
- "${BIND_IP:-127.0.0.1}:8080:8080"
|
||||
- target: 80
|
||||
host_ip: 127.0.0.1
|
||||
published: 8080
|
||||
|
|
Loading…
Reference in a new issue