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

[DOC-618] Extend create-docs-images with vendor/ arangoproxy update #325

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
99 changes: 54 additions & 45 deletions .circleci/base_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ commands:
fi

cd /home/circleci/project/docs-hugo/site
git config user.email "daniele@arangodb.com"
git config user.email "simran@arangodb.com"
git config user.name "CircleCI Job"
git add data/ content/
git commit --allow-empty -m "[skip ci] Automatic commit of generated files from CircleCI"
Expand All @@ -289,28 +289,50 @@ commands:
git push
fi

commit-api-docs:
description: Commit api-docs files to api-docs repository
parameters:
version:
type: string
default: ""
tag:
type: string
default: ""

jobs:
update-vendor:
docker:
- image: cimg/go:1.21.3
steps:
- run:
name: Clone api-docs repo
- add_ssh_keys:
fingerprints:
# GitHub Deploy Key SHA256:95F/qmjGDkD1MS5Q6UVPbVGpy97JZrHi/4AIxka+vZ4
- "bc:4d:f3:df:53:ad:22:d8:60:5d:10:d8:fd:74:d2:cd"
- run: ssh-keyscan github.com >> ~/.ssh/known_hosts && cat ~/.ssh/known_hosts
- run:
name: Clone docs repo
command: |
git clone git@github.com:arangodb/api-docs.git
cd /home/circleci/project/api-docs
cp /home/circleci/project/docs-hugo/site/data/<< parameters.version >>/api-docs.json /home/circleci/project/api-docs/
git commit --allow-empty -m 'Commit api-docs << parameters.tag >>' api-docs.json
git tag -f << parameters.tag >>
git push -f origin << parameters.tag >>
git push -f
git clone --depth 1 git@github.com:arangodb/docs-hugo.git --branch $CIRCLE_BRANCH
- run:
name: Update vendor dependencies folder
command: |
cd docs-hugo/toolchain/arangoproxy
rm -r vendor go.sum
go mod tidy
go mod vendor
- run:
name: Create PR with new vendor folder
command: |
cd docs-hugo/toolchain/arangoproxy
git checkout -b update-vendor-$CIRCLE_BUILD_NUM

git config user.email "simran@arangodb.com"
git config user.name "CircleCI Job"
git add vendor/ go.mod go.sum
git commit --allow-empty -m "[skip ci] Update ArangoProxy vendor/ folder"

git push -u origin update-vendor-$CIRCLE_BUILD_NUM
curl -X POST https://candid-daffodil-f96315.netlify.app/.netlify/functions/circleci \
--header 'docs-webhook-event: scheduled-create-pr' \
--header "docs-branch-name: update-vendor-$CIRCLE_BUILD_NUM" \
--header "docs-pr-title: [CircleCI Generated] update-vendor-$CIRCLE_BUILD_NUM" \
--header "docs-pr-body: Automatically updated ArangoProxy vendor folder CircleCI << pipeline.parameters.workflow >> workflow"
- persist_to_workspace:
root: .
paths:
- docs-hugo

jobs:
create-docs-images:
parameters:
architecture:
Expand All @@ -324,10 +346,8 @@ jobs:
image: ubuntu-2004:current
resource_class: << parameters.executor >>
steps:
- run:
name: Clone docs repo
command: |
git clone --depth 1 https://github.com/arangodb/docs-hugo.git --branch $CIRCLE_BRANCH
- attach_workspace:
at: .
- run:
name: Create docker images
command: |
Expand All @@ -341,11 +361,11 @@ jobs:
name: Push docker images
command: |
cd docs-hugo/toolchain/docker
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USER" --password-stdin
# echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USER" --password-stdin

docker push arangodb/docs-hugo:site-<< parameters.architecture >>
docker push arangodb/docs-hugo:arangoproxy-<< parameters.architecture >>
docker push arangodb/docs-hugo:toolchain-<< parameters.architecture >>
# docker push arangodb/docs-hugo:site-<< parameters.architecture >>
# docker push arangodb/docs-hugo:arangoproxy-<< parameters.architecture >>
# docker push arangodb/docs-hugo:toolchain-<< parameters.architecture >>


plain-build:
Expand Down Expand Up @@ -387,13 +407,6 @@ jobs:
docker compose -f docker-compose.plain-build.yml up --abort-on-container-exit
- upload-summary:
summary-name: "plain-build-summary"
- when:
condition:
equal: [ "api-docs", << pipeline.parameters.workflow >> ]
steps:
- commit-api-docs:
version: << pipeline.parameters.version >>
tag: << pipeline.parameters.tag >>

- persist_to_workspace:
root: .
Expand Down Expand Up @@ -528,23 +541,25 @@ jobs:







workflows:
create-docs-images-amd64:
when: { equal: [ create-docs-images-amd64, << pipeline.parameters.workflow >> ] }
jobs:
- update-vendor
- create-docs-images:
architecture: "amd64"
executor: "medium"
requires:
- update-vendor
create-docs-images-arm64:
when: { equal: [ create-docs-images-arm64, << pipeline.parameters.workflow >> ] }
jobs:
- update-vendor
- create-docs-images:
architecture: "arm64"
executor: "arm.medium"
requires:
- update-vendor
plain:
when: { equal: [ plain-build, << pipeline.parameters.workflow >> ] }
jobs:
Expand All @@ -553,11 +568,6 @@ workflows:
requires:
- plain-build

api-docs:
when: { equal: [ api-docs, << pipeline.parameters.workflow >> ] }
jobs:
- plain-build

release:
when: { equal: [ release, << pipeline.parameters.workflow >> ] }
jobs:
Expand All @@ -583,4 +593,3 @@ workflows:
- commit-generated:
requires:
- approve-workflow

2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ orbs:
parameters:
workflow:
type: enum
enum: [no-op, plain-build, generate, api-docs, release, compile, generate-scheduled, commit-generated, generate-oasisctl, create-docs-images-amd64, create-docs-images-arm64]
enum: [no-op, plain-build, generate, release, compile, generate-scheduled, commit-generated, generate-oasisctl, create-docs-images-amd64, create-docs-images-arm64]
default: no-op

deploy-url:
Expand Down