diff --git a/.github/workflows/ce-provision-test-gitlab.yml b/.github/workflows/ce-provision-test-gitlab.yml index bd50e7233..d72de1b7f 100644 --- a/.github/workflows/ce-provision-test-gitlab.yml +++ b/.github/workflows/ce-provision-test-gitlab.yml @@ -40,3 +40,44 @@ jobs: - name: Provision a test GitLab server 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" + +name: Run GitLab server test build + +# Run this workflow every time a new commit is pushed to your repository +on: + pull_request: + +jobs: + # Set the job key. The key is displayed as the job name + # when a job name is not provided + test-gitlab: + if: ${{ github.event.pull_request.head.ref != 'documentation' }} + # Name the Job + name: Build a GitLab server with ce-provision + # Set the type of machine to run on + runs-on: ubuntu-latest + + # Use our ce-dev Debian base container + container: + image: codeenigma/ce-dev:2.x + volumes: + - ${{ github.workspace }}:/home/controller + + steps: + - name: Install ce-provision + run: | + /usr/bin/curl -LO https://raw.githubusercontent.com/codeenigma/ce-provision/${{ github.event.pull_request.head.ref }}/install.sh + /usr/bin/chmod +x ./install.sh + /usr/bin/sudo ./install.sh --version ${{ github.event.pull_request.head.ref }} --config-branch ${{ github.event.pull_request.base.ref }} --docker --no-firewall + + # Run a GitLab server provision + - name: Prepare Git repos on disk + run: | + /usr/bin/git config --global --add safe.directory /home/controller/ce-provision + /usr/bin/git config --global --add safe.directory /home/controller/ce-provision/config + + - name: Start SSHD + run: /usr/sbin/sshd& + + - name: Provision a test GitLab server + 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" diff --git a/.github/workflows/ce-provision-test-nightly.yml b/.github/workflows/ce-provision-test-nightly.yml new file mode 100644 index 000000000..a10fdd67a --- /dev/null +++ b/.github/workflows/ce-provision-test-nightly.yml @@ -0,0 +1,43 @@ +name: Run night test builds + +# Run this workflow nightly +on: + schedule: + - cron: '30 4 * * *' + +jobs: + # Set the job key. The key is displayed as the job name + # when a job name is not provided + test-nightly: + # Name the Job + name: Build server with ce-provision + # Set the type of machine to run on + runs-on: ubuntu-latest + + # Use our ce-dev Debian base container + container: + image: codeenigma/ce-dev:2.x + volumes: + - ${{ github.workspace }}:/home/controller + + steps: + - name: Install ce-provision + run: | + /usr/bin/curl -LO https://raw.githubusercontent.com/codeenigma/ce-provision/2.x/install.sh + /usr/bin/chmod +x ./install.sh + /usr/bin/sudo ./install.sh --docker --no-firewall + + # Run a web server provision + - name: Prepare Git repos on disk + run: | + /usr/bin/git config --global --add safe.directory /home/controller/ce-provision + /usr/bin/git config --global --add safe.directory /home/controller/ce-provision/config + + - name: Start SSHD + run: /usr/sbin/sshd& + + - name: Provision a test web server + 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" + + - name: Provision a test GitLab server + 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" diff --git a/.github/workflows/ce-provision-test-web.yml b/.github/workflows/ce-provision-test-web.yml index 54421cd40..595905064 100644 --- a/.github/workflows/ce-provision-test-web.yml +++ b/.github/workflows/ce-provision-test-web.yml @@ -1,9 +1,7 @@ name: Run web server test build -# Run this workflow nightly and every time a new commit pushed to your repository +# Run this every time a new commit is pushed to your repository on: - schedule: - - cron: '30 4 * * *' pull_request: jobs: diff --git a/.wikis2pages.yml b/.wikis2pages.yml index 7d33c03cb..f491e7fe0 100644 --- a/.wikis2pages.yml +++ b/.wikis2pages.yml @@ -1,10 +1,10 @@ -ce-provision-1.x: +ce-provision-2.x: src: https://github.com/codeenigma/ce-provision.git - src_branch: 1.x + src_branch: 2.x src_subdir: 'docs' dest: https://github.com/codeenigma/ce-provision-docs.git # remote and token for pushing added in GitHub Actions directly dest_branch: master - dest_subdir: 1.x + dest_subdir: 2.x title: ce-provision type: doc - base_url: https://codeenigma.github.io/ce-provision-docs/1.x + base_url: https://codeenigma.github.io/ce-provision-docs/2.x diff --git a/install.sh b/install.sh index 7ca8822d0..53db4ce5d 100755 --- a/install.sh +++ b/install.sh @@ -14,7 +14,7 @@ usage(){ /usr/bin/echo '--version: ce-provision version to use (default: 2.x)' /usr/bin/echo '--user: Ansible controller user (default: controller)' /usr/bin/echo '--config: Git URL to your ce-provision Ansible config repository (default: https://github.com/codeenigma/ce-provision-config-example.git)' - /usr/bin/echo '--config-branch: branch of your Ansible config repository to use (default: 1.x)' + /usr/bin/echo '--config-branch: branch of your Ansible config repository to use (default: 2.x)' /usr/bin/echo '--no-firewall: skip installing iptables with ports 22, 80 and 443 open' /usr/bin/echo '--gitlab: install GitLab CE on this server (default: no, set to desired GitLab address to install, e.g. gitlab.example.com)' /usr/bin/echo '--letsencrypt: try to create an SSL certificate with LetsEncrypt (requires DNS pointing at this server for provided GitLab URL)' @@ -72,7 +72,7 @@ parse_options(){ VERSION="2.x" CONTROLLER_USER="controller" CONFIG_REPO="https://github.com/codeenigma/ce-provision-config-example.git" -CONFIG_REPO_BRANCH="1.x" +CONFIG_REPO_BRANCH="2.x" GITLAB_URL="no" LE_SUPPORT="no" FIREWALL="true" diff --git a/roles/debian/nodejs/defaults/main.yml b/roles/debian/nodejs/defaults/main.yml index 7e2324abf..0ae6c011c 100644 --- a/roles/debian/nodejs/defaults/main.yml +++ b/roles/debian/nodejs/defaults/main.yml @@ -1,7 +1,7 @@ --- nodejs: # Used by apt_unattended_upgrades - apt_origin_nodejs: "origin=. nodistro,codename=nodistro,label=. nodistro" # nodejs repo + apt_origin_nodejs: "origin=Node Source,codename=nodistro,label=Node Source" # nodejs repo apt_signed_by_nodejs: https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key apt_origin_yarn: "origin=yarn,codename=stable,label=yarn-stable" # yarn repo apt_signed_by_yarn: https://dl.yarnpkg.com/debian/pubkey.gpg diff --git a/roles/debian/nodejs/tasks/main.yml b/roles/debian/nodejs/tasks/main.yml index 3128b7bb8..0806e47f5 100644 --- a/roles/debian/nodejs/tasks/main.yml +++ b/roles/debian/nodejs/tasks/main.yml @@ -19,6 +19,14 @@ enabled: true key_refresh_timer_OnCalendar: "Mon *-*-* 00:15:00" +- name: Modify repository for Node.js 10.x + set_fact: + apt_repository: + types: "deb deb-src" + suites: "{{ ansible_distribution_release }}" + signed_by: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key" + when: nodejs.version == "10.x" + - name: Add Yarn repository and key. ansible.builtin.include_role: name: debian/apt_repository diff --git a/roles/debian/ssl/templates/le_cron.sh.j2 b/roles/debian/ssl/templates/le_cron.sh.j2 index d4af6bffb..dc7219155 100644 --- a/roles/debian/ssl/templates/le_cron.sh.j2 +++ b/roles/debian/ssl/templates/le_cron.sh.j2 @@ -37,7 +37,8 @@ if [ $certbot_exit_code -ne 0 ]; then # Certbot failed, send email notification recipient="{{ ssl.email }}" subject="Certbot Renewal Failed" - body="Certbot renewal failed with the following output: + hostname=$(cat /etc/hostname) + body="Certbot renewal failed on server $hostname with the following output: $certbot_output" send_email_notification "$recipient" "$subject" "$body"