Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #192 from alohr51/single-guide-repo
Browse files Browse the repository at this point in the history
use single guide repo
  • Loading branch information
kSee04 committed Mar 6, 2020
2 parents 5d8ebb3 + 0323812 commit 2b063dc
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 91 deletions.
4 changes: 4 additions & 0 deletions Dockerfile
Expand Up @@ -39,10 +39,14 @@ COPY . /app

ARG DOCS_GIT_URL
ARG DOCS_GIT_REVISION
ARG GUIDES_GIT_URL
ARG GUIDES_GIT_REVISION

ENV JEKYLL_ENV "production"
ENV DOCS_GIT_URL $DOCS_GIT_URL
ENV DOCS_GIT_REVISION $DOCS_GIT_REVISION
ENV GUIDES_GIT_URL $GUIDES_GIT_URL
ENV GUIDES_GIT_REVISION $GUIDES_GIT_REVISION

RUN bash ./scripts/build_jekyll_maven.sh

Expand Down
2 changes: 2 additions & 0 deletions ci/build.sh
Expand Up @@ -22,5 +22,7 @@ docker build $DOCKER_OPTS --pull \
--build-arg PRODUCT_VERSION="$PRODUCT_VERSION" \
--build-arg DOCS_GIT_URL="$DOCS_GIT_URL" \
--build-arg DOCS_GIT_REVISION="$DOCS_GIT_REVISION" \
--build-arg GUIDES_GIT_URL="$GUIDES_GIT_URL" \
--build-arg GUIDES_GIT_REVISION="$GUIDES_GIT_REVISION" \
-t "$DOCKER_IMAGE_NAME:$DOCKER_IMAGE_TAG" \
.
2 changes: 1 addition & 1 deletion scripts/build_clone_docs.sh
Expand Up @@ -4,7 +4,7 @@
# this sequence of commands to workaround that limitation.
# Could _not_ use:
# git clone git@github.com:kabanero-io/docs.git --branch develop src/main/content
DOCS_GIT_URL=${1:-"https://github.com/kabanero-io/docs"}
DOCS_GIT_URL=${1:-"https://github.com/kabanero-io/docs.git"}
DOCS_GIT_REVISION=${2:-"master"}

CUR_DIR="$(cd $(dirname $0) && pwd)"
Expand Down
73 changes: 0 additions & 73 deletions scripts/build_clone_guides.rb

This file was deleted.

36 changes: 36 additions & 0 deletions scripts/build_clone_guides.sh
@@ -0,0 +1,36 @@
# Clone the guides (draft or published)
GUIDES_GIT_URL=${1:-"https://github.com/kabanero-io/guides.git"}
GUIDES_GIT_REVISION=${2:-"master"}
# ADD guides we want skipped here, todo to make this a parameter
SKIP_GUIDES=()

CUR_DIR="$(cd $(dirname $0) && pwd)"

pushd "$CUR_DIR/../src/main/content"

# Remove the folder to allow this repeating execution of this script
rm -rf guides

echo "Start cloning guides repository: ${GUIDES_GIT_URL} with revision: ${GUIDES_GIT_REVISION}"
mkdir guides-tmp guides && cd guides-tmp

# This is how you clone a repo without autocreating a parent folder with the name of the repo
# The clone is picky about cloning into a folder that is not empty (src/main/content)
git clone "${GUIDES_GIT_URL}" --branch "${GUIDES_GIT_REVISION}" .
mv publish/* ../guides

if [ "$JEKYLL_DRAFT_GUIDES" == "true" ]; then
mv draft/* ../guides
fi

rm -rf ../guides-tmp

# Remove guides we want skipped from guides dir
for guide in ${SKIP_GUIDES[@]}; do
rm -rf ../guides/"${guide}";
done

popd
echo "Done cloning guides repositorys"


15 changes: 3 additions & 12 deletions scripts/build_jekyll_maven.sh
Expand Up @@ -17,24 +17,15 @@ cp ./node_modules/carbon-icons/dist/svg/* "$CONTENT_DIR/img/carbon-icons/"

./scripts/build_gem_dependencies.sh

# Guides that are ready to be published to the Code Conjuring site
# Guides that are ready to be published to the console
if [ "$TRAVIS_EVENT_TYPE" != "pull_request" ]; then
echo "Cloning repositories with name starting with guide or iguide..."
ruby ./scripts/build_clone_guides.rb;
echo "Cloning guides..."
./scripts/build_clone_guides.sh "${GUIDES_GIT_URL}" "${GUIDES_GIT_REVISION}"
fi

# Development environment only actions
if [ "$JEKYLL_ENV" != "production" ]; then
echo "Not in production environment..."

# Development environments with draft docs/guides
if [ "$JEKYLL_DRAFT_GUIDES" == "true" ] && [ "$TRAVIS_EVENT_TYPE" != "pull_request" ]; then
echo "Clone draft guides for test environments..."
ruby ./scripts/build_clone_guides.rb "draft-guide"
#./scripts/build_clone_docs.sh "draft" # Argument is a revision of kabanero-io/docs repo
else
echo "not cloning draft guides"
fi
fi

# Only clone docs if they're not already there. Some builds clone the docs prior to this.
Expand Down
7 changes: 2 additions & 5 deletions src/main/content/_includes/end-of-guide.html
Expand Up @@ -23,11 +23,8 @@ <h2 tabindex="0">{{t.end-of-guide}}</h2>
<p id="guide_attribution"></p>
<h3 id="improve_guide_feedback">{{t.improve-guide-feedback}}</h3>
{% if page.layout == 'guide' or page.layout == 'guide-multipane' or page.layout == 'guide-markdown' %}
<p><a target="_blank" rel="noopener noreferrer" href="{{site.github_url}}/guide-{{page.url | replace: '/guides/', ''}}/issues">Raise an issue</a> to share feedback</p>
<p><a target="_blank" rel="noopener noreferrer" href="{{site.github_url}}/guide-{{page.url | replace: '/guides/', ''}}/pulls">Create a pull request</a> to contribute to this guide</p>
{% elsif page.layout == 'iguide-multipane' %}
<p><a target="_blank" rel="noopener noreferrer" href="{{site.github_url}}/iguide-{{page.url | replace: '/guides/', ''}}/issues">Raise an issue</a> to share feedback</p>
<p><a target="_blank" rel="noopener noreferrer" href="{{site.github_url}}/iguide-{{page.url | replace: '/guides/', ''}}/pulls">Create a pull request</a> to contribute to this guide</p>
<p><a target="_blank" rel="noopener noreferrer" href="{{site.github_url}}/guides/issues">Raise an issue</a> to share feedback</p>
<p><a target="_blank" rel="noopener noreferrer" href="{{site.github_url}}/guides/tree/master/publish">Edit or create new guides</a> to help contribute</p>
{% endif %}

<h3 id="need_help">{{t.need-help}}</h3>
Expand Down

0 comments on commit 2b063dc

Please sign in to comment.