-
Notifications
You must be signed in to change notification settings - Fork 210
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
Build tests for embedded Chef-Server in Automate #3917
Open
talktovikas
wants to merge
59
commits into
main
Choose a base branch
from
vikas/automate-cs-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+313
−6
Open
Changes from 57 commits
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
350dc98
Initial commit for bookself.
talktovikas 274fa4d
Adding more cases for Habitat.
talktovikas 76b8bef
fixing build issue in pipeline.
talktovikas 9221c13
adding quotes in package name
talktovikas 38d165c
seeing the pushd
talktovikas a85cced
adding the shell interpreter.
talktovikas fbe8b4d
adding test for chef-server in automate.
talktovikas 0484d48
adding build for automate.
talktovikas 2220c8a
My first commit.
sreepuramsudheer 94b67d1
corrected .sh file location.
sreepuramsudheer 6dbdb77
corrected .sh file location.
sreepuramsudheer 7f380fc
corrected download location for buildkite artifact.
sreepuramsudheer 84b69e5
corrected download location for buildkite artifact.
sreepuramsudheer 0e0d7fe
refactoring code
talktovikas 568390a
test commit for rebuild.
talktovikas 2c9e48e
trying search and replace.
talktovikas 591da97
fixing name of bookself.
talktovikas 72d7386
debug log
talktovikas 7d17250
changing the name.
talktovikas 1e95219
initial step.
sreepuramsudheer 08cf127
Made few changes.
sreepuramsudheer 515bfd3
added env variables.
sreepuramsudheer 42b2358
added hab environment setup step
sreepuramsudheer 2a7666e
hab setup fix.
sreepuramsudheer 9a44fe9
added script to edit plan.sh files.
sreepuramsudheer b7504e5
added script to edit plan.sh files.
sreepuramsudheer 56e9925
Check results dir
kalroy 3084da4
adding more env variables
kalroy 2dc0e3d
Trying to run verify_build
kalroy 9c3a318
Reverting
kalroy 2c35993
use hab studio
kalroy 85efaa6
hab install results pkg
kalroy fd63da4
changes we need to do
kalroy 1e889ac
Trying out to build and use key
kalroy 2b283f7
fix err
kalroy 56fefb0
fix err
kalroy f7ba632
fix err
kalroy 6183304
Check pwd
kalroy bddda1f
check ls
kalroy a9287b8
check ls
kalroy a1279dc
made changes to build package sequence.
sreepuramsudheer 3b08533
changes to fix nginx build issue.
sreepuramsudheer 73a90de
checking with cheftest origin.
sreepuramsudheer 6076fee
Added few environment variables.
sreepuramsudheer 68026d9
Added quotes in nginx plan.sh for build to succede.
sreepuramsudheer 44d36d4
Made changes to build automate components.
sreepuramsudheer 0ceb70b
Made changes to cp command to fix issue coppiend log directory.
sreepuramsudheer 8297d2f
One last change.
sreepuramsudheer d8a3dd1
One last change.
sreepuramsudheer 89174cb
Removing unnecessary artifact
kalroy fffa409
Removing unnecessary steps.
kalroy cacb7fe
initial commit for automate-cs tests.
talktovikas 8bc272b
adding permissions to the files.
talktovikas 1c64a60
Changes to retain chef-server hart files in results artifact.
sreepuramsudheer f0d398e
Added build.json to results directory.
sreepuramsudheer 46cd57b
Added step to install ruby.
sreepuramsudheer 5cb5395
Uncommented testcaeses.
sreepuramsudheer de62525
Adding back ChefFS testcases.
sreepuramsudheer 9d8be9e
Pointing to automate main branch.
sreepuramsudheer 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#!/bin/bash -e | ||
|
||
export ORIGIN=chef | ||
export HAB_ORIGIN=chef | ||
export HAB_LICENSE=accept-no-persist | ||
export OCTOKIT_ACCESS_TOKEN | ||
export CHEF_LICENSE="accept-no-persist" | ||
export CI=true | ||
export HAB_ORIGIN_KEYS=chef | ||
export HAB_STUDIO_SECRET_HAB_FEAT_IGNORE_LOCAL=false | ||
export HAB_FEAT_IGNORE_LOCAL=false | ||
export HAB_STUDIO_HOST_ARCH=x86_64-linux | ||
export HAB_FEAT_OFFLINE_INSTALL=true | ||
|
||
curl https://raw.githubusercontent.com/habitat-sh/habitat/main/components/hab/install.sh | sudo bash | ||
|
||
sudo -E hab pkg install core/ruby | ||
export PATH | ||
PATH="$(hab pkg path core/ruby)/bin:$PATH" | ||
sudo -E "$(hab pkg path core/ruby)"/bin/gem install toml | ||
|
||
export JOB_TEMP_ROOT | ||
JOB_TEMP_ROOT=$(mktemp -d /tmp/job-root-XXXXXX) | ||
export HAB_CACHE_KEY_PATH | ||
HAB_CACHE_KEY_PATH="$JOB_TEMP_ROOT/keys" | ||
|
||
echo "--- :key: Generating fake origin key" | ||
hab license accept | ||
hab origin key generate | ||
|
||
for pkg_name in `echo "bookshelf chef-server-ctl oc-id oc_bifrost oc_erchef openresty-noroot"` | ||
do | ||
echo "generating package for $pkg_name" | ||
hab pkg build "src/$pkg_name" | ||
done | ||
|
||
./.expeditor/replace.sh "nginx" "src" | ||
|
||
echo "generating package for nginx" | ||
openresty_hart=$(ls -1t results/chef-openresty*.hart | head -1) | ||
HAB_FEAT_OFFLINE_INSTALL=true HAB_FEAT_IGNORE_LOCAL=false HAB_ORIGIN=chef HAB_CACHE_KEY_PATH="$JOB_TEMP_ROOT/keys" DO_CHECK=true HAB_BLDR_CHANNEL=dev hab studio run -D "set -e; hab pkg install $openresty_hart; hab pkg build src/nginx" | ||
|
||
git clone https://github.com/chef/automate.git | ||
cd automate | ||
git checkout kalroy/cs_plan_changes | ||
|
||
RESOLVED_RESULTS_DIR=$(realpath results/) | ||
export DO_CHECK=true | ||
|
||
cp ../results/*.hart $HAB_CACHE_KEY_PATH/* results | ||
|
||
#cp ../results/*.hart ../results/chef*.pub ../results/chef*.key results | ||
../.expeditor/replace.sh | ||
bookshelf_hart=$(ls -1t results/chef-bookshelf*.hart | head -1) | ||
chef_server_ctl_hart=$(ls -1t results/chef-chef-server-ctl*.hart | head -1) | ||
nginx=$(ls -1t results/chef-chef-server-nginx*.hart | head -1) | ||
oc_id=$(ls -1t results/chef-oc_id*.hart | head -1) | ||
bifrost_hart=$(ls -1t results/chef-oc_bifrost*.hart | head -1) | ||
erchef_hart=$(ls -1t results/chef-oc_erchef*.hart | head -1) | ||
|
||
|
||
HAB_FEAT_OFFLINE_INSTALL=true HAB_FEAT_IGNORE_LOCAL=false HAB_ORIGIN=chef HAB_CACHE_KEY_PATH="$JOB_TEMP_ROOT/keys" DO_CHECK=true HAB_BLDR_CHANNEL=dev hab studio run -D "set -e; hab pkg install $bookshelf_hart; hab pkg build components/automate-cs-bookshelf" | ||
|
||
HAB_FEAT_OFFLINE_INSTALL=true HAB_FEAT_IGNORE_LOCAL=false HAB_ORIGIN=chef HAB_CACHE_KEY_PATH="$JOB_TEMP_ROOT/keys" DO_CHECK=true HAB_BLDR_CHANNEL=dev hab studio run -D "set -e; hab pkg install $bifrost_hart; hab pkg build components/automate-cs-oc-bifrost" | ||
|
||
HAB_FEAT_OFFLINE_INSTALL=true HAB_FEAT_IGNORE_LOCAL=false HAB_ORIGIN=chef HAB_CACHE_KEY_PATH="$JOB_TEMP_ROOT/keys" DO_CHECK=true HAB_BLDR_CHANNEL=dev hab studio run -D "set -e; hab pkg install $erchef_hart; hab pkg build components/automate-cs-oc-erchef" | ||
|
||
HAB_FEAT_OFFLINE_INSTALL=true HAB_FEAT_IGNORE_LOCAL=false HAB_ORIGIN=chef HAB_CACHE_KEY_PATH="$JOB_TEMP_ROOT/keys" DO_CHECK=true HAB_BLDR_CHANNEL=dev hab studio run -D "set -e; hab pkg install $oc_id; hab pkg build components/automate-cs-ocid" | ||
|
||
HAB_FEAT_OFFLINE_INSTALL=true HAB_FEAT_IGNORE_LOCAL=false HAB_ORIGIN=chef HAB_CACHE_KEY_PATH="$JOB_TEMP_ROOT/keys" DO_CHECK=true HAB_BLDR_CHANNEL=dev hab studio run -D "set -e; hab pkg install $nginx; hab pkg build components/automate-cs-nginx" | ||
|
||
.expeditor/create-manifest.rb | ||
mv manifest.json results/build.json | ||
|
||
HAB_PKG_CHANNEL=unstable NO_PIN_HAB=true .expeditor/create-manifest.rb | ||
mv manifest.json results/build-habdev.json | ||
|
||
echo "after build" `ls -l results` | ||
|
||
# we require chef-server hart files also for for next steps. | ||
# ls results/*.hart | grep -v automate | xargs rm | ||
|
||
tar -cvf results.tar results | ||
gzip results.tar | ||
buildkite-agent artifact upload results.tar.gz |
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,14 @@ | ||
#!/bin/bash | ||
|
||
#=============================================================================== | ||
#Downloading the automate repo | ||
#=============================================================================== | ||
|
||
git clone https://github.com/chef/automate.git | ||
cd automate | ||
git checkout kalroy/cs_plan_changes | ||
|
||
#=============================================================================== | ||
chmod +x ./integration/tests/chef_server.sh | ||
#running the chef_server.sh script from the automate repo | ||
integration/run_test integration/tests/chef_server.sh |
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,14 @@ | ||
#!/bin/bash | ||
|
||
#=============================================================================== | ||
#Downloading the automate repo | ||
#=============================================================================== | ||
|
||
git clone https://github.com/chef/automate.git | ||
cd automate | ||
git checkout kalroy/cs_plan_changes | ||
|
||
#=============================================================================== | ||
chmod +x ./integration/tests/chef_server_only.sh | ||
#running the chef_server_only.sh script from the automate repo | ||
integration/run_test integration/tests/chef_server_only.sh |
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,15 @@ | ||
#!/bin/bash | ||
|
||
#=============================================================================== | ||
#Downloading the automate repo | ||
#=============================================================================== | ||
|
||
git clone https://github.com/chef/automate.git | ||
cd automate | ||
git checkout kalroy/cs_plan_changes | ||
|
||
#=============================================================================== | ||
|
||
#running the ha_chef_server.sh script from the automate repo | ||
chmod +x ./integration/tests/ha_chef_server.sh | ||
integration/run_test integration/tests/ha_chef_server.sh |
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,32 @@ | ||
#!/bin/bash -e | ||
|
||
# this script builds all the essential habitat packages for running Chef Server | ||
# additionaly, it exports them as a local docker image | ||
|
||
export CHEF_SERVER_SRC='/workdir/src' | ||
export ORIGIN=chef | ||
export HAB_LICENSE=accept-no-persist | ||
# export PACKAGE_NAME=$1 | ||
|
||
|
||
curl https://raw.githubusercontent.com/habitat-sh/habitat/main/components/hab/install.sh | sudo bash | ||
|
||
export JOB_TEMP_ROOT | ||
JOB_TEMP_ROOT=$(mktemp -d /tmp/job-root-XXXXXX) | ||
export HAB_CACHE_KEY_PATH | ||
HAB_CACHE_KEY_PATH="$JOB_TEMP_ROOT/keys" | ||
|
||
echo "--- :key: Generating fake origin key" | ||
hab license accept | ||
hab origin key generate | ||
|
||
# cd /workdir/src/bookshelf | ||
echo "generating package for $PACKAGE_NAME" | ||
hab pkg build "src/$PACKAGE_NAME" | ||
echo "which pushd " $(which pushd) | ||
|
||
pushd results | ||
pkg_name=$(ls -1t *.hart | head -1) | ||
popd | ||
echo pkg_name is $pkg_name | ||
buildkite-agent artifact upload results/$pkg_name |
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,77 @@ | ||
#!/bin/bash | ||
|
||
DEFAULT_COMPONENTS="automate-cs-bookshelf automate-cs-nginx automate-cs-oc-bifrost automate-cs-oc-erchef automate-cs-ocid" | ||
DEFAULT_COMPONENTS_DIR="components" | ||
tmp_file_name="" | ||
|
||
if [[ $# -ge 1 ]] | ||
then | ||
components=$1 | ||
else | ||
components=${DEFAULT_COMPONENTS} | ||
fi | ||
|
||
if [[ $# -ge 2 ]] | ||
then | ||
components_dir="$2" | ||
else | ||
components_dir="${DEFAULT_COMPONENTS_DIR}" | ||
fi | ||
|
||
check_hart() { | ||
formated=` echo $1 | awk -F'-' -v b=2 -v e=7 '{printf "%s %s ", $(NF-2), $(NF-3); for (i=b;i<= (NF - 4);i++) printf "%s%s", $i, (i< (NF -4) ? "-" : "\n")}'` | ||
IFS=' ' read -r timestamp version component <<< "${formated}" | ||
echo "timestamp $timestamp, version $version, component $component" | ||
component1=`echo $component | tr -d "_\-\""` | ||
export ${component1}="$component/$version/$timestamp" | ||
} | ||
|
||
escape_char() { | ||
echo $1 | sed 's/\([-]\)/\\\1/g' | ||
} | ||
|
||
make_tmp() { | ||
count=0 | ||
while [ -f "tmp_$count" ] | ||
do | ||
count=`expr $count + 1` | ||
done | ||
tmp_file_name="tmp_$count" | ||
} | ||
|
||
for hart in `ls results/*.hart` | ||
do | ||
check_hart $hart | ||
done | ||
|
||
for component in `echo "$components"` | ||
do | ||
plan_file="${components_dir}/$component/habitat/plan.sh" | ||
echo "Processing $plan_file" | ||
make_tmp | ||
tmp_file=${tmp_file_name} | ||
cp $plan_file "$tmp_file" | ||
sed -n '/pkg_deps/,/)/p' < "$plan_file" | grep "/" | | ||
while read dep | ||
do | ||
echo "processing $dep in $plan_file" | ||
dep_component=`echo $dep | awk -F'/' '{print $2}' | tr -d "_\-\""` | ||
echo "dep_component = ${dep_component}, value = ${!dep_component}" | ||
if [[ -n "${!dep_component}" ]] | ||
then | ||
IFS='/' read -r CScomponent version timestamp <<< "${!dep_component}" | ||
echo "timestamp $timestamp, version $version, component $CScomponent" | ||
CScomponent1=`escape_char $CScomponent` | ||
echo "sed \"/\/$CScomponent1/ s|\/$CScomponent1.*|$CScomponent1/$version/$timestamp|\"" | ||
sed -i "/pkg_deps/,/)/ s|\/$CScomponent1.*|/$CScomponent1/$version/$timestamp\"|" "${tmp_file}" | ||
fi | ||
done | ||
cp $tmp_file $plan_file | ||
rm $tmp_file | ||
echo "==================================" | ||
echo "file content after replace" | ||
cat $plan_file | ||
echo "==================================" | ||
done | ||
|
||
exit 0 |
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
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.
Why do we need this line since we are replacing the build?