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

Push images to gar #18

Merged
merged 2 commits into from
Sep 9, 2024
Merged
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
2 changes: 1 addition & 1 deletion Dockerfile_linux_arm64
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.15 AS builder
FROM golang:1.23 AS builder

ENV OUTPUT_DIR=/out

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile_linux_s390x
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.15 AS builder
FROM golang:1.23 AS builder

ENV OUTPUT_DIR=/out

Expand Down
26 changes: 23 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ pipeline {
}

stages {
stage('Login to registries') {
steps {
script {
withCredentials([
usernamePassword(credentialsId: 'jenkins-artifactory', usernameVariable: 'ARTIFACTORY_USER', passwordVariable: 'ARTIFACTORY_PASS'),
file(credentialsId: 'google-artifactory-dev-write', variable: 'GAR_WR_SECRET')
]) {
sh '''#!/bin/bash
set -euo pipefail
echo "Logging into Artifactory"
docker login docker.internal.sysdig.com -u="$ARTIFACTORY_USER" -p="$ARTIFACTORY_PASS"
echo "Logging into GAR dev"
cat $GAR_WR_SECRET | docker login --username _json_key --password-stdin us-docker.pkg.dev/sysdig-artifact-registry-dev/gar-docker
'''
}
}
}
}
stage('Build and Push Dependency Image') {
steps {
checkout([$class: 'GitSCM',
Expand All @@ -14,11 +32,13 @@ pipeline {
userRemoteConfigs: [[credentialsId: 'github-jenkins-user-token', url: 'https://github.com/draios/linux-bench.git']]
])
script {
docker.withRegistry("https://docker.internal.sysdig.com", 'jenkins-artifactory') {
sh "IMAGE_TAG=${params.TAG} PUSH=yes make -f makefile-sysdig build-dependency-image"
docker.withRegistry("https://docker.internal.sysdig.com", 'jenkins-artifactory') {
sh "IMAGE_TAG=${params.TAG} PUSH=yes make -f makefile-sysdig build-dependency-image"
sh "IMAGE_TAG=${params.TAG} PUSH=yes make -f makefile-sysdig build-dependency-image-gar"
}
}
}
}
}
}
}

9 changes: 8 additions & 1 deletion makefile-sysdig
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# This repo is a fork of a public upstream, so Sysdig specific make commands have been added in a separate makefile

ARTIFACTORY := docker.internal.sysdig.com
GAR_DEV_REGISTRY := us-docker.pkg.dev/sysdig-artifact-registry-dev/gar-docker/secure
PROJECT := linux-bench
IMAGE_REPO := $(PROJECT)-dependency
IMAGE_TAG?= dev
DEPENDENCY_IMAGE_NAME := $(ARTIFACTORY)/$(IMAGE_REPO):$(IMAGE_TAG)
DEPENDENCY_IMAGE_NAME_GAR := $(GAR_DEV_REGISTRY)/$(IMAGE_REPO):$(IMAGE_TAG)

ifndef PUSH
PUSH_FLAG := ""
Expand All @@ -15,4 +17,9 @@ endif
build-dependency-image:
docker buildx rm -f $(PROJECT)-builder || true
docker buildx create --name $(PROJECT)-builder --use
docker buildx build --platform linux/arm64,linux/amd64 $(PUSH_FLAG) --tag $(DEPENDENCY_IMAGE_NAME) .
docker buildx build --platform linux/arm64,linux/amd64 $(PUSH_FLAG) --tag $(DEPENDENCY_IMAGE_NAME) --file Dependency-Dockerfile .

build-dependency-image-gar:
docker buildx rm -f $(PROJECT)-builder || true
docker buildx create --name $(PROJECT)-builder --use
docker buildx build --platform linux/arm64,linux/amd64 $(PUSH_FLAG) --tag $(DEPENDENCY_IMAGE_NAME_GAR) --file Dependency-Dockerfile .
Loading