Skip to content

Commit

Permalink
Gha fork - test (cloudfoundry#2382)
Browse files Browse the repository at this point in the history
Initial comment to check workflow run from PRs.

The workflow file needs to be in repo, before the integration tests workflow can kick off
  • Loading branch information
gururajsh authored Mar 28, 2023
1 parent e9720d8 commit 96231f9
Show file tree
Hide file tree
Showing 4 changed files with 518 additions and 327 deletions.
154 changes: 154 additions & 0 deletions .github/workflows/build-cf-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: Build Binaries

on:
workflow_dispatch:
pull_request:
branches:
- main
- v8
- v7
paths-ignore:
- 'doc/**'
- '.gitpod.yml'
- 'README.md'
push:
# branches:
# - main
# - v8
# - v7
# paths-ignore:
# - 'doc/**'
# - '.github/**'
# - '.gitpod.yml'
# - 'README.md'

# permissions:
# contents: read

jobs:
shared-values:
name: Shared Values
runs-on: ubuntu-latest
outputs:
go-version: ${{ steps.set-go-version.outputs.go-version }}
cf-build-sha: ${{ steps.set-build-sha.outputs.cf-build-sha }}

steps:
- name: Checkout
uses: actions/checkout@v3

- id: set-go-version
name: Parse Golang Version
run: |
go_version=($(grep -E '^go 1\.[[:digit:]]{1,2}' go.mod))
echo "golang version: ${go_version[1]}"
echo "go-version=${go_version[1]}" >> $GITHUB_OUTPUT
- id: set-build-sha
name: Get Build SHA
run: |
build_sha=$(git rev-parse --short HEAD)
echo "cf-build-sha=${build_sha}" >> $GITHUB_OUTPUT
# echo $build-sha > ./sha

# - name: 'Export SHA'
# uses: actions/upload-artifact@v3
# with:
# name: sha
# path: ./sha

build-linux-binaries:
name: Build Linux binaries
runs-on: ubuntu-latest
needs:
- shared-values
outputs:
linux-binaries: ${{ steps.build-linux-binaries.outputs.linux-binaries }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ needs.shared-values.outputs.go-version }}

- name: Build Linux
id: build-linux
run: |
set -ex
export GOPATH=$PWD/gopath
export PATH=$GOPATH/bin:$PATH
go version
export CF_BUILD_SHA=${{ needs.shared-values.outputs.cf-build-sha }}
# echo "Building 32-bit Linux"
# make out/cf-cli_linux_i686
echo "Building 64-bit Linux"
make out/cf-cli_linux_x86-64
echo "Creating tarball"
tar -cvzf ${PWD}/cf-cli-linux-binaries-${CF_BUILD_SHA}.tgz -C out .
linux_binaries="cf-cli-linux-binaries-${CF_BUILD_SHA}.tgz"
echo "linux-binaries=${linux_binaries}" >> $GITHUB_OUTPUT
- name: 'Upload Linux Binaries'
uses: actions/upload-artifact@v3
with:
name: ${{ steps.build-linux.outputs.linux-binaries }}
path: ./cf-cli-linux-binaries-*

# build-windows-binaries:
# name: Build Windows binaries
# runs-on: windows-latest
# needs:
# - shared-values
# outputs:
# windows-binaries: ${{ steps.build-windows-binaries.outputs.windows-binaries }}
# steps:
# - name: Checkout
# uses: actions/checkout@v3

# - name: Set up Go
# uses: actions/setup-go@v3
# with:
# go-version: ${{ needs.shared-values.outputs.go-version }}

# - name: Get build-time dependencies
# run: |
# choco install --no-progress --limit-output -y make
# go install github.com/akavel/rsrc@v0.10.2

# - name: Build Windows
# id: build-windows
# run: |
# Get-Command make
# Get-Item Makefile

# $CF_BUILD_SHA="${{ needs.shared-values.outputs.cf-build-sha }}"

# # echo "Building 32-bit Windows"
# # make out/cf-cli_win32.exe

# echo "Building 64-bit Windows"
# make out/cf-cli_winx64.exe

# echo "Creating tarball"
# tar -cvzf cf-cli-windows-binaries-${CF_BUILD_SHA}.tgz -C out .
# $windows_binaries="cf-cli-windows-binaries-${CF_BUILD_SHA}.tgz"
# echo "windows-binaries ================ ${windows_binaries}"
# echo "windows-binaries=${windows_binaries}" >> $GITHUB_OUTPUT

# - name: 'Upload Windows Binaries'
# uses: actions/upload-artifact@v3
# with:
# name: ${{ steps.build-windows.outputs.windows-binaries }}
# path: cf-cli-windows-binaries-*

# - name: Setup tmate session
# if: always()
# uses: mxschmitt/action-tmate@v3
220 changes: 110 additions & 110 deletions .github/workflows/cf-env-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,113 +61,113 @@ jobs:
name: ${{ steps.claim-toolsmiths-env.outputs.environment-name }}
path: metadata.json

- name: Checkout cli-ci
uses: actions/checkout@v3
with:
repository: cloudfoundry/cli-ci
path: cli-ci

- name: Checkout cf-deployment Min CAPI
if: ${{ inputs.capi-version != 'edge' }}
uses: actions/checkout@v3
with:
repository: cloudfoundry/cf-deployment
path: cf-deployment
ref: ${{ inputs.capi-version }}

- name: Checkout cf-deployment
uses: actions/checkout@v3
if: ${{ inputs.capi-version == 'edge' }}
with:
repository: cloudfoundry/cf-deployment
path: cf-deployment

- name: Checkout CF deployment tasks
uses: actions/checkout@v3
with:
repository: cloudfoundry/cf-deployment-concourse-tasks
path: cf-deployment-concourse-tasks

- name: Install Tools
run: |
wget https://github.com/cloudfoundry/bosh-bootloader/releases/download/v8.4.110/bbl-v8.4.110_linux_x86-64 -P /tmp
mv /tmp/bbl-* /usr/local/bin/bbl
chmod +x /usr/local/bin/bbl
bbl --version
wget https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-7.0.1-linux-amd64 --output-document="/usr/local/bin/bosh"
chmod +x /usr/local/bin/bosh
bosh --version
- name: Deploy edge CAPI with Isolation Segment and OIDC Provider
if: ${{ inputs.capi-version == 'edge' }}
env:
CF_INT_CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
run: |
# find latest capi
FILENAME="$(aws s3 ls capi-releases --no-sign-request --recursive --region us-east-1 | sort | tail -n 1 | awk '{print $4}')"
aws s3 cp s3://capi-releases/$FILENAME $FILENAME --no-sign-request --region us-east-1
eval "$(bbl print-env --metadata-file metadata.json)"
bosh upload-release --sha2 "$FILENAME"
rm $FILENAME
# deploy
bosh -d cf manifest > /tmp/manifest.yml
bosh interpolate /tmp/manifest.yml \
-o cf-deployment/operations/test/add-persistent-isolation-segment-diego-cell.yml \
-o cli-ci/ci/infrastructure/operations/add-oidc-provider.yml \
-o cli-ci/ci/infrastructure/operations/add-uaa-client-credentials.yml \
-o cli-ci/ci/infrastructure/operations/use-latest-capi.yml \
-v client-secret="${CF_INT_CLIENT_SECRET}" \
> ./director.yml
bosh -d cf deploy director.yml -n
echo "Deployed CAPI version:"
bosh -d cf releases | grep capi
- name: Deploy MIN CAPI with Isolation Segment and OIDC Provider
if: ${{ inputs.capi-version != 'edge' }}
run: |
# Creates vars files
mkdir vars-files
echo "cs = ${{ secrets.CLIENT_SECRET }}"
cat << EOF > vars-files/vars.yml
client-secret: ${{ secrets.CLIENT_SECRET }}
EOF
# Copy Ops files
mkdir ops-files
cp cf-deployment/operations/test/add-persistent-isolation-segment-diego-cell.yml ops-files/
cp cli-ci/ci/infrastructure/operations/add-oidc-provider.yml ops-files/
cp cli-ci/ci/infrastructure/operations/add-uaa-client-credentials.yml ops-files/
# Deletes CF-D
eval "$(bbl print-env --metadata-file metadata.json)"
bosh -d cf delete-deployment -n
# Deploy CF-D
mkdir toolsmiths-env
cp metadata.json toolsmiths-env/metadata
cat metadata.json | jq -r .name > toolsmiths-env/name
export VARS_FILES="vars.yml"
export MANIFEST_FILE="cf-deployment.yml"
export SYSTEM_DOMAIN=""
export REGENERATE_CREDENTIALS=false
export DEPLOY_WITH_UPTIME_MEASUREMENTS=false
export MEASURE_SYSLOG_AVAILABILITY=false
export TCP_DOMAIN=""
export AVAILABLE_PORT=""
export FAIL_ON_DOWNTIME=false
export APP_PUSHABILITY_THRESHOLD=0
export HTTP_AVAILABILITY_THRESHOLD=0
export RECENT_LOGS_THRESHOLD=0
export STREAMING_LOGS_THRESHOLD=0
export APP_SYSLOG_AVAILABILITY_THRESHOLD=0
export USE_SINGLE_APP_INSTANCE=false
export BOSH_DEPLOY_ARGS=""
export BOSH_LITE=false
export BBL_JSON_CONFIG=""
export OPS_FILES="add-persistent-isolation-segment-diego-cell.yml \
add-uaa-client-credentials.yml \
add-oidc-provider.yml"
./cf-deployment-concourse-tasks/bosh-deploy/task
# - name: Checkout cli-ci
# uses: actions/checkout@v3
# with:
# repository: cloudfoundry/cli-ci
# path: cli-ci

# - name: Checkout cf-deployment Min CAPI
# if: ${{ inputs.capi-version != 'edge' }}
# uses: actions/checkout@v3
# with:
# repository: cloudfoundry/cf-deployment
# path: cf-deployment
# ref: ${{ inputs.capi-version }}

# - name: Checkout cf-deployment
# uses: actions/checkout@v3
# if: ${{ inputs.capi-version == 'edge' }}
# with:
# repository: cloudfoundry/cf-deployment
# path: cf-deployment

# - name: Checkout CF deployment tasks
# uses: actions/checkout@v3
# with:
# repository: cloudfoundry/cf-deployment-concourse-tasks
# path: cf-deployment-concourse-tasks

# - name: Install Tools
# run: |
# wget https://github.com/cloudfoundry/bosh-bootloader/releases/download/v8.4.110/bbl-v8.4.110_linux_x86-64 -P /tmp
# mv /tmp/bbl-* /usr/local/bin/bbl
# chmod +x /usr/local/bin/bbl
# bbl --version

# wget https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-7.0.1-linux-amd64 --output-document="/usr/local/bin/bosh"
# chmod +x /usr/local/bin/bosh
# bosh --version

# - name: Deploy edge CAPI with Isolation Segment and OIDC Provider
# if: ${{ inputs.capi-version == 'edge' }}
# env:
# CF_INT_CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
# run: |
# # find latest capi
# FILENAME="$(aws s3 ls capi-releases --no-sign-request --recursive --region us-east-1 | sort | tail -n 1 | awk '{print $4}')"
# aws s3 cp s3://capi-releases/$FILENAME $FILENAME --no-sign-request --region us-east-1
# eval "$(bbl print-env --metadata-file metadata.json)"
# bosh upload-release --sha2 "$FILENAME"
# rm $FILENAME

# # deploy
# bosh -d cf manifest > /tmp/manifest.yml
# bosh interpolate /tmp/manifest.yml \
# -o cf-deployment/operations/test/add-persistent-isolation-segment-diego-cell.yml \
# -o cli-ci/ci/infrastructure/operations/add-oidc-provider.yml \
# -o cli-ci/ci/infrastructure/operations/add-uaa-client-credentials.yml \
# -o cli-ci/ci/infrastructure/operations/use-latest-capi.yml \
# -v client-secret="${CF_INT_CLIENT_SECRET}" \
# > ./director.yml

# bosh -d cf deploy director.yml -n
# echo "Deployed CAPI version:"
# bosh -d cf releases | grep capi

# - name: Deploy MIN CAPI with Isolation Segment and OIDC Provider
# if: ${{ inputs.capi-version != 'edge' }}
# run: |
# # Creates vars files
# mkdir vars-files
# echo "cs = ${{ secrets.CLIENT_SECRET }}"
# cat << EOF > vars-files/vars.yml
# client-secret: ${{ secrets.CLIENT_SECRET }}
# EOF

# # Copy Ops files
# mkdir ops-files
# cp cf-deployment/operations/test/add-persistent-isolation-segment-diego-cell.yml ops-files/
# cp cli-ci/ci/infrastructure/operations/add-oidc-provider.yml ops-files/
# cp cli-ci/ci/infrastructure/operations/add-uaa-client-credentials.yml ops-files/

# # Deletes CF-D
# eval "$(bbl print-env --metadata-file metadata.json)"
# bosh -d cf delete-deployment -n

# # Deploy CF-D
# mkdir toolsmiths-env
# cp metadata.json toolsmiths-env/metadata
# cat metadata.json | jq -r .name > toolsmiths-env/name
# export VARS_FILES="vars.yml"
# export MANIFEST_FILE="cf-deployment.yml"
# export SYSTEM_DOMAIN=""
# export REGENERATE_CREDENTIALS=false
# export DEPLOY_WITH_UPTIME_MEASUREMENTS=false
# export MEASURE_SYSLOG_AVAILABILITY=false
# export TCP_DOMAIN=""
# export AVAILABLE_PORT=""
# export FAIL_ON_DOWNTIME=false
# export APP_PUSHABILITY_THRESHOLD=0
# export HTTP_AVAILABILITY_THRESHOLD=0
# export RECENT_LOGS_THRESHOLD=0
# export STREAMING_LOGS_THRESHOLD=0
# export APP_SYSLOG_AVAILABILITY_THRESHOLD=0
# export USE_SINGLE_APP_INSTANCE=false
# export BOSH_DEPLOY_ARGS=""
# export BOSH_LITE=false
# export BBL_JSON_CONFIG=""
# export OPS_FILES="add-persistent-isolation-segment-diego-cell.yml \
# add-uaa-client-credentials.yml \
# add-oidc-provider.yml"
# ./cf-deployment-concourse-tasks/bosh-deploy/task
Loading

0 comments on commit 96231f9

Please sign in to comment.