Skip to content
This repository was archived by the owner on Oct 7, 2025. It is now read-only.

Commit ba47987

Browse files
committed
Merging 2.x.
2 parents e2defdf + 9881473 commit ba47987

File tree

583 files changed

+15177
-4153
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

583 files changed

+15177
-4153
lines changed

.ansible-lint

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ skip_list:
1313
- fqcn-builtins
1414
- template-instead-of-copy # to skip over roles/ssl/tasks/copy.yml errors, temporarily.
1515
- name[template] # it doesn't like Jinja templates being in the middle of a task name, which seems silly to me.
16+
- name[casing] # sometimes included Galaxy roles break linting rules and cause failures
1617
exclude_paths:
17-
- roles/debian/wazuh/ # imported role uses yes/no instead of true/false so always fails
18+
- roles/contrib/ # we don't control these roles

.github/workflows/ce-provision-build-docs.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 95 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,108 @@
1-
name: Build docs
1+
name: Publish docs
22

3-
# Run this workflow when a PR to 1.x gets merged
3+
# Run this workflow on demand or every time a PR is accepted to a main branch
44
on:
55
pull_request:
66
types: [closed]
77
branches:
88
- 1.x
9+
- 2.x
10+
workflow_dispatch:
11+
# Set target docs branch name
12+
env:
13+
docs_branch: docs-${{ github.event.pull_request.base.ref }}
914

1015
jobs:
11-
# Set the job key. The key is displayed as the job name
12-
# when a job name is not provided
13-
build-docs:
14-
# Name the Job
15-
name: Build the documentation
16-
# Set the type of machine to run on
17-
runs-on: ubuntu-20.04
16+
# See https://stackoverflow.com/a/74378072
17+
set-docs-branch:
18+
name: Make docs branch name available to publish-docs job
19+
runs-on: ubuntu-latest
20+
outputs:
21+
docs_branch: ${{ steps.init.outputs.docs_branch }}
1822

1923
steps:
20-
# Checks out a copy of your repository on the ubuntu-latest machine
21-
- name: Checkout code
22-
uses: actions/checkout@v2
24+
- name: Make environment variables global
25+
id: init
26+
run: |
27+
echo "docs_branch=${{ env.docs_branch }}" >> $GITHUB_OUTPUT
28+
29+
publish-docs:
30+
name: Publish the ce-provision docs to GitHub
31+
# Only run the job if it is not coming from a documentation branch
32+
needs: set-docs-branch
33+
if: ${{ github.event.pull_request.head.ref != needs.set-docs-branch.outputs.docs_branch }}
34+
runs-on: ubuntu-latest
35+
36+
# Use our ce-dev Debian base container
37+
container:
38+
image: codeenigma/ce-dev-controller:2.x
39+
volumes:
40+
- ${{ github.workspace }}:/home/controller
41+
42+
steps:
43+
- uses: actions/checkout@v4
2344
with:
24-
fetch-depth: 0
25-
26-
# Configures global Git variables for committing
27-
- name: Configure Git
28-
run: |
29-
git config --global user.email "sysadm@codeenigma.com"
30-
git config --global user.name "Code Enigma CI"
31-
git config --global pull.rebase false
32-
33-
# Installs the ce-dev stack
34-
- name: Install ce-dev
35-
run: |
36-
cd /tmp
37-
wget https://golang.org/dl/go1.15.8.linux-amd64.tar.gz
38-
sudo tar -C /usr/local -xzf go1.15.8.linux-amd64.tar.gz
39-
export PATH=$PATH:/usr/local/go/bin
40-
git clone https://github.com/FiloSottile/mkcert && cd mkcert
41-
go build -ldflags "-X main.Version=$(git describe --tags)"
42-
sudo mv ./mkcert /usr/local/bin && cd ../
43-
sudo chmod +x /usr/local/bin/mkcert
44-
rm -Rf mkcert
45-
curl -sL https://raw.githubusercontent.com/codeenigma/ce-dev/1.x/install.sh | /bin/sh -s -- linux
46-
47-
# Uses the ce-dev stack to run Hugo to format and deploy the docs
45+
ref: docs-${{ github.event.pull_request.base.ref }}
46+
47+
# Configure environment
48+
- name: Prepare Git, GitHub CLI and installed CE tools
49+
run: |
50+
/usr/bin/git config --global user.email "sysadm@codeenigma.com"
51+
/usr/bin/git config --global user.name "Code Enigma CI"
52+
/usr/bin/git config --global pull.rebase false
53+
/usr/bin/git config --global --add safe.directory /__w/ce-provision/ce-provision
54+
(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) && sudo mkdir -p -m 755 /etc/apt/keyrings && out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg && cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null && sudo apt update && sudo apt install gh -y
55+
/usr/bin/su - ce-dev -c "cd /home/ce-dev/ce-provision && /usr/bin/git pull origin 2.x"
56+
/usr/bin/su - ce-dev -c "cd /home/ce-dev/ce-deploy && /usr/bin/git pull origin 1.x"
57+
58+
# First build and publish the markdown docs
59+
- name: Build and commit table of contents and README files back to the repo
60+
run: |
61+
/usr/bin/git fetch origin 2.x
62+
/usr/bin/git merge origin/${{ github.event.pull_request.base.ref }} --allow-unrelated-histories
63+
/bin/sh contribute/toc.sh
64+
/usr/bin/find . -name "*.md" | xargs git add
65+
/usr/bin/git diff --staged --quiet || /usr/bin/git commit -am "GitHub Actions - updating markdown docs - ${{ github.event.repository.updated_at }}"
66+
/usr/bin/git push origin docs-${{ github.event.pull_request.base.ref }}
67+
68+
# Create docs pull request
69+
- name: Create documentation pull requests
70+
run: |
71+
gh pr create --base ${{ github.event.pull_request.base.ref }} --head docs-${{ github.event.pull_request.base.ref }} --title "Documentation update - ${{ github.event.pull_request.base.ref }}" --body "**Automated pull request** created by GitHub Actions because of a documentation update." || echo "No commits between ${{ github.event.pull_request.base.ref }} and docs-${{ github.event.pull_request.base.ref }} - no PR created!"
72+
gh pr create --base devel-${{ github.event.pull_request.base.ref }} --head docs-${{ github.event.pull_request.base.ref }} --title "Documentation update - devel-${{ github.event.pull_request.base.ref }}" --body "**Automated pull request** created by GitHub Actions because of a documentation update." || echo "No commits between devel-${{ github.event.pull_request.base.ref }} and docs-${{ github.event.pull_request.base.ref }} - no PR created!"
73+
env:
74+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
76+
# Now build and publish the version of the docs
77+
- name: Install wiki2pages
78+
run: /usr/bin/su - ce-dev -c "/usr/bin/git clone https://github.com/codeenigma/wikis2pages.git /home/ce-dev/build/wiki2pages"
79+
80+
- name: Set up Ansible and SSH
81+
run: |
82+
mkdir -p /home/ce-dev/ansible/bin/hosts
83+
echo "wikis2pages-hugo ansible_host=127.0.0.1" > /home/ce-dev/ansible/bin/hosts/hosts
84+
echo "StrictHostKeyChecking=no" > /home/ce-dev/.ssh/config
85+
cat /home/ce-dev/.ssh/id_rsa.pub > /home/ce-dev/.ssh/authorized_keys
86+
chown ce-dev:ce-dev /home/ce-dev/.ssh/config
87+
chmod 700 /home/ce-dev/.ssh/config
88+
chown ce-dev:ce-dev /home/ce-dev/.ssh/authorized_keys
89+
chmod 700 /home/ce-dev/.ssh/authorized_keys
90+
/usr/sbin/sshd&
91+
92+
- name: Initialise wiki2pages for ce-provision ${{ github.event.pull_request.base.ref }}
93+
run: |
94+
/usr/bin/su - ce-dev -c "cd /home/ce-dev/build/wiki2pages && /bin/sh init.sh --repo https://github.com/codeenigma/ce-provision.git --branch ${{ github.event.pull_request.base.ref }} --no-ce-dev"
95+
/usr/bin/su - ce-dev -c "cd /home/ce-dev/build/wiki2pages && /home/ce-dev/ansible/bin/ansible-playbook -e 'wiki2pages_build_path=/home/ce-dev/build/wiki2pages' -i /home/ce-dev/ansible/bin/hosts /home/ce-dev/build/wiki2pages/ce-dev/ansible/provision.yml"
96+
/usr/bin/su - ce-dev -c "cd /home/ce-dev/build/wiki2pages && /bin/sh set-current.sh --project ce-provision-${{ github.event.pull_request.base.ref }} --no-ce-dev"
97+
/usr/bin/su - ce-dev -c "cd /home/ce-dev/build/wiki2pages && /home/ce-dev/ansible/bin/ansible-playbook -e 'wiki2pages_build_path=/home/ce-dev/build/wiki2pages launch_hugo_server=false' -i /home/ce-dev/ansible/bin/hosts /home/ce-dev/build/wiki2pages/ce-dev/ansible/deploy.yml"
98+
/usr/bin/su - ce-dev -c "cd /home/ce-dev/build/wiki2pages/content/ce-provision-${{ github.event.pull_request.base.ref }} && /bin/sh contribute/toc_hugo.sh"
99+
100+
- name: Run Hugo
101+
run: |
102+
/usr/bin/su - ce-dev -c "cd /home/ce-dev/build/wiki2pages && hugo"
103+
48104
- name: Publish documentation
49105
run: |
50-
cd
51-
git clone https://github.com/codeenigma/wikis2pages.git
52-
cd wikis2pages
53-
/bin/bash init.sh https://${{ secrets.GITHUB_TOKEN }}@github.com/codeenigma/ce-provision.git 1.x
54-
/bin/sh set-current.sh ce-provision-1.x
55-
docker exec --user ce-dev --workdir /home/ce-dev/deploy/live.local wikis2pages-hugo hugo
56-
/bin/sh .github-actions-push.sh
57-
cd /home/runner/wikis2pages/public/ce-provision-1.x
58-
git remote add ci https://${{ secrets.DOCS_GITHUB_TOKEN }}@github.com/codeenigma/ce-provision-docs.git
59-
git push ci master
60-
shell: bash
106+
/usr/bin/su - ce-dev -c "cd /home/ce-dev/build/wiki2pages && /bin/sh /home/ce-dev/build/wiki2pages/.github-actions-push.sh"
107+
/usr/bin/su - ce-dev -c "cd /home/ce-dev/build/wiki2pages/public/ce-provision-${{ github.event.pull_request.base.ref }} && /usr/bin/git remote add ci https://${{ secrets.DOCS_GITHUB_TOKEN }}@github.com/codeenigma/ce-provision-docs.git"
108+
/usr/bin/su - ce-dev -c "cd /home/ce-dev/build/wiki2pages/public/ce-provision-${{ github.event.pull_request.base.ref }} && /usr/bin/git push ci master"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Run GitLab server test build
2+
3+
# Run this workflow every time a new commit is pushed to your repository
4+
on:
5+
pull_request:
6+
7+
jobs:
8+
# Set the job key. The key is displayed as the job name
9+
# when a job name is not provided
10+
test-gitlab:
11+
if: ${{ github.event.pull_request.head.ref != 'documentation' }}
12+
# Name the Job
13+
name: Build a GitLab server with ce-provision
14+
# Set the type of machine to run on
15+
runs-on: ubuntu-latest
16+
17+
# Use our ce-dev Debian base container
18+
container:
19+
image: codeenigma/ce-dev:2.x
20+
volumes:
21+
- ${{ github.workspace }}:/home/controller
22+
23+
steps:
24+
- name: Install ce-provision
25+
run: |
26+
/usr/bin/curl -LO https://raw.githubusercontent.com/codeenigma/ce-provision/${{ github.event.pull_request.head.ref }}/install.sh
27+
/usr/bin/chmod +x ./install.sh
28+
/usr/bin/sudo ./install.sh --version ${{ github.event.pull_request.head.ref }} --config-branch ${{ github.event.pull_request.base.ref }} --docker --no-firewall
29+
30+
# Run a GitLab server provision
31+
- name: Prepare Git repos on disk
32+
run: |
33+
/usr/bin/git config --global --add safe.directory /home/controller/ce-provision
34+
/usr/bin/git config --global --add safe.directory /home/controller/ce-provision/config
35+
36+
- name: Start SSHD
37+
run: /usr/sbin/sshd&
38+
39+
- name: Provision a test GitLab server
40+
run: /usr/bin/su - controller -c "cd /home/controller/ce-provision && /bin/sh /home/controller/ce-provision/scripts/provision.sh --python-interpreter /home/controller/ce-python/bin/python3 --repo dummy --branch dummy --workspace /home/controller/ce-provision/ce-dev/ansible --playbook plays/gitlab/ci.yml --own-branch ${{ github.event.pull_request.head.ref }} --config-branch ${{ github.event.pull_request.base.ref }} --force"

.github/workflows/ce-provision-test-gitlab.yml.NOPE

Lines changed: 0 additions & 42 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Run night test builds
2+
3+
# Run this workflow nightly
4+
on:
5+
schedule:
6+
- cron: '30 4 * * *'
7+
8+
jobs:
9+
# Set the job key. The key is displayed as the job name
10+
# when a job name is not provided
11+
test-nightly:
12+
# Name the Job
13+
name: Build server with ce-provision
14+
# Set the type of machine to run on
15+
runs-on: ubuntu-latest
16+
17+
# Use our ce-dev Debian base container
18+
container:
19+
image: codeenigma/ce-dev:2.x
20+
volumes:
21+
- ${{ github.workspace }}:/home/controller
22+
23+
steps:
24+
- name: Install ce-provision
25+
run: |
26+
/usr/bin/curl -LO https://raw.githubusercontent.com/codeenigma/ce-provision/2.x/install.sh
27+
/usr/bin/chmod +x ./install.sh
28+
/usr/bin/sudo ./install.sh --docker --no-firewall
29+
30+
# Run a web server provision
31+
- name: Prepare Git repos on disk
32+
run: |
33+
/usr/bin/git config --global --add safe.directory /home/controller/ce-provision
34+
/usr/bin/git config --global --add safe.directory /home/controller/ce-provision/config
35+
36+
- name: Start SSHD
37+
run: /usr/sbin/sshd&
38+
39+
- name: Provision a test web server
40+
run: /usr/bin/su - controller -c "cd /home/controller/ce-provision && /bin/sh /home/controller/ce-provision/scripts/provision.sh --python-interpreter /home/controller/ce-python/bin/python3 --repo dummy --branch dummy --workspace /home/controller/ce-provision/ce-dev/ansible --playbook plays/web/ci.yml --own-branch 2.x --config-branch 2.x --force"
41+
42+
- name: Provision a test GitLab server
43+
run: /usr/bin/su - controller -c "cd /home/controller/ce-provision && /bin/sh /home/controller/ce-provision/scripts/provision.sh --python-interpreter /home/controller/ce-python/bin/python3 --repo dummy --branch dummy --workspace /home/controller/ce-provision/ce-dev/ansible --playbook plays/gitlab/ci.yml --own-branch 2.x --config-branch 2.x --force"

0 commit comments

Comments
 (0)