Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/taskgraph/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ def init_taskgraph(options):
shutil.rmtree(tg_dir)

# Populate some defaults from the current repository.
context = {"project_name": root.name}
context = {"project_name": root.name, "taskgraph_version": taskgraph.__version__}

try:
repo_url = repo.get_url(remote=repo.remote_name) # type: ignore
Expand Down
1 change: 1 addition & 0 deletions template/cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"project_name": "my-project",
"taskgraph_version": "{{ cookiecutter.taskgraph_version }}",
Copy link
Collaborator

@ahal ahal Jun 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will work. The template context comes from the other variables in this file, so this seems like it would lead to some kind of recursion error?

Instead this is supposed to contain the default value we use for this key in case cookiecutter is ran with interactive mode disabled. That being said, I don't think we should prompt for this value anyway. Instead we should either use latest or the same version as what they are running taskgraph init with.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'm not sure, I was going from https://cookiecutter.readthedocs.io/en/stable/advanced/injecting_context.html which seems to be doing something similar?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, we should definitely use the same version as what they ran taskgraph init with. Otherwise, the generated graph might fail inside the Decision task.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I think I missed the extra context being passed in there. And thanks for the link.

"repo_host": ["github", "hgmo"],
"repo_name": "my-repo",
"project_slug": "{{ cookiecutter.repo_name.lower().replace(' ', '_').replace('-', '_') }}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ tasks:
${normProjectUpper}_HEAD_REF: '${short_head_ref}'
${normProjectUpper}_HEAD_REV: '${head_sha}'
${normProjectUpper}_REPOSITORY_TYPE: git
${normProjectUpper}_PIP_REQUIREMENTS: taskcluster/requirements.txt
REPOSITORIES:
$json:
${normProject}: ${normProject}
Expand All @@ -225,7 +224,7 @@ tasks:
features:
taskclusterProxy: true

image: mozillareleases/taskgraph:decision-c4ac262880970ca484105929e02dd12f00214d5f2603ab6ce4c0d17de5cd0280@sha256:2dd667994aa13fccdcdcede85c570a5eb4a5247e42875a9e95a135ef774ee469
image: mozillareleases/taskgraph:decision-v{{ cookiecutter.taskgraph_version }}
maxRunTime: 1800

command:
Expand All @@ -241,12 +240,11 @@ tasks:
then: >
cd /builds/worker/checkouts/src &&
ln -s /builds/worker/artifacts artifacts &&
pip3 install -r requirements/base.txt &&
~/.local/bin/taskgraph action-callback
taskgraph action-callback
else: >
cd /builds/worker/checkouts/src &&
ln -s /builds/worker/artifacts artifacts &&
~/.local/bin/taskgraph decision
taskgraph decision
--pushlog-id='0'
--pushdate='0'
--project='${project}'
Expand Down
10 changes: 3 additions & 7 deletions template/{{cookiecutter.project_name}}/taskcluster.hgmo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ tasks:
${normProjectUpper}_HEAD_REF: '${head_ref}'
${normProjectUpper}_HEAD_REV: '${head_sha}'
${normProjectUpper}_REPOSITORY_TYPE: git
${normProjectUpper}_PIP_REQUIREMENTS: taskcluster/requirements.txt
REPOSITORIES:
$json:
${normProject}: ${normProject}
Expand All @@ -141,10 +140,7 @@ tasks:
features:
taskclusterProxy: true

# Note: This task is built server side without the context or tooling that
# exist in tree so we must hard code the hash
image:
mozillareleases/taskgraph:decision-c4ac262880970ca484105929e02dd12f00214d5f2603ab6ce4c0d17de5cd0280@sha256:2dd667994aa13fccdcdcede85c570a5eb4a5247e42875a9e95a135ef774ee469
image: mozillareleases/taskgraph:decision-v{{ cookiecutter.taskgraph_version }}

maxRunTime: 1800

Expand All @@ -163,10 +159,10 @@ tasks:
then: >
cd /builds/worker/checkouts/src &&
ln -s /builds/worker/artifacts artifacts &&
~/.local/bin/taskgraph action-callback
taskgraph action-callback
else: >
ln -s /builds/worker/artifacts artifacts &&
~/.local/bin/taskgraph decision
taskgraph decision
--pushlog-id='${push.pushlog_id}'
--pushdate='${push.pushdate}'
--project='${project}'
Expand Down

This file was deleted.

Loading