40 Star 146 Fork 3

Gitee 极速下载/grafana

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/grafana/grafana
克隆/下载
main.go 3.01 KB
一键复制 编辑 原始数据 按行查看 历史
package main
import (
"flag"
"fmt"
"log"
"os"
)
func main() {
var version string
var whatsNewURL string
var releaseNotesURL string
var dryRun bool
var enterprise bool
var fromLocal bool
var nightly bool
var apiKey string
flag.StringVar(&version, "version", "", "Grafana version (ex: --version v5.2.0-beta1)")
flag.StringVar(&whatsNewURL, "wn", "", "What's new url (ex: --wn http://docs.grafana.org/guides/whats-new-in-v5-2/)")
flag.StringVar(&releaseNotesURL, "rn", "", "Grafana version (ex: --rn https://community.grafana.com/t/release-notes-v5-2-x/7894)")
flag.StringVar(&apiKey, "apikey", "", "Grafana.com API key (ex: --apikey ABCDEF)")
flag.BoolVar(&dryRun, "dry-run", false, "--dry-run")
flag.BoolVar(&enterprise, "enterprise", false, "--enterprise")
flag.BoolVar(&fromLocal, "from-local", false, "--from-local (builds will be tagged as nightly)")
flag.Parse()
nightly = fromLocal
if len(os.Args) == 1 {
fmt.Println("Usage: go run publisher.go main.go --version <v> --wn <what's new url> --rn <release notes url> --apikey <api key> --dry-run false --enterprise false --nightly false")
fmt.Println("example: go run publisher.go main.go --version v5.2.0-beta2 --wn http://docs.grafana.org/guides/whats-new-in-v5-2/ --rn https://community.grafana.com/t/release-notes-v5-2-x/7894 --apikey ASDF123 --dry-run --enterprise")
os.Exit(1)
}
if dryRun {
log.Println("Dry-run has been enabled.")
}
var baseURL string
var builder releaseBuilder
var product string
archiveProviderRoot := "https://dl.grafana.com"
buildArtifacts := completeBuildArtifactConfigurations
if enterprise {
product = "grafana-enterprise"
baseURL = createBaseURL(archiveProviderRoot, "enterprise", product, nightly)
var err error
buildArtifacts, err = filterBuildArtifacts([]artifactFilter{
{os: "deb", arch: "amd64"},
{os: "rhel", arch: "amd64"},
{os: "linux", arch: "amd64"},
{os: "win", arch: "amd64"},
})
if err != nil {
log.Fatalf("Could not filter to the selected build artifacts, err=%v", err)
}
} else {
product = "grafana"
baseURL = createBaseURL(archiveProviderRoot, "oss", product, nightly)
}
if fromLocal {
path, _ := os.Getwd()
builder = releaseLocalSources{
path: path,
artifactConfigurations: buildArtifacts,
}
} else {
builder = releaseFromExternalContent{
getter: getHTTPContents{},
rawVersion: version,
artifactConfigurations: buildArtifacts,
}
}
p := publisher{
apiKey: apiKey,
apiURI: "https://grafana.com/api",
product: product,
dryRun: dryRun,
enterprise: enterprise,
baseArchiveURL: baseURL,
builder: builder,
}
if err := p.doRelease(whatsNewURL, releaseNotesURL, nightly); err != nil {
log.Fatalf("error: %v", err)
}
}
func createBaseURL(root string, bucketName string, product string, nightly bool) string {
var subPath string
if nightly {
subPath = "master"
} else {
subPath = "release"
}
return fmt.Sprintf("%s/%s/%s/%s", root, bucketName, subPath, product)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/mirrors/grafana.git
git@gitee.com:mirrors/grafana.git
mirrors
grafana
grafana
v6.0.0-beta3

搜索帮助

0d507c66 1850385 C8b1a773 1850385