forked from bitnami/containers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit for bitnami/containers
Signed-off-by: Miguel A. Cabrera Minagorri <mcabrera@vmware.com>
- Loading branch information
0 parents
commit 2fde92e
Showing
5 changed files
with
205 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Contributor Code of Conduct | ||
|
||
As contributors and maintainers of this project, we pledge to respect everyone who contributes by posting issues, updating documentation, submitting pull requests, providing feedback in comments, and any other activities. | ||
|
||
Communication through any of Bitnami's channels (GitHub, mailing lists, Twitter, and so on) must be constructive and never resort to personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct. | ||
|
||
We promise to extend courtesy and respect to everyone involved in this project, regardless of gender, gender identity, sexual orientation, disability, age, race, ethnicity, religion, or level of experience. We expect anyone contributing to this project to do the same. | ||
|
||
If any member of the community violates this code of conduct, the maintainers of this project may take action, including removing issues, comments, and PRs or blocking accounts, as deemed appropriate. | ||
|
||
If you are subjected to or witness unacceptable behavior, or have any other concerns, please communicate with us. | ||
|
||
If you have suggestions to improve this Code of Conduct, please submit an issue or PR. | ||
|
||
**Attribution** | ||
|
||
This Code of Conduct is adapted from the Angular project available at this page: https://github.com/angular/code-of-conduct/blob/master/CODE_OF_CONDUCT.md |
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,52 @@ | ||
# Contributing Guidelines | ||
|
||
Contributions are welcome via GitHub Pull Requests. This document outlines the process to help get your contribution accepted. | ||
|
||
Any type of contribution is welcome: new features, bug fixes, documentation improvements, etc. | ||
|
||
## How to Contribute | ||
|
||
1. Fork this repository, develop, and test your changes. | ||
2. Submit a pull request. | ||
|
||
### Requirements | ||
|
||
When submitting a PR make sure that: | ||
- It must pass CI jobs for linting and test the changes (if any). | ||
- It must follow [container best practices](https://engineering.bitnami.com/articles/best-practices-writing-a-dockerfile.html). | ||
- The title of the PR is clear enough and starts with "[bitnami/<container-name>]" | ||
- If necessary, add information to the repository's `README.md`. | ||
|
||
#### Sign Your Work | ||
|
||
The sign-off is a simple line at the end of the explanation for a commit. All commits needs to be signed. Your signature certifies that you wrote the patch or otherwise have the right to contribute the material. The rules are pretty simple, you only need to certify the guidelines from [developercertificate.org](https://developercertificate.org/). | ||
|
||
Then you just add a line to every git commit message: | ||
|
||
Signed-off-by: Joe Smith <joe.smith@example.com> | ||
|
||
Use your real name (sorry, no pseudonyms or anonymous contributions.) | ||
|
||
If you set your `user.name` and `user.email` git configs, you can sign your commit automatically with `git commit -s`. | ||
|
||
Note: If your git config information is set properly then viewing the `git log` information for your commit will look something like this: | ||
|
||
``` | ||
Author: Joe Smith <joe.smith@example.com> | ||
Date: Thu Feb 2 11:41:15 2018 -0800 | ||
Update README | ||
Signed-off-by: Joe Smith <joe.smith@example.com> | ||
``` | ||
|
||
Notice the `Author` and `Signed-off-by` lines match. If they don't your PR will be rejected by the automated DCO check. | ||
|
||
### PR Approval and Release Process | ||
|
||
1. Changes are manually reviewed by Bitnami team members usually within a business day. | ||
2. Once the changes are accepted, the PR is tested (if needed) into the Bitnami CI pipeline, the container is deployed and tested (verification and functional tests) using docker-compose and Helm (if there is an associated Helm Chart). | ||
3. The PR is merged by the reviewer(s) in the GitHub `master` branch. | ||
4. Then our CI/CD system is going to push the container image to the different registries including the recently merged changes. | ||
|
||
***NOTE***: Please note that, in terms of time, may be a slight difference between the appearance of the code in GitHub and the image with the changes in the different registries. |
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,13 @@ | ||
Copyright © 2022 Bitnami | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
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 @@ | ||
# Bitnami Containers |
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,122 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
set -o xtrace # Uncomment this line for debugging purpose | ||
|
||
TARGET_DIR="." | ||
|
||
# App and repo that will be used as base | ||
BASE_REPO="https://github.com/bitnami/bitnami-docker-wordpress" | ||
|
||
function joinStrings() { | ||
local a=("${@:3}") | ||
printf "%s" "$2${a[@]/#/$1}" | ||
} | ||
|
||
function moveFilesExcluding() { | ||
local -r dest="${1:?Missing destination directory}" | ||
shift | ||
local -r excludeFiles=("$@") | ||
echo "Files to exclude: ${excludeFiles[@]}" | ||
mkdir -p "$dest" | ||
|
||
local -r f_exclude_flags=($(joinStrings ' -and ! -name ' "${excludeFiles[@]}")) | ||
echo "${f_exclude_flags[@]}" | ||
find . -depth 1 ! -name "${f_exclude_flags[@]}" | while read -r file; do | ||
cp -a "$file" "${dest}/" | ||
rm -Rf "$file" | ||
done | ||
} | ||
|
||
function queryRepos() { | ||
local page=0 | ||
local repos="[]" # Initial empty JSON array | ||
local -r repos_per_page="100" | ||
|
||
while [[ "$page" -gt -1 ]]; do | ||
# Query only the public repos since we won't add private containers to bitnami/containers | ||
page_repos="$(curl -H 'Content-Type: application/json' -H 'Accept: application/json' "https://api.github.com/orgs/bitnami/repos?type=public&per_page=${repos_per_page}&page=${page}")" | ||
repos="$(jq -s 'reduce .[] as $x ([]; . + $x)' <(echo "$repos") <(echo "$page_repos"))" | ||
n_repos="$(jq length <<< "$page_repos")" | ||
if [[ "$n_repos" -lt "$repos_per_page" ]]; then | ||
page="-1" | ||
else | ||
page="$((page + 1))" | ||
fi | ||
done | ||
|
||
echo "$repos" | ||
} | ||
|
||
function getContainerRepos() { | ||
local -r repos="$(queryRepos)" | ||
local -r container_repos="$(jq -r '[ .[] | select(.name | test("bitnami-docker-.")) ]' <<< "$repos")" | ||
echo "$container_repos" > /tmp/repos | ||
echo "$container_repos" | ||
} | ||
|
||
# Commits a directory | ||
function commitChanges() { | ||
git config user.name "Bitnami Containers" | ||
git config user.email "containers@bitnami.com" | ||
|
||
git diff --exit-code || (git add -A && git commit -m "Sync ${name} files") | ||
} | ||
|
||
function pushChanges() { | ||
git config user.name "Bitnami Containers" | ||
git config user.email "containers@bitnami.com" | ||
git push | ||
} | ||
|
||
function mergeRepos() { | ||
local -r repos="$(getContainerRepos)" | ||
# Files that should not be moved | ||
local -r static_files=(. .git containers) | ||
# Files that will checkout bitnami/containers main branch on every sync | ||
local -r special_files=(CONTRIBUTING.md CODE_OF_CONDUCT.md LICENSE.md .github scripts) | ||
|
||
mkdir -p "$TARGET_DIR" | ||
|
||
# Build array of app names since we need to exclude them when moving files | ||
local apps=("mock") | ||
local -r urls=($(echo "$repos" | jq -r '.[].html_url')) | ||
for repo_url in "${urls[@]}"; do | ||
name="${repo_url:42}" # 42 is the length of https://github.com/bitnami/bitnami-docker- | ||
apps=("${apps[@]}" "$name") | ||
done | ||
echo "$repos" | jq -r '.[].html_url' | while read -r repo_url; do | ||
name="${repo_url:42}" # 42 is the length of https://github.com/bitnami/bitnami-docker- | ||
( | ||
cd "$TARGET_DIR" | ||
mkdir -p "containers/${name}" # Create directory for the app | ||
# Back up the README.md to avoid getting merge conflicts | ||
#mv README.md README.md.back | ||
# clone the repositoy outside of this one | ||
git clone "$repo_url" ../temporal/"$name" | ||
( | ||
cd ../temporal/"$name" | ||
mkdir -p containers/"$name" | ||
git-filter-repo --to-subdirectory-filter containers/"$name" --force | ||
) | ||
# Fetch the old repo and merge maintaining history | ||
git remote add --fetch "$name" "../temporal/${name}" | ||
git merge "${name}/master" --allow-unrelated-histories --no-log --no-ff -Xtheirs #--no-commit | ||
#git checkout main "${special_files[@]}" | ||
git remote remove "$name" | ||
rm -Rf ../temporal/"$name" | ||
# Move the content to the app directory | ||
# moveFilesExcluding "containers/${name}" "${static_files[@]}" "README.md.back" "${special_files[@]}" "${apps[@]}" | ||
# Recover README.md | ||
#mv README.md.back README.md | ||
#commitChanges | ||
exit 0 | ||
) | ||
done | ||
|
||
pushChanges | ||
} | ||
|
||
mergeRepos |