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

refactor(ci): use common cicd library for build #75

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
14 changes: 8 additions & 6 deletions build_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

set -exv

source 'deployment/build-deploy-common.sh'
export CICD_BOOTSTRAP_REPO_BRANCH='main'
export CICD_BOOTSTRAP_REPO_ORG='RedHatInsights'
CICD_TOOLS_URL="https://raw.githubusercontent.com/${CICD_BOOTSTRAP_REPO_ORG}/cicd-tools/${CICD_BOOTSTRAP_REPO_BRANCH}/src/bootstrap.sh"
# shellcheck source=/dev/null
source <(curl -sSL "$CICD_TOOLS_URL") image_builder
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Victoremepunto is there something better than sourcing random code from github?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deferred to Security for feedback

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was suggesting signed files or commits. Otherwise RHTAP might help.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can configure the project (I think it is already) to only allow verified (signed) git commits.

However that's only checked on Github's side (hence the ✔️ next to the commit). The client "doesn't have a way" to check the commit signature - not a "nice and simple" one anyways.

The "signed files" - same story, the client needs to verify the validity of the signature.

RHTAP will only provide tools via Docker images (won't load stuff dynamically) - which doesn't really work for Scripts.

BUT - it's true that RHTAP will fix the "build part" - once a service is onboarded, we shall not need any build script anymore.

question is - what we do in between ?


IMAGE_NAME="${IMAGE_NAME:-quay.io/cloudservices/floorist}"
BUILD_DEPLOY_BUILD_TARGET="${BUILD_DEPLOY_BUILD_TARGET:-base}"
BACKWARDS_COMPATIBILITY=false
BUILD_PARAMS="--no-cache"
export CICD_IMAGE_BUILDER_IMAGE_NAME='quay.io/cloudservices/floorist'
BUILD_TARGET=${BUILD_TARGET:-base}

build_deploy_main || exit 1
cicd::image_builder::build_and_push --no-cache --target "${BUILD_TARGET}"
257 changes: 0 additions & 257 deletions deployment/build-deploy-common.sh

This file was deleted.

11 changes: 2 additions & 9 deletions pr_check.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#!/usr/bin/env bash

if [ "$LOCAL_BUILD" != true ]; then
# Install bonfire repo/initialize - there are patches applied on bootstrap, required even if not using bonfire
CICD_URL=https://raw.githubusercontent.com/RedHatInsights/bonfire/master/cicd
curl -s $CICD_URL/bootstrap.sh > .cicd_bootstrap.sh && source .cicd_bootstrap.sh
fi

APP_ROOT=${APP_ROOT:-`pwd`}
APP_ROOT=${APP_ROOT:-$(pwd)}
# --------------------------------------------
# Options that must be configured by app owner
# --------------------------------------------
Expand All @@ -16,8 +10,7 @@ COMPONENT_NAME="floorist" # name of app-sre "resourceTemplate" in deploy.yaml f

cat /etc/redhat-release

BUILD_DEPLOY_BUILD_TARGET="test"
BUILD_DEPLOY_TEMP_IMAGE=true
export BUILD_TARGET="test"

source "$APP_ROOT/build_deploy.sh" || exit 1

Expand Down
Loading