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