Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 46 additions & 46 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,49 @@ name: Publish / Calculate Version
on: push

jobs:
build:
name: calculate version
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0 # This causes all history to be fetched, which is required for calculate-version to function

- name: Install Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8

- name: Install poetry
run: pip install poetry

- name: Cache poetry packages
uses: actions/cache@v4
id: cache
with:
path: ~/.venv
key: ${{ runner.os }}-utils-venv-${{ hashFiles('**/poetry.lock') }}

- name: Install
run: poetry install
if: steps.cache.outputs.cache-hit != 'true'

- name: Set SPEC_VERSION env var
run: |
version="$(poetry run python scripts/calculate_version.py)"
echo "${version}"
echo ::set-env name=SPEC_VERSION::${version}
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true

- name: Create release (master only)
id: create-release
if: github.ref == 'refs/heads/master'
uses: actions/create-release@v1
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.SPEC_VERSION }}
release_name: ${{ env.SPEC_VERSION }}
build:
name: calculate version
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0 # This causes all history to be fetched, which is required for calculate-version to function

- name: Install Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9

- name: Install poetry
run: pip install poetry

- name: Cache poetry packages
uses: actions/cache@v4
id: cache
with:
path: ~/.venv
key: ${{ runner.os }}-utils-venv-${{ hashFiles('**/poetry.lock') }}

- name: Install
run: poetry install
if: steps.cache.outputs.cache-hit != 'true'

- name: Set SPEC_VERSION env var
run: |
version="$(poetry run python scripts/calculate_version.py)"
echo "${version}"
echo ::set-env name=SPEC_VERSION::${version}
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true

- name: Create release (master only)
id: create-release
if: github.ref == 'refs/heads/master'
uses: actions/create-release@v1
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.SPEC_VERSION }}
release_name: ${{ env.SPEC_VERSION }}
4 changes: 2 additions & 2 deletions ansible/collections/ansible_collections/nhsd/apigee/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ update-schema:
@PYTHONPATH=../../../ poetry run python scripts/update_schema.py

unit-test:
@poetry run ansible-test units --python=3.8
@poetry run ansible-test units --python=3.9

integration-test:
@poetry run ansible-test integration --python=3.8
@poetry run ansible-test integration --python=3.9

test: unit-test integration-test

Expand Down
6 changes: 3 additions & 3 deletions azure/build-prereqs.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
parameters:
- name: 'utils_dir'
- name: "utils_dir"
type: string
default: 'utils'
default: "utils"

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
versionSpec: "3.9"

- bash: |
tfenv use 0.14.6
Expand Down
145 changes: 72 additions & 73 deletions azure/common/apigee-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ parameters:
default: []
- name: python_version
type: string
default: "3.8"
default: "3.9"
- name: agent_pool
type: string
default: "AWS-ECS"
Expand All @@ -46,7 +46,6 @@ jobs:
${{ each var in parameters.variables }}:
${{ var.key }}: ${{ var.value }}
steps:

- bash: |
if [ ! -z "$(ls -A \"$(Pipeline.Workspace)/s/${{ parameters.service_name }}\" 2>/dev/null)" ]; then
echo "workspace directory is not empty!"
Expand All @@ -67,63 +66,63 @@ jobs:
- template: ../components/aws-clean-config.yml

- ${{ if parameters.notify }}:
- template: ../components/aws-assume-role.yml
parameters:
role: "auto-ops"
profile: "apm_ptl"

- template: ../components/get-aws-secrets-and-ssm-params.yml
parameters:
secret_file_ids:
- ${{ each secret_file_id in parameters.secret_file_ids }}:
- ${{ secret_file_id }}
secret_ids:
- ptl/access-tokens/github/repo-status-update/GITHUB_ACCESS_TOKEN
- ${{ each secret_id in parameters.secret_ids }}:
- ${{ secret_id }}
config_ids:
- /ptl/azure-devops/GITHUB_USER
- ${{ each config_id in parameters.config_ids }}:
- ${{ config_id }}

- bash: |
echo "Build.SourceBranch: $(Build.SourceBranch)"
echo "Build.SourceBranchName: $(Build.SourceBranchName)"
echo "Build.SourceVersion: $(Build.SourceVersion)"
echo "Build.SourceVersionMessage: $(Build.SourceVersionMessage)"

if [[ ! -z $(NOTIFY_COMMIT_SHA) ]]; then
echo "##[debug]Using already provided NOTIFY_COMMIT_SHA=$(NOTIFY_COMMIT_SHA)"
else
NOTIFY_COMMIT_SHA=""

if [[ "$(Build.SourceBranch)" =~ ^refs/tags/.+$ ]]; then
echo "##[debug]Build appears to be a tag build"
echo "##[debug]Using Build.SourceVersion as NOTIFY_COMMIT_SHA"
NOTIFY_COMMIT_SHA="$(Build.SourceVersion)"
fi

if [[ "$(Build.SourceBranch)" =~ ^refs/pull/.+$ ]]; then
echo "##[debug]Build appears to be a pull request build"
echo "##[debug]Extracting NOTIFY_COMMIT_SHA from Build.SourceVersionMessage"
NOTIFY_COMMIT_SHA=`echo "$(Build.SourceVersionMessage)" | cut -d' ' -f2`
fi

if [[ -z $NOTIFY_COMMIT_SHA ]]; then
echo "##[debug]Build does not appear to be pull or tag build"
echo "##[debug]Using Build.SourceVersion as NOTIFY_COMMIT_SHA"
NOTIFY_COMMIT_SHA="$(Build.SourceVersion)"
fi

echo "##vso[task.setvariable variable=NOTIFY_COMMIT_SHA]$NOTIFY_COMMIT_SHA"
fi
displayName: Set NOTIFY_COMMIT_SHA
condition: always()

- template: '../components/update-github-status.yml'
parameters:
state: pending
description: "Build started"
- template: ../components/aws-assume-role.yml
parameters:
role: "auto-ops"
profile: "apm_ptl"

- template: ../components/get-aws-secrets-and-ssm-params.yml
parameters:
secret_file_ids:
- ${{ each secret_file_id in parameters.secret_file_ids }}:
- ${{ secret_file_id }}
secret_ids:
- ptl/access-tokens/github/repo-status-update/GITHUB_ACCESS_TOKEN
- ${{ each secret_id in parameters.secret_ids }}:
- ${{ secret_id }}
config_ids:
- /ptl/azure-devops/GITHUB_USER
- ${{ each config_id in parameters.config_ids }}:
- ${{ config_id }}

- bash: |
echo "Build.SourceBranch: $(Build.SourceBranch)"
echo "Build.SourceBranchName: $(Build.SourceBranchName)"
echo "Build.SourceVersion: $(Build.SourceVersion)"
echo "Build.SourceVersionMessage: $(Build.SourceVersionMessage)"

if [[ ! -z $(NOTIFY_COMMIT_SHA) ]]; then
echo "##[debug]Using already provided NOTIFY_COMMIT_SHA=$(NOTIFY_COMMIT_SHA)"
else
NOTIFY_COMMIT_SHA=""

if [[ "$(Build.SourceBranch)" =~ ^refs/tags/.+$ ]]; then
echo "##[debug]Build appears to be a tag build"
echo "##[debug]Using Build.SourceVersion as NOTIFY_COMMIT_SHA"
NOTIFY_COMMIT_SHA="$(Build.SourceVersion)"
fi

if [[ "$(Build.SourceBranch)" =~ ^refs/pull/.+$ ]]; then
echo "##[debug]Build appears to be a pull request build"
echo "##[debug]Extracting NOTIFY_COMMIT_SHA from Build.SourceVersionMessage"
NOTIFY_COMMIT_SHA=`echo "$(Build.SourceVersionMessage)" | cut -d' ' -f2`
fi

if [[ -z $NOTIFY_COMMIT_SHA ]]; then
echo "##[debug]Build does not appear to be pull or tag build"
echo "##[debug]Using Build.SourceVersion as NOTIFY_COMMIT_SHA"
NOTIFY_COMMIT_SHA="$(Build.SourceVersion)"
fi

echo "##vso[task.setvariable variable=NOTIFY_COMMIT_SHA]$NOTIFY_COMMIT_SHA"
fi
displayName: Set NOTIFY_COMMIT_SHA
condition: always()

- template: "../components/update-github-status.yml"
parameters:
state: pending
description: "Build started"

- bash: |
if [[ ! -z $(UTILS_PR_NUMBER) ]]; then
Expand Down Expand Up @@ -193,12 +192,12 @@ jobs:
key: poetry | $(System.DefaultWorkingDirectory) | ${{ parameters.service_name }}/utils/poetry.lock
location: "${{ parameters.service_name }}/utils/.venv"
debug: true
alias: 'Utils'
alias: "Utils"
displayName: cache utils dependencies

- bash: |
make install
sleep 5
make install
sleep 5
workingDirectory: "${{ parameters.service_name }}/utils"
condition: ne(variables['CacheRestored-Utils'], 'true')
displayName: "Install utils "
Expand Down Expand Up @@ -277,14 +276,14 @@ jobs:
artifact: "$(Build.BuildNumber)"

- ${{ if parameters.notify }}:
- template: '../components/update-github-status.yml'
parameters:
state: success
on_success: true
description: "Build succeeded"

- template: '../components/update-github-status.yml'
parameters:
state: failure
on_failure: true
description: "Build failed"
- template: "../components/update-github-status.yml"
parameters:
state: success
on_success: true
description: "Build succeeded"

- template: "../components/update-github-status.yml"
parameters:
state: failure
on_failure: true
description: "Build failed"
Loading
Loading