使用Git中跟踪的降价文件发布和管理汇流空间。
confluence-junction的Python项目详细描述
使用Junction,您可以使用Markdown和现有的Git工作流(拉取请求、代码评审、发布分支等),直接在代码库中编写和管理文档,然后自动将更改发布到conference。这为您提供了最好的两个世界:在回购文档中,本机适合您的开发工作流程,具有发现性和汇流的中心性。在
安装
确保您使用的是python3.8(或更新版本);Junction不适用于旧版本的Python。使用pip
安装:
pip install confluence-junction
这将安装库和CLI。 在Python代码中:
^{pr2}$在你的壳里:
junction --help
概述
Junction的工作原理是逐个提交检查Git存储库中所做的更改,并确定需要更改哪些内容才能反映这些更改。Junction(当前)期望管理整个space in Confluence。因此,当使用连接时,必须告诉它要将哪个空间作为目标并进行更新。您不能手动更改、创建或修改目标空间中的页面,否则Junction可能无法将Git中的状态与conference中的状态同步。在
为了允许将代码(和其他项目)与Junction的降价文件混合在一个存储库中,可以告诉Junction存储库中作为根的子路径,例如,所有的降价文件都将保存在docs/
中。所有文件都应以.md
扩展名结尾。在
页面将从文件名中获取标题,其内容将转换为聚合标记。见this example for what output looks like in Confluence。在
使用
收集Junction将用于登录Confluence的一组凭据。您需要创建一个API token来代替密码。我建议您创建一个专用的用户帐户,其访问权限仅限于您要使用Junction管理的空间。在
在git存储库中,创建要发布的文件夹结构和标记文件。提交这些更改。在
.
├── (your code and other files)
└── docs/
├── Welcome.md
├── Installation.md
└── Advanced Usage
| ├── Airflow.md
| ├── Visual Studio Online.md
| ├── Atlassian Bamboo.md
| └── GitHub Actions.md
└── Credits.md
Junction被设计成一个库,还提供了“助手”,使得在不同的上下文中使用它变得容易(尤其是作为自动工作流的一部分,例如在后推式构建中)。在
使用Junction的最简单方法是included CLIjunction
:
junction -s "SPACE_KEY" -c "https://jihugh.atlassian.net/wiki/rest/api" -u "account@email.com" -p "YOUR_API_ACCESS_TOKEN" delta --content-path docs/ HEAD~5 master
You can put the API, user, and key into environment variables to avoid specifying them for every invocation of Junction. The variables are
CONFLUENCE_API
,CONFLUENCE_API_USER
, andCONFLUENCE_API_KEY
respectively.
CLI有完整的文档记录,因此请使用--help
选项来导航所有配置选项。在
干运行
您可以使用junction
标志检查junction
CLI将对您的空间做什么,而无需实际将更改上载到Confluence。在
Python库
使用Python库可以创建自己的包装器和工具,例如flow DAG。下面是Python中上述CLI用法的等效用法:
frompathlibimportPathfromgitimportRepofromjunction.gitimportfind_commits_on_branch_after,filter_modifications_to_folder,get_modificationsfromjunction.deltaimportDeltafromjunction.confluenceimportConfluencecf=Confluence("https://jihugh.atlassian.net/wiki/rest/api","account@email.com","YOUR_API_ACCESS_TOKEN","SPACE_KEY")repo=Repo(".").# current working directory must be the root of the Git repository for this to workcommits=find_commits_on_branch_after("master","HEAD~5",repo)deltas=[Delta.from_modifications(filter_modifications_to_folder(get_modification(commit),Path("docs/")))forcommitincommits]fordeltaindeltas:delta.execute(cf)
输出示例
下面的markdown示例存储在Sample.md
中,生成一个合流的页面,看起来像this。这显示了所有主要支持的特性和标记。它有意地与GitHub风格的markdown非常相似,只是有一些扩展和差异来解释特定于汇流的特性。在
# Text
It's very easy to make some words **bold** and other words *italic* with Markdown. You can even [link to Google!](http://google.com).
Even some fancy formats like Subscripts~with tilde~ and Superscripts^with caret^.
# Lists
Sometimes you want numbered lists:
1. One
2. Two
3. Three
Sometimes you want bullet points:
* Start a line with a star
* Profit!
Alternatively,
- Dashes work just as well
- And if you have sub points, put four spaces before the dash or star:
- Like this
- And this
# Headers
Sometimes it's useful to have different levels of headings to structure your documents. Start lines with a `#` to create headings. Multiple `##` in a row denote smaller heading sizes.
### This is a third-tier heading
You can use one `#` all the way up to `######` six for different heading sizes.
# Blockquotes
If you'd like to quote someone, use the > character before the line:
> Coffee. The finest organic suspension ever devised... I beat the Borg with it.
> - Captain Janeway
# Code
You can embed `inline code fragments` by surrounding it in backticks. For longer blocks of
code, use "code fencing":
```
if (isAwesome){
return true
}
```
And if you'd like to use syntax highlighting, include the language:
```php
<?php
echo "Hello World"
?>
```
# Tables
You can create tables by assembling a list of words and dividing them with hyphens `-` (for the first row), and then separating each column with a pipe `|`:
First Header | Second Header
------------ | -------------
Content from cell 1 | Content from cell 2
Content in the first column | Content in the second column
# Confluence-specific Elements
You can link to other wiki pages by referencing their page titles. Use normal link syntax, but prepend a `&` like &[this](Page Title).
## Supported Macros
You can embed the Confluence child pages macro by placing it on its own line:
:include-children:
...or the table of contents macro:
:include-toc:
## Status Blocks
You can create Confluence status macros (colored pills), including in the middle of the line &status-green:like this;
&status-green:Complete; &status-yellow:In Progress; &status-grey:Planning; &status-red:Failed; &status-blue:Unknown; &status-purple:Cancelled;
## Info Panels
Info: You can create info panels by prepending a paragraph with one of `Info:`, `Warning:`, `Error:`, or `Success:`.
Warning: The prefix will be removed from the contents.
Error: You cannot put multiple paragraphs inside an info panel, just a single block of text
like this.
Success: like other block elements, each info panel must be located on its own line (fenced between two new lines).
贡献
这是我的一个业余爱好项目,我可能不能立即按要求去做。如果你对投稿感兴趣,可以按the contribution guidelines打开一个公关。在
- 项目
标签: