Skip to content

Commit 24dc3d0

Browse files
committed
updated spec .json path
1 parent 461395b commit 24dc3d0

File tree

3 files changed

+15
-32
lines changed

3 files changed

+15
-32
lines changed

azure/common/apigee-build.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,6 @@ jobs:
253253
workingDirectory: "${{ parameters.service_name }}"
254254
displayName: "Copy utils into artifact"
255255
256-
- bash: |
257-
pwd
258-
ls
259-
workingDirectory: "${{ parameters.service_name }}"
260-
displayName: "View files in current directory"
261-
262256
- bash: |
263257
set -euo pipefail
264258
export DIST_DIR=`pwd`/dist

azure/common/deploy-stage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ stages:
278278
pip install json
279279
pip install boto3
280280
281-
python copy_spec.py "nhsd-apm-management-ptl-proxygen" "${{ parameters.service_name }}"
281+
python copy_spec.py "nhsd-apm-management-ptl-proxygen" "${{ parameters.service_name }} $(System.DefaultWorkingDirectory)"
282282
displayName: Copy Spec
283283
284284
- ${{ if parameters.notify }}:

scripts/copy_spec.py

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -48,34 +48,21 @@ def main(bucket_name: str, repo_name: str):
4848

4949
cwd = os.getcwd()
5050
print("Current working directory:", cwd)
51-
52-
spec_dir = f"{repo_name}/Specification"
53-
54-
print(f"[INFO] Checking for Specification folder at: {spec_dir}")
55-
56-
if not spec_dir.exists():
57-
print("[SKIP] No Specification folder found — skipping all processing.")
58-
return 0
59-
60-
yaml_files = list(spec_dir.glob("*.yaml")) + list(spec_dir.glob("*.yml"))
6151

62-
if not yaml_files:
63-
print("[SKIP] Specification folder exists, but no YAML files found — skipping.")
64-
return 0
65-
66-
output_dir = Path("spec_output")
67-
output_dir.mkdir(exist_ok=True)
68-
69-
generated_files = []
52+
os.chdir(working_directory)
53+
cmdNew = os.getcwd()
54+
print("New working directory:", cmdNew)
55+
56+
#spec_dir = f"{repo_name}/Specification"
7057

71-
print(f"[INFO] Found {len(yaml_files)} YAML file(s). Converting...")
58+
#print(f"[INFO] Checking for Specification folder at: {spec_dir}")
7259

73-
for yaml_file in yaml_files:
74-
json_file = convert_yaml_to_json(yaml_file, output_dir)
75-
generated_files.append(json_file)
60+
#if not spec_dir.exists():
61+
# print("[SKIP] No Specification folder found — skipping all processing.")
62+
# return 0
7663

77-
print(f"[INFO] Uploading {len(generated_files)} file(s) to S3 bucket '{bucket_name}'...")
78-
for json_file in generated_files:
64+
json_file = list(Path(working_directory).glob("*.json"))
65+
if json_file:
7966
upload_to_s3(json_file, bucket_name, repo_name)
8067

8168
print("[DONE] Processing complete.")
@@ -85,12 +72,14 @@ def main(bucket_name: str, repo_name: str):
8572
if __name__ == "__main__":
8673
print("Hitting main")
8774
if len(sys.argv) != 3:
88-
print("Usage: python copy_spec_to_s3.py <s3_bucket_name> <repo_name>")
75+
print("Usage: python copy_spec_to_s3.py <s3_bucket_name> <repo_name> <Working Directory>")
8976
sys.exit(1)
9077

9178
bucket_name = sys.argv[1]
9279
repo_name = sys.argv[2]
80+
working_directory = sys.argv[3]
9381
print(f"Repo name: {repo_name}")
9482
print(f"Bucket name: {bucket_name}")
83+
print(f"Working Directory: {working_directory}")
9584

9685
sys.exit(main(bucket_name,repo_name))

0 commit comments

Comments
 (0)