Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drone migrate release #4500

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 0 additions & 149 deletions .drone/drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -60,158 +60,9 @@ local aws_prod_secret_access_key = secret('AWS_SECRET_ACCESS_KEY-prod', 'infra/d
// https://github.com/alpine-docker/git/issues/35
local alpine_git_image = 'alpine/git:v2.30.2';

local image_tag(arch='') = {
name: 'image-tag',
image: alpine_git_image,
commands: [
'apk --update --no-cache add bash',
'git fetch origin --tags',
] + (
if arch == '' then [
'echo $(./tools/image-tag) > .tags',
] else [
'echo $(./tools/image-tag)-%s > .tags' % arch,
]
),
};

local image_tag_for_cd() = {
name: 'image-tag-for-cd',
image: alpine_git_image,
commands: [
'apk --update --no-cache add bash',
'git fetch origin --tags',
'echo "grafana/tempo:$(./tools/image-tag)" > .tags-for-cd-tempo',
'echo "grafana/tempo-query:$(./tools/image-tag)" > .tags-for-cd-tempo_query',
'echo "grafana/tempo-vulture:$(./tools/image-tag)" > .tags-for-cd-tempo_vulture',
],
};

local build_binaries(arch) = {
name: 'build-tempo-binaries',
image: 'golang:1.23-alpine',
commands: [
'apk --update --no-cache add make git bash',
] + [
'COMPONENT=%s GOARCH=%s make exe' % [app, arch]
for app in apps
],
};

local docker_build(arch, app, dockerfile='') = {
name: 'build-%s-image' % app,
image: 'plugins/docker',
settings: {
dockerfile: if dockerfile != '' then dockerfile else 'cmd/%s/Dockerfile' % app,
repo: 'grafana/%s' % app,
username: { from_secret: docker_username_secret.name },
password: { from_secret: docker_password_secret.name },
platform: '%s/%s' % ['linux', arch],
build_args: [
'TARGETARCH=' + arch,
],
},
};

local docker_manifest(app) = {
name: 'manifest-%s' % app,
image: 'plugins/manifest:1.4.0',
settings: {
username: { from_secret: docker_username_secret.name },
password: { from_secret: docker_password_secret.name },
spec: '.drone/docker-manifest.tmpl',
target: app,
},
};

local deploy_to_dev() = {
image: 'us.gcr.io/kubernetes-dev/drone/plugins/updater',
name: 'update-dev-images',
settings: {
config_json: std.manifestJsonEx(
{
destination_branch: 'master',
pull_request_branch_prefix: 'auto-merge/cd-tempo-dev',
pull_request_enabled: true,
pull_request_existing_strategy: "ignore",
repo_name: 'deployment_tools',
update_jsonnet_attribute_configs: [
{
file_path: 'ksonnet/environments/tempo/dev-us-central-0.tempo-dev-01/images.libsonnet',
jsonnet_key: app,
jsonnet_value_file: '.tags-for-cd-' + app,
}
for app in ['tempo', 'tempo_query', 'tempo_vulture']
],
},
' '
),
github_app_id: {
from_secret: tempo_app_id_secret.name,
},
github_app_installation_id: {
from_secret: tempo_app_installation_id_secret.name,
},
github_app_private_key: {
from_secret: tempo_app_private_key_secret.name,
},
},
};

//# Pipelines & resources

[
// A pipeline to build Docker images for every app and for every arch
(
pipeline('docker-' + arch, arch) {
steps+: [
image_tag(arch),
build_binaries(arch),
] + [
docker_build(arch, app)
for app in apps
],
}
)
for arch in archs
] + [
// Publish Docker manifests
pipeline('manifest') {
steps+: [
image_tag(),
] + [
docker_manifest(app)
for app in apps
],
depends_on+: [
'docker-%s' % arch
for arch in archs
],
},
] + [
// Continuously Deploy to dev env
pipeline('cd-to-dev-env') {
trigger: {
ref: [
// always deploy tip of main to dev
'refs/heads/main',
],
},
image_pull_secrets: [
docker_config_json_secret.name,
],
steps+: [
image_tag_for_cd(),
] + [
deploy_to_dev(),
],
depends_on+: [
// wait for images to be published on dockerhub
'manifest',
],
},
] + [

local ghTokenFilename = '/drone/src/gh-token.txt';
// Build and release packages
// Tested by installing the packages on a systemd container
Expand Down
Loading
Loading