Skip to content

Commit 68cbb7b

Browse files
committed
Merge remote-tracking branch 'origin/main' into hotfix/2.3-merge
# Conflicts: # charmcraft/charm_builder.py # requirements-dev.txt # requirements.txt # tests/test_providers.py
2 parents af11b6b + 5785834 commit 68cbb7b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+8137
-1569
lines changed

.github/ISSUE_TEMPLATE/bug.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Bug Report
2+
description: File a bug report
3+
labels: "Bug"
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: >
8+
Thanks for taking the time to fill out this bug report! Before
9+
submitting your issue, make sure this has not been already
10+
reported or if it works with the latest published version
11+
of Charmcraft.
12+
- type: textarea
13+
id: bug-description
14+
attributes:
15+
label: Bug Description
16+
description: >
17+
If applicable, add screenshots to help explain your
18+
problem.
19+
validations:
20+
required: true
21+
- type: textarea
22+
id: reproduction
23+
attributes:
24+
label: To Reproduce
25+
description: >
26+
Provide a step-by-step instruction of how to reproduce the behavior.
27+
validations:
28+
required: true
29+
- type: textarea
30+
id: environment
31+
attributes:
32+
label: Environment
33+
description: >
34+
We need to know a bit more about the context in which Snapcraft failed.
35+
- Are you running Charmcraft in destructive-mode, using LXD or Multipass.
36+
- On what system is Charmcraft running (e.g.; Ubuntu 22.04 LTS, Windows 11,
37+
OS X 10.15).
38+
validations:
39+
required: true
40+
- type: textarea
41+
id: charmcraft_yaml
42+
attributes:
43+
label: charmcraft.yaml
44+
description: >
45+
If possible, please paste your charmcraft.yaml contents. This
46+
will be automatically formatted into code, so no need for
47+
backticks.
48+
render: shell
49+
validations:
50+
required: true
51+
- type: textarea
52+
id: logs
53+
attributes:
54+
label: Relevant log output
55+
description: >
56+
Please copy and paste any relevant log output. This will be
57+
automatically formatted into code, so no need for backticks.
58+
render: shell
59+
validations:
60+
required: true
61+

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Charmcraft Discourse
4+
url: https://discourse.charmhub.io/c/charmcraft/3
5+
about: Issues creating charms
6+
- name: Documentation Issues
7+
url: https://discourse.charmhub.io/c/doc/22
8+
about: Documentation Improvements

.github/ISSUE_TEMPLATE/task.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Task
2+
description: File an enhancement proposal
3+
labels: "Enhancement"
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: >
8+
Thanks for taking the time to fill out this enhancement
9+
proposal! Before submitting your issue, please make sure there
10+
isn't already a prior issue concerning this. If there is,
11+
please join that discussion instead.
12+
- type: textarea
13+
id: enhancement-proposal-what
14+
attributes:
15+
label: What needs to get done
16+
description: >
17+
Describe what needs to get done
18+
validations:
19+
required: true
20+
- type: textarea
21+
id: enhancement-proposal-why
22+
attributes:
23+
label: Why it needs to get done
24+
description: >
25+
Describe why it needs to get done
26+
validations:
27+
required: true

.github/renovate.json5

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
}
5959
],
6060
timezone: "Etc/UTC",
61-
automergeSchedule: "before 07:00",
62-
schedule: "every weekend",
61+
automergeSchedule: ["before 07:00"],
62+
schedule: ["every weekend"],
6363
prConcurrentLimit: 5, // No more than 5 open PRs at a time.
6464
prCreation: "not-pending", // Wait until status checks have completed before raising the PR
6565
prNotPendingHours: 4, // ...unless the status checks have been running for 4+ hours.

.github/workflows/issues.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# this workflow requires to provide JIRA webhook URL via JIRA_URL GitHub Secret
2+
# read more: https://support.atlassian.com/cloud-automation/docs/jira-automation-triggers/#Automationtriggers-Incomingwebhook
3+
# original code source: https://github.com/beliaev-maksim/github-to-jira-automation
4+
5+
name: Issues to JIRA
6+
7+
on:
8+
issues:
9+
# available via github.event.action
10+
types: [opened, reopened, closed]
11+
12+
jobs:
13+
update:
14+
name: Update Issue
15+
uses: beliaev-maksim/github-to-jira-automation/.github/workflows/issues_to_jira.yaml@master
16+
secrets:
17+
JIRA_URL: ${{ secrets.JIRA_URL }}

charmcraft/bases.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
from typing import Tuple, Union
2020

21-
from charmcraft.config import Base
21+
from charmcraft.models.charmcraft import Base
2222
from charmcraft.utils import get_host_architecture, get_os_platform
2323

2424

@@ -51,7 +51,14 @@ def check_if_base_matches_host(base: Base) -> Tuple[bool, Union[str, None]]:
5151
if host_base.name != base.name:
5252
return False, f"name {base.name!r} does not match host {host_base.name!r}"
5353

54-
if host_base.channel != base.channel:
54+
# For Ubuntu, MacOS and Windows, use the full version.
55+
# For other OSes, use the major version only.
56+
57+
if host_base.name in ("ubuntu", "darwin", "windows"):
58+
host_channel = host_base.channel
59+
else:
60+
host_channel = host_base.channel.split(".")[0]
61+
if host_channel != base.channel:
5562
return (
5663
False,
5764
f"channel {base.channel!r} does not match host {host_base.channel!r}",

charmcraft/charm_builder.py

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,32 +31,19 @@
3131

3232
from charmcraft import instrum
3333
from charmcraft.commands.store.charmlibs import collect_charmlib_pydeps
34+
from charmcraft.const import (
35+
DEPENDENCIES_HASH_FILENAME,
36+
DISPATCH_CONTENT,
37+
DISPATCH_FILENAME,
38+
HOOKS_DIRNAME,
39+
MANDATORY_HOOK_NAMES,
40+
STAGING_VENV_DIRNAME,
41+
VENV_DIRNAME,
42+
)
3443
from charmcraft.env import get_charm_builder_metrics_path
3544
from charmcraft.jujuignore import JujuIgnore, default_juju_ignore
3645
from charmcraft.utils import make_executable
3746

38-
# Some constants that are used through the code.
39-
WORK_DIRNAME = "work_dir"
40-
VENV_DIRNAME = "venv"
41-
STAGING_VENV_DIRNAME = "staging-venv"
42-
DEPENDENCIES_HASH_FILENAME = "charmcraft-dependencies-hash.txt"
43-
44-
# The file name and template for the dispatch script
45-
DISPATCH_FILENAME = "dispatch"
46-
# If Juju doesn't support the dispatch mechanism, it will execute the
47-
# hook, and we'd need sys.argv[0] to be the name of the hook but it's
48-
# getting lost by calling this dispatch, so we fake JUJU_DISPATCH_PATH
49-
# to be the value it would've otherwise been.
50-
DISPATCH_CONTENT = """#!/bin/sh
51-
52-
JUJU_DISPATCH_PATH="${{JUJU_DISPATCH_PATH:-$0}}" PYTHONPATH=lib:venv \\
53-
exec ./{entrypoint_relative_path}
54-
"""
55-
56-
# The minimum set of hooks to be provided for compatibility with old Juju
57-
MANDATORY_HOOK_NAMES = {"install", "start", "upgrade-charm"}
58-
HOOKS_DIR = "hooks"
59-
6047

6148
def relativise(src, dst):
6249
"""Build a relative path from src to dst."""
@@ -204,7 +191,7 @@ def handle_dispatcher(self, linked_entrypoint):
204191
# bunch of symlinks, to support old juju: verify that any of the already included hooks
205192
# in the directory is not linking directly to the entrypoint, and also check all the
206193
# mandatory ones are present
207-
dest_hookpath = self.installdir / HOOKS_DIR
194+
dest_hookpath = self.installdir / HOOKS_DIRNAME
208195
if not dest_hookpath.exists():
209196
dest_hookpath.mkdir()
210197

0 commit comments

Comments
 (0)