github.com/gocrane/crane@v0.11.0/docs/mirror.zh.md (about)

     1  # 镜像资源
     2  
     3  ## 关于镜像资源
     4  
     5  因为各种网络问题,导致部分地域难以访问GitHub 资源,如GitHub Repo, GitHub Release, GitHub Raw Content `raw.githubusercontent.com`。
     6  
     7  为了更好的使用体验,GoCrane 为您额外提供了多个镜像仓库,但具有一定的时延。
     8  
     9  ## Image Registry
    10  
    11  GoCrane提供了一种友好的方式来使用镜像进行部署和测试。
    12  
    13  GoCrane使用CI(GitHub Action)进行镜像构建。
    14  
    15  ### Platforms
    16  
    17  GoCrane 现在支持 linux/amd64 和 linux/arm64。
    18  
    19  GoCrane 也在关注ARM用户,譬如 apple m1/m2。
    20  
    21  ### Repo
    22  
    23  由于网络原因,GoCrane 将同时将镜像推送到三个镜像仓库。
    24  
    25  !!! tips
    26      点击链接,查阅更多
    27  
    28  - [DockerHub](https://hub.docker.com/u/gocrane)
    29  - [Coding](https://finops.coding.net/public-artifacts/gocrane/crane/packages)
    30  - [GitHub Container Registry](https://github.com/orgs/gocrane/packages?repo_name=crane)
    31  
    32  如果你在中国,我们推荐使用 Coding。该仓库的速度比其他两个快。
    33  
    34  如果你在中国境外,我们推荐你使用 DockHub以及GHCR。如果你使用Coding,速度上面不太理想。
    35  
    36  ### Build logic
    37  
    38  - 每个分支
    39  
    40    你可以使用该分支镜像尝试最新的特性。此外,我们依旧保存较早之前的镜像。
    41  
    42  - 每个pull request
    43  
    44    当你发起一个pull request到crane repo的时候,将会自动触发CI任务来构建对应的镜像。CI会将最后的镜像结果通过评论的方式附加在对应的pull request中。
    45  
    46  ### How to use the images?
    47  
    48  这里将使用 main 分支作为例子。
    49  Git commit hash 为 abc123。
    50  
    51  #### Base on the branch name
    52  
    53  !!! tips
    54      branch name的镜像一直指向最新的Git commit。当你想尝试新特性的时候,不要忘记重新拉取镜像。
    55  
    56  === "DockerHub"
    57      ```bash
    58      docker pull gocrane/craned:main
    59      ```
    60  
    61  === "Coding"
    62      ```bash
    63      docker pull finops-docker.pkg.coding.net/gocrane/crane/craned:main
    64      ```
    65  
    66  === "GitHub Container Registry"
    67      ```bash
    68      docker pull ghcr.io/gocrane/crane/craned:main
    69      ```
    70  
    71  #### Base on the branch name and the specific commit hash
    72  
    73  === "DockerHub"
    74      ```bash
    75      docker pull gocrane/craned:main-abc123
    76      ```
    77  
    78  === "Coding"
    79      ```bash
    80      docker pull finops-docker.pkg.coding.net/gocrane/crane/craned:main-abc123
    81      ```
    82  
    83  === "GitHub Container Registry"
    84      ```bash
    85      docker pull ghcr.io/gocrane/crane/craned:main-abc123
    86      ```
    87  
    88  ## Helm Resources
    89  
    90  !!! tips 
    91      每六小时同步一次上游的最新版本
    92  
    93  | Origin                                         | Mirror                                              | Type | Public |
    94  | --------------------------------------------- | --------------------------------------------------------- | ------ | ----- |
    95  | https://gocrane.github.io/helm-charts | https://finops-helm.pkg.coding.net/gocrane/gocrane | Helm | [Public](https://finops.coding.net/public-artifacts/gocrane/gocrane/packages) |
    96  |  https://prometheus-community.github.io/helm-charts  | https://finops-helm.pkg.coding.net/gocrane/prometheus-community    | Helm | [Public](https://finops.coding.net/public-artifacts/gocrane/prometheus-community/packages) |
    97  | https://grafana.github.io/helm-charts      | https://finops-helm.pkg.coding.net/gocrane/grafana      | Helm | [Public](https://finops.coding.net/public-artifacts/gocrane/grafana/packages) |
    98  
    99  ## Git Resources
   100  
   101  !!! tips 
   102      每天同步一次上游仓库
   103  
   104  !!! warning
   105      Now Coding is not support to fetch raw contents directly. You must be get token first.
   106  
   107  ### Coding
   108  | Origin                                         | Mirror                                              | Type | Public |
   109  | --------------------------------------------- | --------------------------------------------------------- | ------ | ---- |
   110  | https://github.com/gocrane/crane.git | https://e.coding.net/finops/gocrane/crane.git | Git | [Public](https://finops.coding.net/public/gocrane/crane/git/files) |
   111  | https://github.com/gocrane/helm-charts.git | https://e.coding.net/finops/gocrane/helm-charts.git | Git | [Public](https://finops.coding.net/public/gocrane/helm-charts/git/files) |
   112  | https://github.com/gocrane/api.git | https://e.coding.net/finops/gocrane/api.git | Git | [Public](https://finops.coding.net/public/gocrane/api/git/files) |
   113  | https://github.com/gocrane/crane-scheduler.git | https://e.coding.net/finops/gocrane/crane-scheduler.git | Git | [Public](https://finops.coding.net/public/gocrane/crane-scheduler/git/files) |
   114  | https://github.com/gocrane/fadvisor.git | https://e.coding.net/finops/gocrane/fadvisor.git | Git | [Public](https://finops.coding.net/public/gocrane/fadvisor/git/files) |
   115  
   116  ### Gitee
   117  
   118  | Origin                                         | Mirror                                              | Type | Public |
   119  | --------------------------------------------- | --------------------------------------------------------- | ------ | ---- |
   120  | https://github.com/gocrane/crane.git | https://gitee.com/finops/crane | Git | [Public](https://gitee.com/finops/crane) |
   121  | https://github.com/gocrane/helm-charts.git | https://gitee.com/finops/helm-charts | Git | [Public](https://gitee.com/finops/helm-charts) |
   122  
   123  ## 获取 Coding Git 仓库源文件内容
   124  
   125  !!! warning
   126      Now Coding is not support to fetch raw contents directly. You must be get token first.
   127  
   128  在这里将为您介绍,如何通过HTTP请求直接获取 Coding Git 仓库中的源文件内容。
   129  
   130  ### Coding Git 仓库的关键参数
   131  
   132  与常规的API请求类似,Coding Git仓库提供了对应的API接口。
   133  
   134  下面为您介绍相关的参数。
   135  
   136  !!! tips Example "Example"
   137      以 https://**finops**.coding.net/public/**gocrane**/**helm-charts**/git/files**/main/integration/grafana/override_values.yaml** 作为例子。 [点击访问](https://finops.coding.net/public/gocrane/helm-charts/git/files/main/integration/grafana/override_values.yaml)
   138  
   139  | 参数 | 说明 | 例子 |
   140  | ---- | ---- | ---- |
   141  | `team` | 团队名称 | `finops` |
   142  | `project` | 项目名称 | `gocrane` |
   143  | `repo` | Git 仓库名称 | `helm-charts` |
   144  | `branch` | 分支名称 | `main` |
   145  | `file path` | 项目中的文件路径 | `/integration/grafana/override_values.yaml` |
   146  
   147  ### 构造HTTP请求
   148  
   149  根据上面所提到的属性,按照下面的URL构造规则依次填入,即可获得一个可以直接获取源文件内容的URL。
   150  
   151  ```bash
   152  https://<team>.coding.net/p/<project>/d/<repo>/git/raw/<branch>/<file path>?download=false
   153  
   154  https://finops.coding.net/p/gocrane/d/helm-charts/git/raw/main/integration/grafana/override_values.yaml?download=false
   155  ```
   156  
   157  !!! tips
   158      尝试以下的命令
   159  
   160  ```bash
   161  curl https://finops.coding.net/p/gocrane/d/helm-charts/git/raw/main/integration/grafana/override_values.yaml?download=false
   162  ```