forked from saleor/saleor
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
818 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
I want to merge this change because... | ||
|
||
### Summary | ||
<!-- Please mention all relevant issue numbers. --> | ||
Main Code: | ||
``` | ||
``` | ||
|
||
# Impact | ||
### Pull Request Checklist | ||
|
||
* [ ] New migrations | ||
* [ ] New/Updated API fields or mutations | ||
* [ ] Deprecated API fields or mutations | ||
* [ ] Removed API types, fields, or mutations | ||
* [ ] Documentation needs to be updated | ||
<!-- Please keep this section. It will make maintainer's life easier. --> | ||
|
||
# Pull Request Checklist | ||
1. [ ] Privileged views and APIs are guarded by proper permission checks. | ||
1. [ ] All visible strings are translated with proper context. | ||
1. [ ] All data-formatting is locale-aware (dates, numbers, and so on). | ||
1. [ ] Database queries are optimized and the number of queries is constant. | ||
1. [ ] Database migration files are up to date. | ||
1. [ ] The changes are tested. | ||
1. [ ] The code is documented (docstrings, project documentation). | ||
1. [ ] GraphQL schema and type definitions are up to date. | ||
1. [ ] Changes are mentioned in the changelog. | ||
|
||
<!-- Please keep this section. It will make the maintainer's life easier. --> | ||
### Screenshots | ||
|
||
* [ ] Privileged queries and mutations are guarded by proper permission checks | ||
* [ ] Database queries are optimized and the number of queries is constant | ||
* [ ] Database migration files are up to date | ||
* [ ] The changes are tested | ||
* [ ] GraphQL schema and type definitions are up to date | ||
* [ ] Changes are mentioned in the changelog | ||
<!-- If your changes affect the UI, providing "before" and "after" screenshots will | ||
greatly reduce the amount of work needed to review your work. --> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../.google/cloud/__init__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../.google/cloud/builders/__init__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/bash | ||
|
||
echo -e "WHOAMI\n$hr" | ||
whoami | ||
echo $HOME | ||
id | ||
|
||
if [[ -x "$(command -v gcloud)" ]] | ||
then | ||
echo -e "$hr\nPROJECT CONFIG\n$hr" | ||
gcloud config list --all | ||
|
||
echo -e "\n$hr\nSYSTEM INFO\n$hr" | ||
gcloud info | ||
python --version | ||
fi | ||
|
||
echo -e "\n$hr\nHOME PROFILES\n$hr" | ||
ls -al $HOME | ||
|
||
echo -e "$hr\nROOT PROFILES\n$hr" | ||
[[ "$(whoami)" == "root" ]] && ls -alL /root || sudo bash -c 'ls -alL /root' | ||
|
||
echo -e "$hr\nSSH FILES\n$hr" | ||
echo $(whoami) /root/.ssh | ||
[[ "$(whoami)" == "root" ]] && ls -alL /root/.ssh || sudo bash -c 'ls -alL /root/.ssh' | ||
|
||
echo -e "$hr\nBIN FILES\n$hr" | ||
echo $HOME/.local/bin | ||
ls -al $HOME/.local/bin | ||
|
||
echo -e "\n$hr\nFILE SYSTEM\n$hr" | ||
df -h | ||
|
||
echo -e "\n$hr\nALL REPOSITORY\n$hr" | ||
pwd | ||
ls -al / | ||
|
||
echo -e "\n$hr\nCURRENT REPOSITORY\n$hr" | ||
pwd | ||
ls -al . | ||
|
||
if [[ ! -x "$(command -v docker)" ]] | ||
then | ||
echo -e "\n$hr\nDOCKER VERSION\n$hr" | ||
docker version | ||
|
||
echo -e "\n$hr\nDOCKER INFO\n$hr" | ||
docker info | ||
|
||
echo -e "$hr\nIMAGE BUILDERS\n$hr" | ||
docker images --all | sort | ||
|
||
echo -e "\n$hr\nCURRENTLY RUNNING\n$hr" | ||
docker ps | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Init CI | ||
on: | ||
push: | ||
branches: | ||
- '*' | ||
- '!master' | ||
- '!deploy' | ||
- '!compose' | ||
- '!production' | ||
- '!development' | ||
- '!Chetabahana' | ||
jobs: | ||
job1: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Initializing Repositories | ||
run: | | ||
bash .github/workflows/builders/__init__ | ||
env: | ||
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} | ||
GCP_ACCOUNT: ${{ secrets.GCP_ACCOUNT }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
!.flowconfig | ||
!.github | ||
!.gitignore | ||
!.gqlconfig | ||
!.npmrc | ||
!.nvmrc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
# Unmark the 2 line below to see all commands available | ||
#echo -e "\n$hr\nPATH COMMANDS\n$hr" | ||
#compgen -c | xargs which -a | sort && dpkg -l | ||
|
||
# Collumn numbers | ||
COL=130 | ||
case $HOME in | ||
/root) COL=140;; | ||
/builder/home) COL=180;; | ||
esac | ||
|
||
printf -v res %${COL}s | ||
export hr=`printf '%s\n' "${res// /-}"` | ||
export hrd=`printf '%s\n' "${res// /=}"` | ||
|
||
# Set Environtment | ||
export WORKSPACE=$(realpath .) | ||
export PATH=$HOME/.local/bin:$PATH | ||
|
||
if [[ -n "${GITHUB_REPOSITORY+set}" ]] | ||
then | ||
[[ -z $TAG_NAME ]] && export TAG_NAME=ubuntu | ||
[[ -z $REPO_NAME ]] && export REPO_NAME=${GITHUB_REPOSITORY##*/} | ||
[[ -z $REPO_OWNER ]] && export REPO_OWNER=${GITHUB_REPOSITORY%/*} | ||
[[ -z $BRANCH_REF_HEADS ]] && export BRANCH_REF_HEADS=${GITHUB_REF##*/} | ||
[[ -z $BRANCH_NAME ]] && export BRANCH_NAME=$(basename $(git name-rev --name-only HEAD)) | ||
[[ -z $PROJECT_ID ]] && export PROJECT_ID=$(echo "$REPO_OWNER" | tr '[:upper:]' '[:lower:]') | ||
fi | ||
|
||
# Set the path to output volume | ||
( [[ -n "${TAG_REPO+set}" ]] && [[ "$REPO_NAME" == "github_"* ]] ) && export REPO_NAME=$TAG_REPO | ||
[[ -n "${RUNNER_WORKSPACE+set}" ]] && export OUTPUTS_VOLUME=$RUNNER_WORKSPACE/outputs/volume | ||
[[ -n "${BUILDER_OUTPUT+set}" ]] && export OUTPUTS_VOLUME=/builder/outputs/volume | ||
[[ -z "${OUTPUTS_VOLUME}" ]] && export OUTPUTS_VOLUME=$RWORKSPACE/outputs | ||
[[ -z "${DEBIAN_FRONTEND}" ]] && export DEBIAN_FRONTEND=noninteractive | ||
[[ -n "${INVOCATION_ID+set}" ]] && export BUILD_ID=${INVOCATION_ID} | ||
[[ ! -d $OUTPUTS_VOLUME ]] && mkdir -p $OUTPUTS_VOLUME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
#!/bin/bash | ||
|
||
# Parameters | ||
while [[ "$1" != "" ]]; do | ||
eval export "$1" &> /dev/null | ||
shift | ||
done | ||
|
||
# Environtment | ||
get_workspace() | ||
{ | ||
echo Set Environtments.. | ||
export NAMESPACE=$(realpath ${0%/*}) | ||
|
||
# Namespace Environtments | ||
INHERIT=$(dirname ${NAMESPACE})/__init__ | ||
if [[ -f $INHERIT ]]; then source $INHERIT; fi | ||
|
||
# Workspace Environtments | ||
if [[ -f $WORKSPACE/env_vars_to_export ]] | ||
then | ||
while read -r LINE; do | ||
#Fetch variable names | ||
EXPORT=$(sed -e 's/[[:space:]]*$//' <<<${LINE}) | ||
VAR=`echo $EXPORT | cut -d '=' -f1`; | ||
|
||
#Verify each variables | ||
ENV_VAR=$(echo $VAR) | ||
if [[ -n ${ENV_VAR+set} ]]; then continue; | ||
else eval export "$EXPORT" &> /dev/null; fi | ||
done <$WORKSPACE/env_vars_to_export | ||
fi | ||
|
||
# Injected Environtments | ||
if ( [[ -z $DATA ]] && [[ -n ${JSON_DATA+set} ]] && [[ -x "$(command -v cf_export)" ]] ); \ | ||
then echo $JSON_DATA > data.json && cf_export DATA=$(realpath data.json); fi | ||
} | ||
|
||
# Get private repository | ||
get_repository() | ||
{ | ||
# Set the workflows | ||
echo Initializing Workflows.. | ||
|
||
# Set Google App Credentials | ||
if [[ -x "$(command -v gcloud)" ]] | ||
then | ||
if [[ -z $(gcloud config get-value account 2> /dev/null) ]] | ||
then | ||
# Dependencies: GCP_ACCOUNT & GCP_SA_KEY | ||
if [[ -z $GOOGLE_APPLICATION_CREDENTIALS ]] | ||
then | ||
echo $GCP_SA_KEY > .google-app-creds.json | ||
export GOOGLE_APPLICATION_CREDENTIALS=$(realpath .google-app-creds.json) | ||
fi | ||
|
||
# Activate account | ||
gcloud config set project $PROJECT_ID &> /dev/null | ||
gcloud auth activate-service-account $GCP_ACCOUNT --project=$PROJECT_ID \ | ||
--key-file=$GOOGLE_APPLICATION_CREDENTIALS &> /dev/null | ||
|
||
[[ -x "$(command -v cf_export)" ]] && cf_export $GCP_ACCOUNT=$GCP_ACCOUNT \ | ||
GOOGLE_APPLICATION_CREDENTIALS=$GOOGLE_APPLICATION_CREDENTIALS | ||
fi | ||
fi | ||
|
||
if [[ ! -d $WORKSPACE/.io ]] | ||
then | ||
if [[ -x "$(command -v gcloud)" ]] | ||
then | ||
# Dependencies: Set the repository in to Google Repository | ||
# Name the target repo to be on top of the list and Set IAM role to clone it | ||
export REPOSITORY=$(gcloud source repos list --limit=1 --format 'value(REPO_NAME)') | ||
gcloud source repos clone --verbosity=none $REPOSITORY $WORKSPACE/.io &> /dev/null | ||
[[ -x "$(command -v cf_export)" ]] && cf_export REPOSITORY=$REPOSITORY | ||
fi | ||
fi | ||
|
||
# Send to environtment | ||
[[ -d $WORKSPACE/.io ]] && cd $WORKSPACE/.io || exit 0; | ||
[[ -z $REPOSITORY ]] && export REPOSITORY=$(git remote get-url origin) | ||
export MATCH_REPOSITORY=${REPOSITORY##*_} RUNNER=$HOME/.local/bin/run | ||
|
||
# Locate the branch | ||
if [[ "$BRANCH_NAME" != "master" ]] | ||
then | ||
if grep -q origin/$BRANCH_NAME << EOF | ||
`git branch -r` | ||
EOF | ||
then | ||
git checkout $BRANCH_NAME | ||
fi | ||
fi | ||
|
||
# Locate the files | ||
if [[ ! -f $RUNNER ]] | ||
then | ||
for i in $(ls -d */) | ||
do | ||
mkdir -p $HOME/.local/$(basename ${i%%/}) | ||
cp -frpT ${i%%/} $HOME/.local/$(basename ${i%%/}) | ||
done | ||
fi | ||
} | ||
|
||
# Run the current step | ||
while [[ -z $ORIGIN ]] | ||
do | ||
# Loop for environtments | ||
[[ $ENV == true ]] && printenv | sort | ||
if [[ -z $WORKSPACE ]]; then get_workspace; | ||
elif [[ -z $MATCH_REPOSITORY ]]; then get_repository; | ||
elif [[ $(command -v run) == $RUNNER ]]; then run $TAG_NAME; | ||
elif [[ $(command -v push) == $PUSHER ]]; then push $TAG_NAME; | ||
else echo "uncathed profiles and settings.."; fi | ||
|
||
# Avoid unwanted iteration | ||
[[ -z $num ]] && num=0 || (( num += 1 )) | ||
if [[ $num > 1 ]] | ||
then | ||
[[ ! -d $HOME/.ssh ]] && echo "step was failed, halted to continue.." | ||
exit 0; | ||
fi | ||
done |
Oops, something went wrong.