-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add tools image for CI runs #1226
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c81b342
Add tools image for CI runs
SimonBaeumer 6ababa3
Add fleet-manager-tools image to build_and_push_fleet_manager.sh
SimonBaeumer ab6ff9f
Check kubectl checksum
SimonBaeumer a08c2c4
Add ci job to push fleet-manager-tools image
SimonBaeumer 4716cd7
Add kubeval
SimonBaeumer 70adf80
Install kubectl
SimonBaeumer 2755058
Remove VERSION from script
SimonBaeumer 0fc0fe4
WIP
SimonBaeumer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8 | ||
|
||
ENV KUBECTL_VERSION=v1.28.1 | ||
|
||
COPY \ | ||
fleet-manager \ | ||
fleetshard-sync \ | ||
acsfleetctl \ | ||
/usr/local/bin/ | ||
|
||
RUN microdnf install tar gzip | ||
|
||
# Install kubeval | ||
RUN curl -LO https://github.com/instrumenta/kubeval/releases/download/v0.16.1/kubeval-linux-amd64.tar.gz | ||
RUN curl -LO "https://github.com/instrumenta/kubeval/releases/download/v0.16.1/checksums.txt" | ||
RUN cat checksums.txt | grep linux-amd64 | sha256sum --check | ||
RUN tar -xf kubeval-linux-amd64.tar.gz | ||
|
||
RUN mv kubeval /usr/bin/kubeval | ||
RUN chmod +x /usr/bin/kubeval | ||
RUN rm kubeval-linux-amd64.tar.gz | ||
|
||
# Install kubeclt | ||
RUN curl -o /usr/bin/kubectl -LO "https://dl.k8s.io/release/$KUBECTL_VERSION/bin/linux/amd64/kubectl" | ||
RUN chmod +x /usr/bin/kubectl | ||
RUN curl -LO "https://dl.k8s.io/$KUBECTL_VERSION/bin/linux/amd64/kubectl.sha256" | ||
RUN echo "$(cat kubectl.sha256) /usr/bin/kubectl" | sha256sum --check | ||
|
||
LABEL name="fleet-manager-tools" \ | ||
vendor="Red Hat" \ | ||
version="0.0.1" \ | ||
summary="FleetManagerTools" \ | ||
description="RHACS fleet-manager tools used for CI pipelines" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/bin/bash -e | ||
# | ||
# Copyright (c) 2018 Red Hat, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
# ===================================================================================================================== | ||
# This script builds and pushes the ACS Fleet Manager tools container image which is used by CI pipelines. | ||
# In order to work, it needs the following variables defined in the CI/CD configuration of the project: | ||
# | ||
# QUAY_USER - The name of the robot account used to push images to | ||
# 'quay.io', for example 'openshift-unified-hybrid-cloud+jenkins'. | ||
# | ||
# QUAY_TOKEN - The token of the robot account used to push images to | ||
# 'quay.io'. | ||
# | ||
# The machines that run this script need to have access to internet, so that | ||
# the built images can be pushed to quay.io. | ||
# ===================================================================================================================== | ||
|
||
# Set image repository to default value if it is not passed via env | ||
IMAGE_REPOSITORY="${QUAY_IMAGE_REPOSITORY:-rhacs-eng/fleet-manager-tools}" | ||
|
||
# Set the directory for docker configuration: | ||
DOCKER_CONFIG="${PWD}/.docker" | ||
|
||
# Log in to the image registry: | ||
if [ -z "${QUAY_USER}" ]; then | ||
echo "The quay.io push user name hasn't been provided." | ||
echo "Make sure to set the QUAY_USER environment variable." | ||
exit 1 | ||
fi | ||
if [ -z "${QUAY_TOKEN}" ]; then | ||
echo "The quay.io push token hasn't been provided." | ||
echo "Make sure to set the QUAY_TOKEN environment variable." | ||
exit 1 | ||
fi | ||
|
||
# Set up the docker config directory | ||
mkdir -p "${DOCKER_CONFIG}" | ||
|
||
BRANCH="main" | ||
if [[ -n "$GITHUB_REF" ]]; then | ||
BRANCH="$(echo "$GITHUB_REF" | awk -F/ '{print $NF}')" | ||
echo "GITHUB_REF is defined. Set image tag to $BRANCH." | ||
elif [[ -n "$GIT_BRANCH" ]]; then | ||
BRANCH="$(echo "$GIT_BRANCH" | awk -F/ '{print $NF}')" | ||
echo "GIT_BRANCH is defined. Set image tag to $BRANCH." | ||
else | ||
echo "No git branch env var found. Set image tag to $BRANCH." | ||
fi | ||
|
||
# Push the image: | ||
echo "Quay.io user and token is set, will push images to $IMAGE_REPOSITORY" | ||
|
||
make \ | ||
DOCKER_CONFIG="${DOCKER_CONFIG}" \ | ||
QUAY_USER="${QUAY_USER}" \ | ||
QUAY_TOKEN="${QUAY_TOKEN}" \ | ||
TAG="${BRANCH}" \ | ||
external_image_registry="quay.io" \ | ||
internal_image_registry="quay.io" \ | ||
image_repository="${IMAGE_REPOSITORY}" \ | ||
docker/login/fleet-manager \ | ||
image/push/fleet-manager-tools |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will we built this image in the CI?
Also, we already have almost identical
build_push
scripts for FM/FSS and Probe services. It would be nice to refactor it to use a single file in the futureThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a separate PR: #1262