mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-09 12:43:28 +02:00
Update clone-staging.yaml
This commit is contained in:
parent
96220b5baa
commit
fee97c1d6b
1 changed files with 26 additions and 40 deletions
56
.github/workflows/clone-staging.yaml
vendored
56
.github/workflows/clone-staging.yaml
vendored
|
@ -18,44 +18,30 @@ jobs:
|
|||
clone-database:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CF_USERNAME: CF_MS_USERNAME
|
||||
CF_PASSWORD: CF_MS_PASSWORD
|
||||
CF_USERNAME: ${{ secrets.CF_MS_USERNAME }}
|
||||
CF_PASSWORD: ${{ secrets.CF_MS_PASSWORD }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Clone Database
|
||||
run: |
|
||||
# install cf cli and other tools
|
||||
wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo gpg --dearmor -o /usr/share/keyrings/cli.cloudfoundry.org.gpg
|
||||
echo "deb [signed-by=/usr/share/keyrings/cli.cloudfoundry.org.gpg] https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.13'
|
||||
cache: 'pip' # caching pip dependencies
|
||||
sudo apt-get update
|
||||
sudo apt-get install cf8-cli postgresql-client
|
||||
# install cg-manage-rds tool
|
||||
pip install git+https://github.com/cloud-gov/cg-manage-rds.git
|
||||
|
||||
- name: Install CG Tool
|
||||
run: pip install git+https://github.com/cloud-gov/cg-manage-rds.git
|
||||
# Authenticate and target CF org and space.
|
||||
cf api api.fr.cloud.gov
|
||||
cf auth "$CF_USERNAME" "$CF_PASSWORD"
|
||||
cf target -o cisa-dotgov -s $DESTINATION_ENVIRONMENT
|
||||
|
||||
- name: Share DB Service
|
||||
uses: cloud-gov/cg-cli-tools@main
|
||||
with:
|
||||
cf_username: ${{ secrets[env.CF_USERNAME] }}
|
||||
cf_password: ${{ secrets[env.CF_PASSWORD] }}
|
||||
cf_org: cisa-dotgov
|
||||
cf_space: ${{ env.DESTINATION_ENVIRONMENT }}
|
||||
cf_command: share-service getgov-${{ env.DESTINATION_ENVIRONMENT }}-database -s ${{ env.SOURCE_ENVIRONMENT }}
|
||||
# share the target db with the source space
|
||||
cf share-service getgov-$DESTINATION_ENVIRONMENT-database -s $SOURCE_ENVIRONMENT
|
||||
|
||||
- name: Clone Database
|
||||
uses: cloud-gov/cg-cli-tools@main
|
||||
with:
|
||||
cf_username: ${{ secrets.CF_MS_USERNAME }}
|
||||
cf_password: ${{ secrets.CF_MS_PASSWORD }}
|
||||
cf_org: cisa-dotgov
|
||||
cf_space: ${{ env.SOURCE_ENVIRONMENT }}
|
||||
command: cg-manage-rds clone getgov-${{ env.SOURCE_ENVIRONMENT }}-database getgov-${{ env.DESTINATION_ENVIRONMENT }}-database
|
||||
# clone from source to destination
|
||||
cg-manage-rds clone getgov-$DESTINATION_ENVIRONMENT-database getgov-$SOURCE_ENVIRONMENT-database
|
||||
|
||||
- name: Unshare DB Service
|
||||
uses: cloud-gov/cg-cli-tools@main
|
||||
with:
|
||||
cf_username: ${{ secrets.CF_MS_USERNAME }}
|
||||
cf_password: ${{ secrets.CF_MS_PASSWORD }}
|
||||
cf_org: cisa-dotgov
|
||||
cf_space: ${{ env.SOURCE_ENVIRONMENT }}
|
||||
cf_command: unshare-service getgov-${{ env.DESTINATION_ENVIRONMENT }}-database -s ${{ env.SOURCE_ENVIRONMENT }}
|
||||
# unshare the service
|
||||
cf unshare-service getgov-$DESTINATION_ENVIRONMENT-database -s $SOURCE_ENVIRONMENT
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue