[10.4.x] backport CI / release changes (#89631)

* Chore: Add go workspace (#83191)


---------

Co-authored-by: ismail simsek <ismailsimsek09@gmail.com>

* CI: Make pkg/build its own module, remove unused Grafana modules in go.mo… (#89243)

* Make pkg/build its own module, remove unused Grafana modules in go.mod/go.sum

* fix go.work format

* log errors on file close errors

* CI: Add release-pr workflow (#89005)

* Add release-pr workflow

* update CODEOWNERS

* CI: Trigger release pr workflow when a release is completed (#89062)

* Automation: Verify release artifacts on grafana.com (#89197)

* baldm0mma/verify_release/ create verify_release_for_download function

* baldm0mma/verify_release/ add name, image, env

* baldm0mma/verify_release/ add initial commands

* baldm0mma/verify_release/ add deps?

* baldm0mma/verify_release/ update location

* baldm0mma/verify_release/ add anno to lib-star

* bald0mma/verify_release/ update func name to verify_grafanacom_step

* baldm0mma/verify_release/ add verify shell script

* baldm0mma/verify_release/ add script content, first attempt

* baldm0mma/verify_release/ add node image to verify_grafanacom_step

* baldm0mma/verify_release/ add gcom secret note

* baldm0mma/verify_release/ add sudo to apt-get

* baldm0mma/verify_release/ add anno

* baldm0mma/verify_release/ add anno to secrets

* baldm0mma/verify_release/ update commands to reflect node env image

* baldm0mma/verify_release/ update annos

* baldm0mma/verify_release/ update tag variable

* baldm0mma/verify release/ add whitespace

* baldm0mma/verify_releases/ update with no bash loops

* baldm0mma/verify_release/ update exit logic

* baldm0mma/verify_release/ remove annos

* baldm0mma/verify_releasse/ resign and build yml

* baldm0mma/verify_release/ remove annos

* baldm0mma/verify_release/ update signature

* baldm0mma/verify_release/ download curl

* baldm0mma/verify_release/ remove temp key folder removal

* baldm0mma/verify_release/ account for artifact download time

* baldm0mma/verify_release/ add anno

* baldm0mma/verify_release/ update location

* baldm0mma/verify_release/ update script

* baldm0mma/verify_release/ make drone

* baldm0mma/verify_release/ update script for oss or ent

* baldm0mma/verify_release/ add promotion option

* baldm0mma/verify_release/ make drone

* Update scripts/drone/events/release.star

Co-authored-by: Kevin Minehart <5140827+kminehart@users.noreply.github.com>

* Update scripts/drone/steps/lib.star

Co-authored-by: Kevin Minehart <5140827+kminehart@users.noreply.github.com>

* Update scripts/drone/steps/lib.star

Co-authored-by: Kevin Minehart <5140827+kminehart@users.noreply.github.com>

* baldm0mma/verify_release/ update drone

* Update scripts/drone/events/release.star

Co-authored-by: Kevin Minehart <5140827+kminehart@users.noreply.github.com>

* baldm0mma/verify_release/ update drone

* Update scripts/drone/steps/lib.star

Co-authored-by: Kevin Minehart <5140827+kminehart@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Kevin Minehart <5140827+kminehart@users.noreply.github.com>

* baldm0mma/update drone

* baldm0mma/verify_release/ update path

* baldm0mma/verify_release/ make drone

* baldm0mma/update drone

* Apply suggestions from code review

Co-authored-by: Kevin Minehart <5140827+kminehart@users.noreply.github.com>

* baldm0mma/verify_release/ update for loop to account for failure

* baldm0mma/verify_release/ make drone

* baldm0mma/verify_release/ make format-drone

* baldm0mma/verify_release/ rem unused var

---------

Co-authored-by: Kevin Minehart <5140827+kminehart@users.noreply.github.com>

---------

Co-authored-by: Todd Treece <360020+toddtreece@users.noreply.github.com>
Co-authored-by: ismail simsek <ismailsimsek09@gmail.com>
Co-authored-by: Jev Forsberg <46619047+baldm0mma@users.noreply.github.com>
This commit is contained in:
Kevin Minehart
2024-06-24 15:06:53 -05:00
committed by GitHub
co-authored by ismail simsek Todd Treece Jev Forsberg
parent e95b1e838c
commit 8e9aa45716
22 changed files with 1802 additions and 124 deletions
+20 -20
View File
@@ -19,10 +19,10 @@ import (
"github.com/grafana/grafana/pkg/build/config"
"github.com/grafana/grafana/pkg/build/errutil"
"github.com/grafana/grafana/pkg/build/fsutil"
"github.com/grafana/grafana/pkg/build/grafana"
"github.com/grafana/grafana/pkg/build/plugins"
"github.com/grafana/grafana/pkg/build/syncutil"
"github.com/grafana/grafana/pkg/infra/fs"
)
var (
@@ -99,7 +99,7 @@ func packageGrafana(
p syncutil.WorkerPool,
) error {
distDir := filepath.Join(grafanaDir, "dist")
exists, err := fs.Exists(distDir)
exists, err := fsutil.Exists(distDir)
if err != nil {
return err
}
@@ -317,28 +317,28 @@ func createPackage(srcDir string, options linuxPackageOptions) error {
}
}
if err := fs.CopyFile(filepath.Join(options.wrapperFilePath, binary),
if err := fsutil.CopyFile(filepath.Join(options.wrapperFilePath, binary),
filepath.Join(packageRoot, "usr", "sbin", binary)); err != nil {
return err
}
if err := fs.CopyFile(filepath.Join(options.wrapperFilePath, cliBinary),
if err := fsutil.CopyFile(filepath.Join(options.wrapperFilePath, cliBinary),
filepath.Join(packageRoot, "usr", "sbin", cliBinary)); err != nil {
return err
}
if err := fs.CopyFile(filepath.Join(options.wrapperFilePath, serverBinary),
if err := fsutil.CopyFile(filepath.Join(options.wrapperFilePath, serverBinary),
filepath.Join(packageRoot, "usr", "sbin", serverBinary)); err != nil {
return err
}
if err := fs.CopyFile(options.initdScriptSrc, filepath.Join(packageRoot, options.initdScriptFilePath)); err != nil {
if err := fsutil.CopyFile(options.initdScriptSrc, filepath.Join(packageRoot, options.initdScriptFilePath)); err != nil {
return err
}
if err := fs.CopyFile(options.defaultFileSrc, filepath.Join(packageRoot, options.etcDefaultFilePath)); err != nil {
if err := fsutil.CopyFile(options.defaultFileSrc, filepath.Join(packageRoot, options.etcDefaultFilePath)); err != nil {
return err
}
if err := fs.CopyFile(options.systemdFileSrc, filepath.Join(packageRoot, options.systemdServiceFilePath)); err != nil {
if err := fsutil.CopyFile(options.systemdFileSrc, filepath.Join(packageRoot, options.systemdServiceFilePath)); err != nil {
return err
}
if err := fs.CopyRecursive(srcDir, filepath.Join(packageRoot, options.homeDir)); err != nil {
if err := fsutil.CopyRecursive(srcDir, filepath.Join(packageRoot, options.homeDir)); err != nil {
return err
}
@@ -416,7 +416,7 @@ func executeFPM(options linuxPackageOptions, packageRoot, srcDir string) error {
}
log.Printf("Creating %s package: %s...", options.packageType, cmdStr)
const rvmPath = "/etc/profile.d/rvm.sh"
exists, err := fs.Exists(rvmPath)
exists, err := fsutil.Exists(rvmPath)
if err != nil {
return err
}
@@ -439,7 +439,7 @@ func copyPubDir(grafanaDir, tmpDir string) error {
srcPubDir := filepath.Join(grafanaDir, "public")
tgtPubDir := filepath.Join(tmpDir, "public")
log.Printf("Copying %q to %q...", srcPubDir, tgtPubDir)
if err := fs.CopyRecursive(srcPubDir, tgtPubDir); err != nil {
if err := fsutil.CopyRecursive(srcPubDir, tgtPubDir); err != nil {
return fmt.Errorf("failed to copy %q to %q: %w", srcPubDir, tgtPubDir, err)
}
@@ -469,7 +469,7 @@ func copyBinaries(grafanaDir, tmpDir string, args grafana.BuildArgs, edition con
srcPath := filepath.Join(binDir, file.Name())
tgtPath := filepath.Join(tgtDir, file.Name())
if err := fs.CopyFile(srcPath, tgtPath); err != nil {
if err := fsutil.CopyFile(srcPath, tgtPath); err != nil {
return err
}
}
@@ -491,7 +491,7 @@ func copyConfFiles(grafanaDir, tmpDir string) error {
}
for _, info := range infos {
fpath := filepath.Join(confDir, info.Name())
if err := fs.CopyRecursive(fpath, filepath.Join(tmpDir, "conf", info.Name())); err != nil {
if err := fsutil.CopyRecursive(fpath, filepath.Join(tmpDir, "conf", info.Name())); err != nil {
return err
}
}
@@ -510,7 +510,7 @@ func copyPlugins(ctx context.Context, v config.Variant, grafanaDir, tmpDir strin
}
tgtDir := filepath.Join(tmpDir, "plugins-bundled")
exists, err := fs.Exists(tgtDir)
exists, err := fsutil.Exists(tgtDir)
if err != nil {
return err
}
@@ -550,7 +550,7 @@ func copyPlugins(ctx context.Context, v config.Variant, grafanaDir, tmpDir strin
wantExe = fmt.Sprintf("%s_%s", plugExe, sfx)
log.Printf("The external plugin should contain an executable %q", wantExe)
exists, err := fs.Exists(filepath.Join(srcDir, wantExe))
exists, err := fsutil.Exists(filepath.Join(srcDir, wantExe))
if err != nil {
return err
}
@@ -591,7 +591,7 @@ func copyPlugins(ctx context.Context, v config.Variant, grafanaDir, tmpDir strin
}
log.Printf("Copying %q to %q", pth, dstPath)
return fs.CopyFile(pth, dstPath)
return fsutil.CopyFile(pth, dstPath)
}); err != nil {
return fmt.Errorf("failed to copy external plugin %q to %q: %w", srcDir, dstDir, err)
}
@@ -610,7 +610,7 @@ func copyInternalPlugins(pluginsDir, tmpDir string) error {
tgtDir := filepath.Join(tmpDir, "plugins-bundled", "internal")
srcDir := filepath.Join(pluginsDir, "dist")
exists, err := fs.Exists(tgtDir)
exists, err := fsutil.Exists(tgtDir)
if err != nil {
return err
}
@@ -635,7 +635,7 @@ func copyInternalPlugins(pluginsDir, tmpDir string) error {
dstPath := filepath.Join(tgtDir, fi.Name())
log.Printf("Copying internal plugin %q to %q...", srcPath, dstPath)
if err := fs.CopyRecursive(srcPath, dstPath); err != nil {
if err := fsutil.CopyRecursive(srcPath, dstPath); err != nil {
return fmt.Errorf("failed to copy %q to %q: %w", srcPath, dstPath, err)
}
}
@@ -696,7 +696,7 @@ func realPackageVariant(ctx context.Context, v config.Variant, edition config.Ed
return fmt.Errorf("failed to create tools dir %q: %w", toolsDir, err)
}
if err := fs.CopyFile("/usr/local/go/lib/time/zoneinfo.zip",
if err := fsutil.CopyFile("/usr/local/go/lib/time/zoneinfo.zip",
filepath.Join(tmpDir, "tools", "zoneinfo.zip")); err != nil {
return err
}
@@ -860,7 +860,7 @@ type linuxPackageOptions struct {
// createArchive makes a distribution archive.
func createArchive(srcDir string, edition config.Edition, v config.Variant, version, grafanaDir string) error {
distDir := filepath.Join(grafanaDir, "dist")
exists, err := fs.Exists(distDir)
exists, err := fsutil.Exists(distDir)
if err != nil {
return err
}