Skip to content

hello github action #20185

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

Closed
wants to merge 15 commits into from
Closed
30 changes: 30 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on:
push:
jobs:
docker_build:
env:
BRANCH_NAME: ${{github.ref_name}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate Approved Licenses File
run: python -m jsonschema -i docker/approved_licenses.json docker/approved_licenses.schema.json
- name: Validate Dependabot Config
run: ./docker/verify_dependabot.sh
- name: Build Docker Images
run: ./docker/build_docker.sh
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: docker_images
path: artifacts
retention-days: 1


# no_output_timeout: 60m
# - store_artifacts:
# path: artifacts
# destination: docker_images
# workflows:
# version: 2
# full_build:
14 changes: 7 additions & 7 deletions docker/build_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function docker_build {
image_name=$(basename $1)
echo "Starting build for dir: $1, image: ${image_name}, pwd: $(pwd)"
cd $1
if [[ "$CIRCLE_BRANCH" == "master" ]] && [[ "$(prop 'devonly')" ]]; then
if [[ "$BRANCH_NAME" == "master" ]] && [[ "$(prop 'devonly')" ]]; then
echo "== skipping image [${image_name}] as it is marked devonly =="
return 0
fi
Expand Down Expand Up @@ -332,7 +332,7 @@ function docker_build {
fi
if ! ${DOCKER_SRC_DIR}/post_github_comment.py ${image_full_name}; then
echo "Failed post_github_comment.py. Will stop build only if not on master"
if [ "$CIRCLE_BRANCH" == "master" ]; then
if [ "$BRANCH_NAME" == "master" ]; then
echo "Continuing as we are on master branch..."
else
echo "failing build!!"
Expand All @@ -341,7 +341,7 @@ function docker_build {
fi
else
echo "Skipping docker push"
if [ "$CIRCLE_BRANCH" == "master" ]; then
if [ "$BRANCH_NAME" == "master" ]; then
echo "Did not push image on master. Failing build"
exit 1
fi
Expand Down Expand Up @@ -373,14 +373,14 @@ EOF
}

# default compare circle branch against master
DIFF_COMPARE=origin/master...${CIRCLE_BRANCH}
DIFF_COMPARE=origin/master...${BRANCH_NAME}

if [ -z "$CIRCLE_SHA1" ]; then
echo "CIRCLE_SHA1 not set. Assuming local testing."
CIRCLE_SHA1=testing
DOCKER_ORG=${DOCKER_ORG:-devtesting}

if [ -z "$CIRCLE_BRANCH" ]; then
if [ -z "$BRANCH_NAME" ]; then
# simply compare against origin/master
DIFF_COMPARE=origin/master
fi
Expand Down Expand Up @@ -416,7 +416,7 @@ if [[ -n "$1" ]]; then
DOCKER_INCLUDE_GREP="/${1}$"
fi

if [ "$CIRCLE_BRANCH" == "master" ]; then
if [ "$BRANCH_NAME" == "master" ]; then
# on master we use the range obtained from CIRCLE_COMPARE_URL
# example of comapre url: https://github.com/demisto/content/compare/62f0bd03be73...1451bf0f3c2a
# if there wasn't a successful build CIRCLE_COMPARE_URL is empty. We set diff compare to special ALL
Expand All @@ -433,7 +433,7 @@ if [ "$CIRCLE_BRANCH" == "master" ]; then
DOCKER_ORG=demisto
fi

echo "DOCKER_ORG: ${DOCKER_ORG}, DIFF_COMPARE: [${DIFF_COMPARE}], SCRIPT_DIR: [${SCRIPT_DIR}], CIRCLE_BRANCH: ${CIRCLE_BRANCH}, PWD: [${CURRENT_DIR}]"
echo "DOCKER_ORG: ${DOCKER_ORG}, DIFF_COMPARE: [${DIFF_COMPARE}], SCRIPT_DIR: [${SCRIPT_DIR}], BRANCH_NAME: ${BRANCH_NAME}, PWD: [${CURRENT_DIR}]"

# echo to bash env to be used in future steps
CIRCLE_ARTIFACTS="artifacts"
Expand Down