-
Notifications
You must be signed in to change notification settings - Fork 45
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
46 changed files
with
987 additions
and
100 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,9 @@ | ||
/.bundle/ | ||
/.yardoc | ||
/_yardoc/ | ||
/coverage/ | ||
/doc/ | ||
/pkg/ | ||
/spec/reports/ | ||
/tmp/ | ||
.byebug_history |
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,8 +1,13 @@ | ||
name: Uffizzi CLI CI/CD | ||
name: Test, Lint, Build, and Publish Image | ||
on: | ||
push: | ||
branches: | ||
- "**" | ||
- qa | ||
- develop | ||
- main | ||
pull_request: | ||
types: [opened,synchronize,reopened] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
@@ -26,10 +31,12 @@ jobs: | |
bundler-cache: true | ||
- name: Run tests | ||
run: bundle exec rake test | ||
deploy: | ||
build-and-push-some-branches: | ||
runs-on: ubuntu-latest | ||
needs: [lint, test] | ||
if: github.ref == 'refs/heads/main' | ||
needs: | ||
- lint | ||
- test | ||
if: ${{ github.ref_name == 'main' || github.ref_name == 'qa' || github.ref_name == 'develop' || github.event_name == 'pull_request' }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
@@ -40,8 +47,25 @@ jobs: | |
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Build and push | ||
- name: Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: uffizzi/cli | ||
tags: | | ||
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | ||
type=ref,event=branch,enable=${{ github.ref_name == 'qa' || github.ref_name == 'develop' }} | ||
type=ref,event=pr | ||
- name: Build and Push Image to Docker Hub | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
tags: uffizzi/cli:latest | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
- name: Update Docker Hub Description for Default Branch | ||
uses: peter-evans/[email protected] | ||
if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
repository: uffizzi/cli |
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,23 +1,46 @@ | ||
FROM ruby:3.0.2-alpine3.14 | ||
FROM ruby:3.0.3-alpine AS builder | ||
|
||
RUN apk update && apk upgrade | ||
RUN apk add bash | ||
RUN apk add curl-dev ruby-dev build-base git curl ruby-json openssl groff mandoc man-pages | ||
RUN apk --update add --no-cache \ | ||
curl-dev \ | ||
ruby-dev \ | ||
build-base \ | ||
git \ | ||
curl \ | ||
ruby-json \ | ||
openssl \ | ||
groff \ | ||
mandoc \ | ||
man-pages \ | ||
bash | ||
|
||
RUN mkdir -p /gem | ||
WORKDIR /gem | ||
|
||
ENV GEM_HOME="/usr/local/bundle" | ||
ENV PATH $GEM_HOME/bin:$GEM_HOME/gems/bin:$PATH | ||
|
||
RUN gem install uffizzi-cli | ||
RUN gem install bundler -v 2.3.8 | ||
RUN gem install bundler -v 2.3.9 | ||
|
||
COPY lib/uffizzi/version.rb /gem/lib/uffizzi/ | ||
COPY uffizzi.gemspec /gem/ | ||
COPY Gemfile* /gem/ | ||
COPY lib/uffizzi/version.rb ./lib/uffizzi/ | ||
COPY uffizzi.gemspec . | ||
COPY Gemfile* . | ||
RUN bundle install --jobs 4 | ||
|
||
COPY . /gem | ||
COPY . . | ||
|
||
CMD ["uffizzi"] | ||
RUN bundle exec rake install | ||
|
||
# M-M-M-M-MULTISTAGE!!! | ||
FROM ruby:3.0.3-alpine | ||
|
||
RUN apk --update add --no-cache mandoc | ||
|
||
WORKDIR /root/ | ||
|
||
COPY docker-entrypoint.sh . | ||
RUN chmod +x docker-entrypoint.sh | ||
|
||
COPY --from=builder /gem/pkg/uffizzi-cli* . | ||
RUN gem install ./uffizzi-cli* | ||
|
||
ENTRYPOINT ["/root/docker-entrypoint.sh"] |
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 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 |
---|---|---|
|
@@ -29,10 +29,10 @@ To host Uffizzi yourself, you will also need the following external dependencies | |
|
||
## Installation | ||
|
||
Add this line to your application's Gemfile: | ||
Add this line to your application's `Gemfile`: | ||
|
||
```ruby | ||
gem 'uffizzi' | ||
gem 'uffizzi-cli' | ||
``` | ||
|
||
And then execute: | ||
|
@@ -41,7 +41,23 @@ And then execute: | |
|
||
Or install it yourself as: | ||
|
||
$ gem install uffizzi | ||
$ gem install uffizzi-cli | ||
|
||
### Docker image | ||
|
||
We also provide an image on Docker Hub: | ||
|
||
```bash | ||
docker run -it --rm uffizzi/cli project list | ||
``` | ||
|
||
If you specify the following environment variables, the Docker image's | ||
entrypoint script can log you into Uffizzi before executing your command. | ||
|
||
- `UFFIZZI_USER` | ||
- `UFFIZZI_HOSTNAME` | ||
- `UFFIZZI_PASSWORD` | ||
- `UFFIZZI_PROJECT` (optional) | ||
|
||
## Development | ||
|
||
|
@@ -52,12 +68,23 @@ To install this gem onto your local machine, run `bundle exec rake install`. To | |
Run rubocop: | ||
`bundle exec rubocop -A` | ||
|
||
## Testing | ||
|
||
Run tests: | ||
`bundle exec rake test` | ||
|
||
Run tests from a file: | ||
`bundle exec rake test TEST=test/uffizzi/cli/preview_test.rb` | ||
|
||
Run single test | ||
`bundle exec rake test TEST=test/uffizzi/cli/preview_test.rb TESTOPTS="--name=test_name"` | ||
|
||
## Commands | ||
|
||
### login | ||
|
||
``` | ||
$ uffizzi login -u [email protected] --hostname localhost:8080 | ||
$ uffizzi login --user [email protected] --hostname localhost:8080 | ||
``` | ||
|
||
Logging you into the app which you set in the hostname option. | ||
|
@@ -167,7 +194,7 @@ git checkout -b feature/short_issue_description (e.g. feature/add_domain_setting | |
``` | ||
git add . | ||
git commit -m 'short commit description' (e.g. git commit -m 'added domain settings') | ||
git push origin FEATURE_NAME | ||
git push origin BRANCH_NAME | ||
``` | ||
|
||
4. You already can create PR with develop branch as a target. Once the feature is ready let us know in the channel - we will review | ||
|
@@ -176,7 +203,7 @@ git push origin FEATURE_NAME | |
``` | ||
git checkout qa | ||
git pull --rebase qa | ||
git merge --no-ff FEATURE_NAME | ||
git merge --no-ff BRANCH_NAME | ||
git push origin qa | ||
``` | ||
|
||
|
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
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 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,20 @@ | ||
#!/bin/sh | ||
|
||
set -e # Exit immediately if anything below exits with non-zero status. | ||
|
||
if | ||
[ $UFFIZZI_USER ] && | ||
[ $UFFIZZI_HOSTNAME ] && | ||
[ $UFFIZZI_PASSWORD ] | ||
then | ||
uffizzi login --username "${UFFIZZI_USER}" --hostname "${UFFIZZI_HOSTNAME}" | ||
if [ $UFFIZZI_PROJECT ] | ||
then | ||
uffizzi config set project "${UFFIZZI_PROJECT}" | ||
fi | ||
else | ||
echo "Specify environment variables to login before executing Uffizzi CLI." | ||
echo "UFFIZZI_USER, UFFIZZI_HOSTNAME, UFFIZZI_PASSWORD, and optionally UFFIZZI_PROJECT" | ||
fi | ||
|
||
exec uffizzi "$@" |
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 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 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,6 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'io/console' | ||
require 'uffizzi' | ||
require 'uffizzi/clients/api/api_client' | ||
|
||
|
Oops, something went wrong.