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

Docker manifest #509

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4b3a038
chore(debug pipeline): add cpu architecture to pushing infos
smerleCB Feb 10, 2023
17abb43
chore(docker): adding a manifest to reenable both amd and arm publish
smerleCB Feb 13, 2023
4b7c349
chore indentation
smerleCB Feb 13, 2023
692f8f4
chore indentation
smerleCB Feb 13, 2023
d86ad72
move block
smerleCB Feb 13, 2023
61912d7
add architecture cpu to manifest tags
smerleCB Feb 13, 2023
aee1939
change variable as within sh
smerleCB Feb 13, 2023
b03c3e0
as we specify each tag, we cannot use alltags anymore ....
smerleCB Feb 13, 2023
dbcd786
adding docker tag manually
smerleCB Feb 13, 2023
9e7c160
debug to save time
smerleCB Feb 14, 2023
5eb0b22
move docker manifest to bottom
smerleCB Feb 14, 2023
4fd606e
scripted and with docker credential
smerleCB Feb 14, 2023
daefd38
change null to empty
smerleCB Feb 14, 2023
6748853
debug to save time
smerleCB Feb 14, 2023
611a2d0
manually add the agent_type to the docker manifest
smerleCB Feb 14, 2023
17767d6
manually add the agent_type to the docker manifest
smerleCB Feb 14, 2023
e40e45a
change TagName test to null to avoid manifest on PR but just on tag c…
smerleCB Feb 15, 2023
551a6e1
revert all debug/quick commit
smerleCB Feb 15, 2023
a4f0e6a
docker tag only for docker build
smerleCB Feb 15, 2023
4099463
change git ppa to release-candidate for edge version
smerleCB Feb 15, 2023
0f62ca3
revert to the core ppa for git, assuming a revert on the version to i…
smerleCB Feb 15, 2023
32de83c
Merge branch 'main' into docker-manifest
smerle33 Feb 15, 2023
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
34 changes: 33 additions & 1 deletion Jenkinsfile_k8s
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ pipeline {
}
axis {
name 'agent_type'
// make sure to port any addition to the list of agent types to the Build Docker Manifest stage if it's docker related
values 'ubuntu-20.04', 'windows-2019', 'windows-2022'
}
axis {
Expand Down Expand Up @@ -242,12 +243,16 @@ pipeline {
// Execute build only for this matrix cell's setup
retry(count: 2, conditions: [kubernetesAgent(handleNonKubernetes: true), nonresumable()]) {
sh 'packer build -timestamp-ui -force -only="${PKR_VAR_image_type}.${PKR_VAR_agent_os_type}" ./'
// adding manually a cpu architecture tag to the docker image
if (pkr_var_image_type == 'docker') {
sh 'docker tag "jenkinsciinfra/jenkins-agent-${PKR_VAR_agent_os_type}-${PKR_VAR_agent_os_version}:latest" "jenkinsciinfra/jenkins-agent-${PKR_VAR_agent_os_type}-${PKR_VAR_agent_os_version}:${PKR_VAR_architecture}"'
}
}
// if docker and building a tag, push to dockerhub from inside the node
// else we would loose the docker image
if (pkr_var_image_type == 'docker' && pkr_var_tag_name != null) {
stage('Publish all tags for Docker image') {
echo "Pushing jenkinsciinfra/jenkins-agent-${pkr_var_agent_os_type}:${pkr_var_tag_name} & jenkinsciinfra/jenkins-agent-${pkr_var_agent_os_type}:latest"
echo "Pushing jenkinsciinfra/jenkins-agent-${pkr_var_agent_os_type}:${pkr_var_tag_name} & jenkinsciinfra/jenkins-agent-${pkr_var_agent_os_type}:latest for ${pkr_var_architecture}"
infra.withDockerPushCredentials {
sh 'docker push --all-tags jenkinsciinfra/jenkins-agent-${agent_type}'
}
Expand All @@ -260,5 +265,32 @@ pipeline {
}
}
}
stage('Build Docker Manifest') {
when {
expression {
return env.TAG_NAME != null
}
}
environment {
agent_type = 'ubuntu-20.04'
}
steps {
script {
infra.withDockerPushCredentials {
sh 'docker manifest create \
jenkinsciinfra/jenkins-agent-${agent_type}:latest \
--amend jenkinsciinfra/jenkins-agent-${agent_type}:arm64 \
--amend jenkinsciinfra/jenkins-agent-${agent_type}:amd64'
sh 'docker manifest push jenkinsciinfra/jenkins-agent-${agent_type}:latest'

sh 'docker manifest create \
jenkinsciinfra/jenkins-agent-${agent_type}:${TAG_NAME} \
--amend jenkinsciinfra/jenkins-agent-${agent_type}:arm64 \
--amend jenkinsciinfra/jenkins-agent-${agent_type}:amd64'
sh 'docker manifest push jenkinsciinfra/jenkins-agent-${agent_type}:${TAG_NAME}'
}
}
}
}
}
}
6 changes: 3 additions & 3 deletions provisioning/ubuntu-provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -737,14 +737,15 @@ function main() {
install_ssh_requirements # Ensure that OpenSSH CLI and SSH agent are installed
setuser # Define user Jenkins before all (to allow installing stuff in its home dir)
install_asdf # Before all the others but after the jenkins home is created
install_goss # needed by the pipeline
install_docker # needed by the pipeline
install_jdk # needed by the pipeline
install_chromium
install_docker
install_datadog
install_JA_requirements
install_qemu
install_python
install_git_gitlfs
install_jdk
install_docker_compose
install_maven
install_hadolint
Expand All @@ -762,7 +763,6 @@ function main() {
install_terraform
install_kubectl
install_tfsec
install_goss
install_nodejs
install_playwright_dependencies
cleanup
Expand Down