Skip to content

Commit f2791b9

Browse files
authored
Add actions for deployment to persistent volume claim (#26)
1 parent f4e126f commit f2791b9

File tree

18 files changed

+810
-8
lines changed

18 files changed

+810
-8
lines changed

README.md

Lines changed: 355 additions & 8 deletions
Large diffs are not rendered by default.

create_package/create_package.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# limitations under the License.
1616

1717
set -Eeuo pipefail
18+
1819
next_version=$(git describe --tags --abbrev=0 | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.)
1920
version=${next_version}a${PULL_REQUEST_NUMBER}.dev${COMMENTS_COUNT}
2021
sed -i "s/version = \"0.0.0\"/version = \"$version\"/" pyproject.toml
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Deploy schemas
2+
description: Deploy schemas
3+
4+
branding:
5+
icon: 'battery-charging'
6+
color: 'green'
7+
8+
inputs:
9+
output_directory:
10+
description: Output directory
11+
required: true
12+
13+
project_version:
14+
description: Version of project to deploy
15+
required: true
16+
17+
project_name:
18+
description: Name of project to deploy
19+
required: true
20+
21+
destination:
22+
required: true
23+
description: Destination directory or SAS token
24+
25+
runs:
26+
using: "composite"
27+
steps:
28+
- name: Prepare python deployment
29+
shell: bash
30+
run: $GITHUB_ACTION_PATH/deploy_data_schemas_to_azfs.sh
31+
env:
32+
DEPLOYMENT_ROOT: ${{ inputs.deployment_root }}
33+
PROJECT_VERSION: ${{ inputs.project_version }}
34+
PROJECT_NAME: ${{ inputs.project_name }}
35+
DESTINATION: ${{ inputs.destination }}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2022 Ecco Sneaks & Data
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -Eeuo pipefail
18+
19+
SOURCE_DIRECTORY="./$DEPLOYMENT_ROOT/$PROJECT_NAME-schemas/$PROJECT_VERSION/"
20+
mkdir -p "$SOURCE_DIRECTORY"
21+
mv -v ./schemas/* "$SOURCE_DIRECTORY"
22+
23+
./azcopy copy "./$SOURCE_DIRECTORY/*" "$DESTINATION" --recursive --overwrite true --put-md5
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Deploy DBT
2+
description: Deploy source code of DBT queries
3+
4+
branding:
5+
icon: 'battery-charging'
6+
color: 'green'
7+
8+
inputs:
9+
output_directory:
10+
description: Output directory
11+
required: true
12+
13+
project_version:
14+
description: Version of project to deploy
15+
required: true
16+
17+
project_name:
18+
description: Name of project to deploy
19+
required: true
20+
21+
destination:
22+
required: true
23+
description: Destination directory or SAS token
24+
25+
runs:
26+
using: "composite"
27+
steps:
28+
- name: Prepare python deployment
29+
shell: bash
30+
run: $GITHUB_ACTION_PATH/deploy_dbt_project_to_azfs.sh
31+
env:
32+
DEPLOYMENT_ROOT: ${{ inputs.deployment_root }}
33+
PROJECT_VERSION: ${{ inputs.project_version }}
34+
PROJECT_NAME: ${{ inputs.project_name }}
35+
DESTINATION: ${{ inputs.destination }}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2022 Ecco Sneaks & Data
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -Eeuo pipefail
18+
19+
SOURCE_DIRECTORY="./$DEPLOYMENT_ROOT/$PROJECT_NAME/$PROJECT_VERSION/"
20+
mkdir -p SOURCE_DIRECTORY
21+
mv -v ./target/run/* "$SOURCE_DIRECTORY"
22+
23+
./azcopy copy "./$SOURCE_DIRECTORY/*" "$DESTINATION" --recursive --overwrite true --put-md5
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Deploy python code
2+
description: Deploy source code of python application
3+
4+
branding:
5+
icon: 'battery-charging'
6+
color: 'green'
7+
8+
inputs:
9+
output_directory:
10+
description: Output directory
11+
required: true
12+
13+
project_version:
14+
description: Version of project to deploy
15+
required: true
16+
17+
project_name:
18+
description: Name of project to deploy
19+
required: true
20+
21+
destination:
22+
required: true
23+
description: Destination directory or SAS token
24+
25+
project_directory:
26+
description: Name of directory within the project to deploy
27+
required: false
28+
29+
python_version:
30+
description: Python version
31+
required: false
32+
default: "3.9"
33+
34+
runs:
35+
using: "composite"
36+
steps:
37+
- name: Prepare python deployment
38+
shell: bash
39+
run: $GITHUB_ACTION_PATH/deploy_poetry_project_to_azfs.sh
40+
env:
41+
OUTPUT_DIRECTORY: ${{ inputs.output_directory }}
42+
PROJECT_VERSION: ${{ inputs.project_version }}
43+
PROJECT_NAME: ${{ inputs.project_name }}
44+
PROJECT_DIRECTORY : ${{ inputs.project_directory }}
45+
PYTHON_VERSION: ${{ inputs.python_version }}
46+
DESTINATION: ${{ inputs.destination }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2022 Ecco Sneaks & Data
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -Eeuo pipefail
18+
19+
echo "Preparing to deploy $PROJECT_NAME $PROJECT_VERSION"
20+
set -Eeuo pipefail
21+
env_path=$(poetry env info | grep Path | head -n 1 | cut -d':' -f2 | xargs)
22+
23+
if [ -z "$PROJECT_DIRECTORY" ]; then
24+
PROJECT_DIRECTORY="$PROJECT_NAME"
25+
fi;
26+
27+
SOURCE_DIRECTORY="./$DEPLOYMENT_ROOT/$PROJECT_NAME/$PROJECT_VERSION/"
28+
mkdir -p "$SOURCE_DIRECTORY"
29+
mv -v "$env_path"/lib/python"$PYTHON_VERSION"/site-packages/* "$SOURCE_DIRECTORY"
30+
mv -v ./"$PROJECT_DIRECTORY"/* "$SOURCE_DIRECTORY"
31+
32+
./azcopy copy "./$SOURCE_DIRECTORY/*" "$DESTINATION" --recursive --overwrite true --put-md5

generate_version/action.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Generate version
2+
description: Returns current version of the project
3+
4+
branding:
5+
icon: 'battery-charging'
6+
color: 'green'
7+
8+
outputs:
9+
version:
10+
description: "Version of current project based on git tags"
11+
value: ${{ steps.version.outputs.version }}
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- name: Create development package
17+
shell: bash
18+
run: $GITHUB_ACTION_PATH/generate_version.sh
19+
id: version
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2022 Ecco Sneaks & Data
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -Eeuo pipefail
18+
19+
version=$(git describe --tags --abbrev=7)
20+
21+
echo "version=$version" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)