From bc2fdc3a7fd091f311a2800ad2550abe2f1d0858 Mon Sep 17 00:00:00 2001 From: Gary H <26419401+Gary-H9@users.noreply.github.com> Date: Tue, 14 May 2024 14:40:17 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-test.yml | 43 ++++++++++++++ .github/workflows/openssf-scorecard.yml | 47 +++++++++++++++ .github/workflows/publish.yml | 59 +++++++++++++++++++ README.md | 2 +- config/tech-docs.yml | 23 ++++++++ scripts/documentation/local.sh | 27 +++++++++ .../features/features.html.md.erb | 58 ++++++++++++++++++ .../getting-started.html.md.erb | 13 ++++ source/index.html.md.erb | 27 +++++++++ source/javascripts/application.js | 1 + source/stylesheets/print.css.scss | 3 + source/stylesheets/screen-old-ie.css.scss | 4 ++ source/stylesheets/screen.css.scss | 1 + 13 files changed, 307 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-test.yml create mode 100644 .github/workflows/openssf-scorecard.yml create mode 100644 .github/workflows/publish.yml create mode 100644 config/tech-docs.yml create mode 100644 scripts/documentation/local.sh create mode 100644 source/documentation/features/features.html.md.erb create mode 100644 source/documentation/getting-started/getting-started.html.md.erb create mode 100644 source/index.html.md.erb create mode 100644 source/javascripts/application.js create mode 100644 source/stylesheets/print.css.scss create mode 100644 source/stylesheets/screen-old-ie.css.scss create mode 100644 source/stylesheets/screen.css.scss diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 0000000..14ba26e --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,43 @@ +--- + name: Build and Test + + on: + pull_request: + branches: + - main + + permissions: {} + + jobs: + build: + name: Build + runs-on: ubuntu-latest + container: + image: docker.io/ministryofjustice/tech-docs-github-pages-publisher@sha256:cd3513beca3fcaf5dd34cbe81a33b3ff30337d8ada5869b40a6454c21d6f7684 # v4.0.0 + permissions: + contents: read + steps: + - name: Checkout + id: checkout + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + + - name: Build + id: build + run: | + /usr/local/bin/package + test: + name: Test + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout + id: checkout + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + + - name: Lychee + id: lychee + uses: lycheeverse/lychee-action@c053181aa0c3d17606addfe97a9075a32723548a # v1.9.3 + with: + args: --verbose --no-progress './**/*.md' './**/*.html' './**/*.erb' --accept 403,200,429 + fail: true diff --git a/.github/workflows/openssf-scorecard.yml b/.github/workflows/openssf-scorecard.yml new file mode 100644 index 0000000..5995dcf --- /dev/null +++ b/.github/workflows/openssf-scorecard.yml @@ -0,0 +1,47 @@ +--- + name: OpenSSF Scorecard + + on: + branch_protection_rule: + push: + branches: + - main + schedule: + - cron: "30 6 * * 1" + workflow_dispatch: + + permissions: {} + + jobs: + openssf-scorecard: + name: OpenSSF Scorecard + runs-on: ubuntu-latest + permissions: + id-token: write + security-events: write + steps: + - name: Checkout + id: checkout + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + + - name: Run Analysis + id: run_analysis + uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1 + with: + results_file: results.sarif + results_format: sarif + publish_results: true + + - name: Upload SARIF + id: upload_sarif + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + with: + name: SARIF Results + path: results.sarif + retention-days: 5 + + - name: Upload to CodeQL + id: upload_to_codeql + uses: github/codeql-action/upload-sarif@df5a14dc28094dc936e103b37d749c6628682b60 # v3.25.0 + with: + sarif_file: results.sarif diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..79733aa --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,59 @@ +--- + name: Build and Publish + + on: + push: + branches: + - main + + permissions: {} + + concurrency: + group: github-pages + cancel-in-progress: true + + jobs: + build: + name: Build + runs-on: ubuntu-latest + container: + image: docker.io/ministryofjustice/tech-docs-github-pages-publisher@sha256:cd3513beca3fcaf5dd34cbe81a33b3ff30337d8ada5869b40a6454c21d6f7684 # v4.0.0 + permissions: + contents: read + steps: + - name: Checkout + id: checkout + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + + - name: Build + id: build + run: | + /usr/local/bin/package + - name: Upload Artifact + id: upload_artifact + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + with: + name: github-pages + path: artifact.tar + retention-days: 1 + overwrite: true + + publish: + needs: build + name: Publish + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.configure_pages.outputs.base_url }} + permissions: + contents: read + id-token: write + pages: write + steps: + - name: Configure Pages + id: configure_pages + uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0 + + - name: Deploy to GitHub Pages + id: deploy_pages + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 diff --git a/README.md b/README.md index 89fa182..5a85866 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![repo standards badge](https://img.shields.io/endpoint?labelColor=231f20&color=005ea5&style=for-the-badge&label=MoJ%20Compliant&url=https%3A%2F%2Foperations-engineering-reports.cloud-platform.service.justice.gov.uk%2Fapi%2Fv1%2Fcompliant_public_repositories%2Fendpoint%2F.devcontainer&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAABmJLR0QA/wD/AP+gvaeTAAAHJElEQVRYhe2YeYyW1RWHnzuMCzCIglBQlhSV2gICKlHiUhVBEAsxGqmVxCUUIV1i61YxadEoal1SWttUaKJNWrQUsRRc6tLGNlCXWGyoUkCJ4uCCSCOiwlTm6R/nfPjyMeDY8lfjSSZz3/fee87vnnPu75z3g8/kM2mfqMPVH6mf35t6G/ZgcJ/836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p7ehY5a6Tl2jjmVvitF9fxo5Yq8CaAfAkzLMnySt6uz/1k6bPx59CpCNxGfoSKA30IPoH7cQXdArwCOllFX/i53P5P9a/gNkKpsCMFRuFAAAAABJRU5ErkJggg==)](https://operations-engineering-reports.cloud-platform.service.justice.gov.uk/public-report/.devcontainer) -This repository was created by Ministry of Justice's Dev Container Community of Practice. The goal is to release a foundational image for deployment, develop features that boost developer efficiency, and set a benchmark for using containerised development environments within the Ministry of Justice. +This repository was created by Ministry of Justice's Dev Container Community of Practice. The goal is to release a foundational image for deployment, develop features that boost developer efficiency, and set a benchmark for using containerised development environments within the Ministry of Justice. Additionally this repository serves documentation relating to the use and configuration of devcontainers within the Ministry of Justice. Contact us on our Slack channel - [`#devcontainer-community`](https://moj.enterprise.slack.com/archives/C06DZ4F04JZ ). diff --git a/config/tech-docs.yml b/config/tech-docs.yml new file mode 100644 index 0000000..118988f --- /dev/null +++ b/config/tech-docs.yml @@ -0,0 +1,23 @@ +--- +collapsible_nav: true +default_owner_slack: "#devcontainer-community" +enable_search: true +footer_links: + Platform Status: https://status.observability-platform.service.justice.gov.uk +full_service_name: Dev Container User Guide +github_branch: main +github_repo: ministryofjustice/.devcontainer +header_links: + GitHub: https://github.com/ministryofjustice/.devcontainer + Slack: https://moj.enterprise.slack.com/archives/C06DZ4F04JZ +host: https://user-guide.devcontainer.service.justice.gov.uk +max_toc_heading_level: 3 +owner_slack_workspace: mojdt +phase: prototype +prevent_indexing: true +service_link: / +service_name: Dev Container User Guide +show_contribution_banner: true +show_expiry: true +show_govuk_logo: false +show_review_banner: true diff --git a/scripts/documentation/local.sh b/scripts/documentation/local.sh new file mode 100644 index 0000000..4d90621 --- /dev/null +++ b/scripts/documentation/local.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +MODE="${1:-preview}" +TECH_DOCS_PUBLISHER_IMAGE="docker.io/ministryofjustice/tech-docs-github-pages-publisher@sha256:cd3513beca3fcaf5dd34cbe81a33b3ff30337d8ada5869b40a6454c21d6f7684" # v4.0.0 + +case ${MODE} in +package | preview) + true + ;; +*) + echo "Usage: ${0} [package|preview]" + exit 1 + ;; +esac + +if [[ "$(uname --machine)" == "aarch64" ]] || [[ "$(uname --machine)" == "arm64" ]]; then + PLATFORM_FLAG="--platform=linux/amd64" +else + PLATFORM_FLAG="" +fi + +docker run -it --rm ${PLATFORM_FLAG} \ + --name "tech-docs-${MODE}" \ + --publish 4567:4567 \ + --volume "${PWD}/config:/app/config" \ + --volume "${PWD}/source:/app/source" \ + "${TECH_DOCS_PUBLISHER_IMAGE}" "/usr/local/bin/${MODE}" diff --git a/source/documentation/features/features.html.md.erb b/source/documentation/features/features.html.md.erb new file mode 100644 index 0000000..12e3260 --- /dev/null +++ b/source/documentation/features/features.html.md.erb @@ -0,0 +1,58 @@ +--- +title: Features +last_reviewed_on: 2024-04-15 +review_in: 3 months +weight: 0 +--- + +# <%= current_page.data.title %> + +## What are Features? + +In the context of the Ministry of Justice Dev Containers community, features are built by the community to satisfy the specific needs of our developers and the challenges they face on a day to day basis. + +Features are built using the [.devcontainer](https.//github.com/ministryofjustice/.devcontainer/features/test) GitHub repository and are designed to be modular and reusable. This means that features can be combined to create a custom development environment that meets the needs of a specific project or team. + +Features are can be used by Sofware Developers and those in Operations Roles to create consistent and reliable development environments for the applications and services they work on. + +## Available Features + +Features are located in the [features](https.//github.com/ministryofjustice/.devcontainer/features/src) folder in the Dev Containers GitHub repository. + +### AWS + +The AWS feature provides a development environment with the AWS CLI and SDKs pre-installed. + +### Cloud Platform + +The Cloud Platform feature provides a development environment with + +### Container Structure Test + +The Container Structure Test feature + +### Kubernetes + +### Static Analysis + +The Static Analysis feature provides a development environment with static analysis tools pre-installed. + +The tools include: + +- [checkov](https://www.checkov.io/) + +- [trivy](https://aquasecurity.github.io/trivy/v0.51/) + +- [terrascan](https://runterrascan.io/) + +### Terraform + +The Terraform feature provides a development environment with the Terraform CLI pre-installed. + +## Adding a New Features + +To add a new feature: + +1. Create a new feature in the [.devcontainer](https.//github.com/ministryofjustice/.devcontainer/features/src) GitHub repository. +1. Add the feature to the [Dev Containers Features](/documentation/features/features.html) documentation. +1. Add tests for the feature in the [.devcontainer](https.//github.com/ministryofjustice/.devcontainer/features/test) GitHub repository. diff --git a/source/documentation/getting-started/getting-started.html.md.erb b/source/documentation/getting-started/getting-started.html.md.erb new file mode 100644 index 0000000..14c252b --- /dev/null +++ b/source/documentation/getting-started/getting-started.html.md.erb @@ -0,0 +1,13 @@ +--- +title: Getting Started with Dev Containers +last_reviewed_on: 2024-04-15 +review_in: 3 months +weight: 0 +--- + +# <%= current_page.data.title %> + +## Heading + +Content + diff --git a/source/index.html.md.erb b/source/index.html.md.erb new file mode 100644 index 0000000..3e5a231 --- /dev/null +++ b/source/index.html.md.erb @@ -0,0 +1,27 @@ +--- +title: Dev Container User Guide +last_reviewed_on: 2024-05-14 +review_in: 3 months +weight: 0 +--- + +# <%= current_page.data.title %> + +This documentation is for teams and individuals who wish to integrate [Dev Containers](https://containers.dev/) into their development workflow. + +## Our Goals + +The goal of the community is to provide a consistent and reliable development environment for all developers throughout the Ministry of Justice. +We welcome contributions to this community - Pull Requests, documentation, feedback and requests are all welcome. + +## Getting Started + +- [Getting Started with Dev Containers in the Ministry of Justice](/documentation/getting-started/getting-started.html) + +## Features + +- [Dev Containers Features](/documentation/features/features.html) + +## Getting Help + +You can contact us on Slack via [#devcontainer-community](https://moj.enterprise.slack.com/archives/C06DZ4F04JZ). diff --git a/source/javascripts/application.js b/source/javascripts/application.js new file mode 100644 index 0000000..8a5d80b --- /dev/null +++ b/source/javascripts/application.js @@ -0,0 +1 @@ +//= require govuk_tech_docs diff --git a/source/stylesheets/print.css.scss b/source/stylesheets/print.css.scss new file mode 100644 index 0000000..82b181c --- /dev/null +++ b/source/stylesheets/print.css.scss @@ -0,0 +1,3 @@ +$is-print: true; + +@import "govuk_tech_docs"; diff --git a/source/stylesheets/screen-old-ie.css.scss b/source/stylesheets/screen-old-ie.css.scss new file mode 100644 index 0000000..da90cca --- /dev/null +++ b/source/stylesheets/screen-old-ie.css.scss @@ -0,0 +1,4 @@ +$is-ie: true; +$ie-version: 8; + +@import "govuk_tech_docs"; diff --git a/source/stylesheets/screen.css.scss b/source/stylesheets/screen.css.scss new file mode 100644 index 0000000..f045633 --- /dev/null +++ b/source/stylesheets/screen.css.scss @@ -0,0 +1 @@ +@import "govuk_tech_docs";