Skip to content

Commit

Permalink
Try omitting the workingDirectory
Browse files Browse the repository at this point in the history
  • Loading branch information
cccs-rs committed Dec 23, 2024
1 parent 6a9f668 commit b4095e9
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions pipelines/templates/steps/publish-description.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,39 @@ steps:
inputs:
scriptSource: "inline"
script: |
print("TEST")
workingDirectory: $(Pipeline.Workspace)/working
import httpx
import os
git_repo = "${{ parameters.github_repo }}"
docker_repo ="${{ parameters.dockerhub_repo }}" or git_repo
readme_path = os.path.join(git_repo, "README.md")
print(git_repo, docker_repo, readme_path)
if os.path.exists(readme_path):
with open(readme_path) as f:
body = {
"full_description": f.read(),
}
url = f"https://api.github.com/repos/CybercentreCanada/{git_repo}"
rsp = httpx.get(url)
body["description"] = rsp.json().get("description", "")
token = os.environ["TKN"]
headers = {
"Authorization": f"JWT {token}"
}
url = f"https://hub.docker.com/v2/namespaces/cccs/repositories/{docker_repo}"
print(f"{url=}")
rsp = httpx.patch(
url,
headers=headers,
json=body
)
rsp.raise_for_status()
print(rsp.text)
env:
TKN: $(tkn)
displayName: Upload readme to dockerhub
Expand Down Expand Up @@ -94,7 +125,6 @@ steps:
)
rsp.raise_for_status()
print(rsp.text)
workingDirectory: $(Pipeline.Workspace)/working
env:
TKN: $(tkn)
displayName: Update dockhub categories
Expand Down

0 comments on commit b4095e9

Please sign in to comment.