Skip to content

Commit da2b7a2

Browse files
trying feature publish.
1 parent a905329 commit da2b7a2

File tree

8 files changed

+1026
-0
lines changed

8 files changed

+1026
-0
lines changed

.github/workflows/cicd.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,23 @@ env:
3131

3232
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
3333
jobs:
34+
deploy-nhs-notify-feature:
35+
if: ${{ github.ref == 'refs/heads/main' }}
36+
runs-on: ubuntu-latest
37+
permissions:
38+
packages: write
39+
contents: write
40+
pull-requests: write
41+
steps:
42+
- uses: actions/checkout@v3
43+
44+
- name: "Publish Features"
45+
uses: devcontainers/action@v1
46+
with:
47+
publish-features: "true"
48+
base-path-to-features: "./src/features"
49+
generate-docs: "false"
50+
3451
build-and-push-image:
3552
runs-on: ubuntu-latest
3653
strategy:
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
{
2+
"dependsOn": {
3+
"ghcr.io/devcontainers/features/python:1.7.1": {
4+
"version": "3.13.8",
5+
"installTools": true
6+
},
7+
"ghcr.io/devcontainers/features/aws-cli:1.1.2": {
8+
"version": "2.31.18"
9+
},
10+
"ghcr.io/devcontainers/features/common-utils:2.5.4": {
11+
"configureZshAsDefaultShell": true,
12+
"installOhMyZsh": true,
13+
"installOhMyZshConfig": true,
14+
"installZsh": true,
15+
"upgradePackages": true,
16+
"userGid": "automatic",
17+
"userUid": "automatic",
18+
"username": "automatic"
19+
},
20+
"ghcr.io/devcontainers/features/docker-in-docker:2.12.4": {
21+
"azureDnsAutoDetection": true,
22+
"dockerDashComposeVersion": "2.40.1",
23+
"installDockerBuildx": true,
24+
"installDockerComposeSwitch": true,
25+
"moby": true,
26+
"version": "28.5.1"
27+
},
28+
"ghcr.io/devcontainers/features/github-cli:1.0.15": {
29+
"installDirectlyFromGitHubRelease": true,
30+
"version": "2.82.0"
31+
},
32+
"ghcr.io/devcontainers/features/node:1.6.3": {
33+
"nodeGypDependencies": true,
34+
"nvmVersion": "0.40.3",
35+
"version": "22.21.0"
36+
},
37+
"ghcr.io/devcontainers/features/ruby:1.3.2": {
38+
"version": "3.4.7"
39+
},
40+
"ghcr.io/devcontainers/features/go:1.3.2": {
41+
"version": "1.25.3"
42+
}
43+
},
44+
"id": "nhsnotify",
45+
"name": "NHS Notify",
46+
"postCreateCommand": "zsh /usr/local/share/nhsnotify/scripts/postcreatecommand.sh",
47+
"postStartCommand": "zsh /usr/local/share/nhsnotify/scripts/poststartcommand.sh",
48+
"version": "1.0.1",
49+
"customizations": {
50+
"vscode": {
51+
"extensions": [
52+
"alefragnani.bookmarks",
53+
"AmazonWebServices.aws-toolkit-vscode",
54+
"chdsbd.github-code-owners",
55+
"davidanson.vscode-markdownlint",
56+
"dbaeumer.vscode-eslint",
57+
"donjayamanne.githistory",
58+
"editorconfig.editorconfig",
59+
"esbenp.prettier-vscode",
60+
"fvclaus.sort-json-array",
61+
"github.codespaces",
62+
"github.github-vscode-theme",
63+
"github.remotehub",
64+
"github.vscode-github-actions",
65+
"github.vscode-pull-request-github",
66+
"hediet.vscode-drawio",
67+
"johnpapa.vscode-peacock",
68+
"joshx.workspace-terminals",
69+
"maattdd.gitless",
70+
"mhutchie.git-graph",
71+
"ms-azuretools.vscode-docker",
72+
"ms-vscode-remote.remote-containers",
73+
"ms-vscode-remote.remote-wsl",
74+
"ms-vscode.hexeditor",
75+
"ms-vscode.live-server",
76+
"ms-vsliveshare.vsliveshare",
77+
"redhat.vscode-xml",
78+
"streetsidesoftware.code-spell-checker-british-english",
79+
"takumii.markdowntable",
80+
"tamasfe.even-better-toml",
81+
"tomoki1207.pdf",
82+
"vscode-icons-team.vscode-icons",
83+
"vstirbu.vscode-mermaid-preview",
84+
"wayou.vscode-todo-highlight",
85+
"yzane.markdown-pdf",
86+
"yzhang.dictionary-completion",
87+
"yzhang.markdown-all-in-one",
88+
"zoma.vscode-auto-open-workspace"
89+
],
90+
"settings": {
91+
"[makefile]": {
92+
"editor.detectIndentation": false,
93+
"editor.insertSpaces": false
94+
},
95+
"autoOpenWorkspace.enableAutoOpenIfSingleWorkspace": true,
96+
"editor.formatOnSave": true,
97+
"extensions.ignoreRecommendations": true,
98+
"files.insertFinalNewline": true
99+
}
100+
}
101+
},
102+
"options": {
103+
"updateFromTemplate": {
104+
"type": "boolean",
105+
"description": "Update from template",
106+
"default": true
107+
},
108+
"showWelcome": {
109+
"type": "boolean",
110+
"description": "Show welcome message",
111+
"default": true
112+
}
113+
},
114+
"mounts": [
115+
{
116+
"source": "/usr/local/share/ca-certificates",
117+
"target": "/home/ca-certificates",
118+
"type": "bind"
119+
},
120+
{
121+
"source": "${localEnv:HOME}/.aws",
122+
"target": "/home/vscode/.aws",
123+
"type": "bind"
124+
},
125+
{
126+
"source": "${localEnv:HOME}/.gitconfig",
127+
"target": "/home/vscode/.gitconfig",
128+
"type": "bind"
129+
},
130+
{
131+
"source": "${localEnv:HOME}/.gnupg",
132+
"target": "/home/vscode/.gnupg",
133+
"type": "bind"
134+
},
135+
{
136+
"source": "${localEnv:HOME}/.ssh",
137+
"target": "/home/vscode/.ssh",
138+
"type": "bind"
139+
}
140+
]
141+
}

src/features/nhsnotify/install.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
SHARE_DIR="/usr/local/share/nhsnotify"
4+
mkdir -p $SHARE_DIR
5+
cp -r ./scripts $SHARE_DIR
6+
7+
. $SHARE_DIR/scripts/configure-apt.sh
8+
9+
echo "go is at $(which go)"
10+
echo 'install asdf via go'
11+
go install github.com/asdf-vm/asdf/cmd/[email protected]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#! /bin/bash
2+
3+
pwd
4+
ls -la
5+
echo "Installing APT packages from packages.txt"
6+
apt-get update
7+
echo "Packages to be installed:"
8+
cat packages.txt
9+
echo "Starting APT packages installation"
10+
apt-get --install-suggests --install-recommends -y install < packages.txt
11+
echo "APT packages installation complete"
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
build-essential
2+
ca-certificates
3+
curl
4+
fonts-liberation
5+
gdb
6+
inetutils-inetd
7+
lcov
8+
libasound2
9+
libatk-adaptor
10+
libatk-bridge2.0-0
11+
libatk1.0-0
12+
libbz2-dev
13+
libc6
14+
libcairo2
15+
libcups2
16+
libdbus-1-3
17+
libexpat1
18+
libffi-dev
19+
libfontconfig1
20+
libgbm1
21+
libgcc1
22+
libgdbm-compat-dev
23+
libgdbm-dev
24+
libglib2.0-0
25+
libgtk-3-0
26+
liblzma-dev
27+
libmpdec-dev
28+
libncurses5-dev
29+
libncursesw5-dev
30+
libnspr4
31+
libnss3
32+
libpango-1.0-0
33+
libpangocairo-1.0-0
34+
libreadline-dev
35+
libreadline6-dev
36+
libsqlite3-dev
37+
libssl-dev
38+
libstdc++6
39+
libx11-6
40+
libx11-xcb1
41+
libxcb1
42+
libxcomposite1
43+
libxcursor1
44+
libxdamage1
45+
libxext6
46+
libxfixes3
47+
libxi6
48+
libxrandr2
49+
libxrender1
50+
libxss1
51+
libxtst6
52+
libzstd-dev
53+
llvm
54+
lsb-release
55+
lzma
56+
lzma-dev
57+
openbox
58+
pkg-config
59+
tk-dev
60+
uuid-dev
61+
wget
62+
xdg-utils
63+
xorg
64+
xz-utils
65+
zlib1g-dev
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
#!/bin/bash
2+
CURRENT_DIR=$(pwd)
3+
update_from_template="${UPDATEFROMTEMPLATE:-true}"
4+
5+
REPO=https://github.com/NHSDigital/nhs-notify-repository-template.git
6+
DEST=$HOME/nhsengland/repository-template
7+
CURRENT_TIMESTAMP=$(date +%Y%m%d%H%M%S)
8+
CHECKOUT_BRANCH="devcontainer-base"
9+
UPDATE_BRANCH="updating-the-default-files-$CURRENT_TIMESTAMP"
10+
11+
get_repo_template(){
12+
echo "copying defaults"
13+
echo "getting nhse repo template"
14+
echo "Cloning $REPO into $DEST"
15+
mkdir -p $DEST
16+
echo "created destination directory $DEST"
17+
echo "Cloning repository from $REPO to $DEST"
18+
git clone -b $CHECKOUT_BRANCH $REPO $DEST
19+
echo "cloned repository $REPO branch $CHECKOUT_BRANCH to $DEST"
20+
21+
CURRENT_BRANCH=$(git symbolic-ref --short HEAD)
22+
echo "current branch is $CURRENT_BRANCH"
23+
git switch -C $UPDATE_BRANCH
24+
}
25+
26+
copy_folder_if_not_exists(){
27+
local FOLDER=$1
28+
echo "checking for folder $FOLDER"
29+
mkdir -p $DEST/$FOLDER && \
30+
\cp -r --update=none $DEST/$FOLDER ./ && \
31+
echo "Copied $FOLDER" \
32+
|| echo "Not copying $FOLDER, already exist"
33+
}
34+
35+
copy_folder_overwrite(){
36+
local FOLDER=$1
37+
echo "copying folder $FOLDER"
38+
\cp -rf $DEST/$FOLDER ./
39+
echo "Copied $FOLDER"
40+
}
41+
42+
copy_file_overwrite(){
43+
local FILE=$1
44+
echo "copying file $FILE"
45+
\cp -f $DEST/$FILE ./
46+
echo "Copied $FILE"
47+
}
48+
49+
copy_file_dont_overwrite(){
50+
local FILE=$1
51+
echo "checking for file $FILE"
52+
\cp --update=none $DEST/$FILE ./
53+
echo "Copied $FILE if it did not exist"
54+
}
55+
56+
update_from_template(){
57+
copy_folder_if_not_exists ".github"
58+
copy_folder_if_not_exists "docs"
59+
copy_folder_if_not_exists "infrastructure"
60+
copy_folder_if_not_exists ".vscode"
61+
62+
copy_folder_overwrite "scripts"
63+
64+
copy_file_overwrite "Makefile"
65+
copy_file_overwrite ".tool-versions"
66+
copy_file_overwrite ".editorconfig"
67+
copy_file_overwrite ".gitattributes"
68+
copy_file_overwrite ".gitignore"
69+
copy_file_overwrite ".gitleaksignore"
70+
71+
copy_file_dont_overwrite "VERSION"
72+
copy_file_dont_overwrite "README.md"
73+
copy_file_dont_overwrite "LICENCE.md"
74+
75+
echo "$REPO template update complete"
76+
}
77+
78+
update_from_template_if_enabled(){
79+
if [ "${update_from_template}" == "true" ]; then
80+
echo "Updating from template as per configuration"
81+
get_repo_template
82+
update_from_template
83+
else
84+
echo "Skipping update from template as per configuration"
85+
fi
86+
}
87+
88+
reload_shell(){
89+
echo "reload shell"
90+
source ~/.zshrc
91+
echo "reloaded shell"
92+
}
93+
94+
add_asdf_to_path(){
95+
echo "adding asdf to path"
96+
export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH"
97+
echo "added asdf to path"
98+
}
99+
100+
sort_certs(){
101+
sudo cp -r --update=none /home/ca-certificates/. /usr/local/share/ca-certificates
102+
sudo update-ca-certificates
103+
echo "sorted certs"
104+
}
105+
106+
configure_ohmyzsh(){
107+
echo "configuring ohmyzsh"
108+
echo 'export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH"' >> ~/.zshrc
109+
sed -i "/plugins=/c\plugins=(git ssh-agent sudo terraform dirhistory)" ~/.zshrc
110+
cat ~/.zshrc
111+
echo "configured ohmyzsh"
112+
}
113+
114+
add_gpg_tty_to_zshrc(){
115+
echo "adding gpg tty to zshrc"
116+
echo 'export GPG_TTY=$(tty)' >> ~/.zshrc
117+
echo "added gpg tty to zshrc"
118+
}
119+
120+
update_from_template_if_enabled
121+
reload_shell
122+
add_asdf_to_path
123+
sort_certs
124+
configure_ohmyzsh
125+
add_gpg_tty_to_zshrc
126+
cd $CURRENT_DIR
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
echo "running make config"
4+
export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH"
5+
make config
6+
echo "make config complete"
7+
8+
/usr/local/share/nhsnotify/scripts/welcome.sh

0 commit comments

Comments
 (0)