Skip to content

Commit 6579a75

Browse files
Initial commit
0 parents  commit 6579a75

15 files changed

+1021
-0
lines changed

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
# directory: "/" ==> search in .github/workflows under root `/` or action.yml at root
7+
version: 2
8+
updates:
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: "weekly"
13+
day: "sunday"
14+
time: "16:00"
15+
groups:
16+
all-actions:
17+
patterns: [ "*" ]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Rebuild Docker Container
2+
3+
on:
4+
workflow_dispatch:
5+
# Enables running the workflow manually
6+
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch
7+
schedule:
8+
# Run at 1:00 AM UTC on Sundays (may be delayed depending on resource availability)
9+
# https://crontab.guru/#0_1_*_*_0
10+
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
11+
- cron: '0 1 * * 0'
12+
13+
jobs:
14+
rebuild-docker:
15+
runs-on: self-hosted
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: heroku-reference-apps/github-heroku-flow-action@main
19+
with:
20+
heroku-api-key: ${{secrets.HEROKU_API_KEY}} # set it on GitHub as secret
21+
heroku-app-name: ${{vars.HEROKU_SELFHOSTED_RUNNER_APPNAME}} # set it on GitHub as variable

.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# This file is used for Git repositories to specify intentionally untracked files that Git should ignore.
2+
# If you are not using git, you can delete this file. For more information see: https://git-scm.com/docs/gitignore
3+
# For useful gitignore templates see: https://github.com/github/gitignore
4+
5+
# IntelliJ IDE
6+
*.iml
7+
.idea/
8+
IlluminatedCloud/
9+
10+
# Visual Studio Code
11+
.vscode/
12+
13+
# Salesforce cache
14+
.sfdx/
15+
16+
# Logs
17+
logs
18+
*.log
19+
npm-debug.log*
20+
yarn-debug.log*
21+
yarn-error.log*
22+
23+
# Dependency directories
24+
node_modules/
25+
26+
# Eslint cache
27+
.eslintcache
28+
29+
# MacOS system files
30+
.DS_Store
31+
32+
# Windows system files
33+
Thumbs.db
34+
ehthumbs.db
35+
[Dd]esktop.ini
36+
$RECYCLE.BIN/
37+
38+
# Local development
39+
*.env
40+
*.dev
41+
.act

CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Comment line immediately above ownership line is reserved for related other information. Please be careful while editing.
2+
#ECCN:Open Source 5D002

CODE_OF_CONDUCT.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Salesforce Open Source Community Code of Conduct
2+
3+
## About the Code of Conduct
4+
5+
Equality is a core value at Salesforce. We believe a diverse and inclusive
6+
community fosters innovation and creativity, and are committed to building a
7+
culture where everyone feels included.
8+
9+
Salesforce open-source projects are committed to providing a friendly, safe, and
10+
welcoming environment for all, regardless of gender identity and expression,
11+
sexual orientation, disability, physical appearance, body size, ethnicity, nationality,
12+
race, age, religion, level of experience, education, socioeconomic status, or
13+
other similar personal characteristics.
14+
15+
The goal of this code of conduct is to specify a baseline standard of behavior so
16+
that people with different social values and communication styles can work
17+
together effectively, productively, and respectfully in our open source community.
18+
It also establishes a mechanism for reporting issues and resolving conflicts.
19+
20+
All questions and reports of abusive, harassing, or otherwise unacceptable behavior
21+
in a Salesforce open-source project may be reported by contacting the Salesforce
22+
Open Source Conduct Committee at [email protected].
23+
24+
## Our Pledge
25+
26+
In the interest of fostering an open and welcoming environment, we as
27+
contributors and maintainers pledge to making participation in our project and
28+
our community a harassment-free experience for everyone, regardless of gender
29+
identity and expression, sexual orientation, disability, physical appearance,
30+
body size, ethnicity, nationality, race, age, religion, level of experience, education,
31+
socioeconomic status, or other similar personal characteristics.
32+
33+
## Our Standards
34+
35+
Examples of behavior that contributes to creating a positive environment
36+
include:
37+
38+
* Using welcoming and inclusive language
39+
* Being respectful of differing viewpoints and experiences
40+
* Gracefully accepting constructive criticism
41+
* Focusing on what is best for the community
42+
* Showing empathy toward other community members
43+
44+
Examples of unacceptable behavior by participants include:
45+
46+
* The use of sexualized language or imagery and unwelcome sexual attention or
47+
advances
48+
* Personal attacks, insulting/derogatory comments, or trolling
49+
* Public or private harassment
50+
* Publishing, or threatening to publish, others' private information—such as
51+
a physical or electronic address—without explicit permission
52+
* Other conduct which could reasonably be considered inappropriate in a
53+
professional setting
54+
* Advocating for or encouraging any of the above behaviors
55+
56+
## Our Responsibilities
57+
58+
Project maintainers are responsible for clarifying the standards of acceptable
59+
behavior and are expected to take appropriate and fair corrective action in
60+
response to any instances of unacceptable behavior.
61+
62+
Project maintainers have the right and responsibility to remove, edit, or
63+
reject comments, commits, code, wiki edits, issues, and other contributions
64+
that are not aligned with this Code of Conduct, or to ban temporarily or
65+
permanently any contributor for other behaviors that they deem inappropriate,
66+
threatening, offensive, or harmful.
67+
68+
## Scope
69+
70+
This Code of Conduct applies both within project spaces and in public spaces
71+
when an individual is representing the project or its community. Examples of
72+
representing a project or community include using an official project email
73+
address, posting via an official social media account, or acting as an appointed
74+
representative at an online or offline event. Representation of a project may be
75+
further defined and clarified by project maintainers.
76+
77+
## Enforcement
78+
79+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
80+
reported by contacting the Salesforce Open Source Conduct Committee
81+
at [email protected]. All complaints will be reviewed and investigated
82+
and will result in a response that is deemed necessary and appropriate to the
83+
circumstances. The committee is obligated to maintain confidentiality with
84+
regard to the reporter of an incident. Further details of specific enforcement
85+
policies may be posted separately.
86+
87+
Project maintainers who do not follow or enforce the Code of Conduct in good
88+
faith may face temporary or permanent repercussions as determined by other
89+
members of the project's leadership and the Salesforce Open Source Conduct
90+
Committee.
91+
92+
## Attribution
93+
94+
This Code of Conduct is adapted from the [Contributor Covenant][contributor-covenant-home],
95+
version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html.
96+
It includes adaptions and additions from [Go Community Code of Conduct][golang-coc],
97+
[CNCF Code of Conduct][cncf-coc], and [Microsoft Open Source Code of Conduct][microsoft-coc].
98+
99+
This Code of Conduct is licensed under the [Creative Commons Attribution 3.0 License][cc-by-3-us].
100+
101+
[contributor-covenant-home]: https://www.contributor-covenant.org (https://www.contributor-covenant.org/)
102+
[golang-coc]: https://golang.org/conduct
103+
[cncf-coc]: https://github.com/cncf/foundation/blob/master/code-of-conduct.md
104+
[microsoft-coc]: https://opensource.microsoft.com/codeofconduct/
105+
[cc-by-3-us]: https://creativecommons.org/licenses/by/3.0/us/

CONTRIBUTING.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
*This is a suggested `CONTRIBUTING.md` file template for use by open sourced Salesforce projects. The main goal of this file is to make clear the intents and expectations that end-users may have regarding this project and how/if to engage with it. Adjust as needed (especially look for `{project_slug}` which refers to the org and repo name of your project) and remove this paragraph before committing to your repo.*
2+
3+
# Contributing Guide For Heroku-hosted runner for GitHub Actions
4+
5+
This page lists the operational governance model of this project, as well as the recommendations and requirements for how to best contribute to {PROJECT}. We strive to obey these as best as possible. As always, thanks for contributing – we hope these guidelines make it easier and shed some light on our approach and processes.
6+
7+
# Governance Model
8+
9+
## Published but not supported
10+
11+
The intent and goal of open sourcing this project is because it may contain useful or interesting code/concepts that we wish to share with the larger open source community. Although occasional work may be done on it, we will not be looking for or soliciting contributions.
12+
13+
# Getting started
14+
15+
Please join the community on {Here list Slack channels, Email lists, Glitter, Discord, etc... links}. Also please make sure to take a look at the project [roadmap](ROADMAP.md) to see where are headed.
16+
17+
# Issues, requests & ideas
18+
19+
Use GitHub Issues page to submit issues, enhancement requests and discuss ideas.
20+
21+
### Bug Reports and Fixes
22+
- If you find a bug, please search for it in the [Issues](https://github.com/{project_slug}/issues), and if it isn't already tracked,
23+
[create a new issue](https://github.com/{project_slug}/issues/new). Fill out the "Bug Report" section of the issue template. Even if an Issue is closed, feel free to comment and add details, it will still
24+
be reviewed.
25+
- Issues that have already been identified as a bug (note: able to reproduce) will be labelled `bug`.
26+
- If you'd like to submit a fix for a bug, [send a Pull Request](#creating_a_pull_request) and mention the Issue number.
27+
- Include tests that isolate the bug and verifies that it was fixed.
28+
29+
### New Features
30+
- If you'd like to add new functionality to this project, describe the problem you want to solve in a [new Issue](https://github.com/{project_slug}/issues/new).
31+
- Issues that have been identified as a feature request will be labelled `enhancement`.
32+
- If you'd like to implement the new feature, please wait for feedback from the project
33+
maintainers before spending too much time writing the code. In some cases, `enhancement`s may
34+
not align well with the project objectives at the time.
35+
36+
### Tests, Documentation, Miscellaneous
37+
- If you'd like to improve the tests, you want to make the documentation clearer, you have an
38+
alternative implementation of something that may have advantages over the way its currently
39+
done, or you have any other change, we would be happy to hear about it!
40+
- If its a trivial change, go ahead and [send a Pull Request](#creating_a_pull_request) with the changes you have in mind.
41+
- If not, [open an Issue](https://github.com/{project_slug}/issues/new) to discuss the idea first.
42+
43+
If you're new to our project and looking for some way to make your first contribution, look for
44+
Issues labelled `good first contribution`.
45+
46+
# Contribution Checklist
47+
48+
- [x] Clean, simple, well styled code
49+
- [x] Commits should be atomic and messages must be descriptive. Related issues should be mentioned by Issue number.
50+
- [x] Comments
51+
- Module-level & function-level comments.
52+
- Comments on complex blocks of code or algorithms (include references to sources).
53+
- [x] Tests
54+
- The test suite, if provided, must be complete and pass
55+
- Increase code coverage, not versa.
56+
- Use any of our testkits that contains a bunch of testing facilities you would need. For example: `import com.salesforce.op.test._` and borrow inspiration from existing tests.
57+
- [x] Dependencies
58+
- Minimize number of dependencies.
59+
- Prefer Apache 2.0, BSD3, MIT, ISC and MPL licenses.
60+
- [x] Reviews
61+
- Changes must be approved via peer code review
62+
63+
# Creating a Pull Request
64+
65+
1. **Ensure the bug/feature was not already reported** by searching on GitHub under Issues. If none exists, create a new issue so that other contributors can keep track of what you are trying to add/fix and offer suggestions (or let you know if there is already an effort in progress).
66+
3. **Clone** the forked repo to your machine.
67+
4. **Create** a new branch to contain your work (e.g. `git br fix-issue-11`)
68+
4. **Commit** changes to your own branch.
69+
5. **Push** your work back up to your fork. (e.g. `git push fix-issue-11`)
70+
6. **Submit** a Pull Request against the `main` branch and refer to the issue(s) you are fixing. Try not to pollute your pull request with unintended changes. Keep it simple and small.
71+
7. **Sign** the Salesforce CLA (you will be prompted to do so when submitting the Pull Request)
72+
73+
> **NOTE**: Be sure to [sync your fork](https://help.github.com/articles/syncing-a-fork/) before making a pull request.
74+
75+
76+
# Code of Conduct
77+
Please follow our [Code of Conduct](CODE_OF_CONDUCT.md).
78+
79+
# License
80+
By contributing your code, you agree to license your contribution under the terms of our project [LICENSE](LICENSE.txt) and to sign the [Salesforce CLA](https://cla.salesforce.com/sign-cla)

Dockerfile

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Use the same image that Heroku apps use.
2+
# https://devcenter.heroku.com/articles/stack
3+
FROM heroku/heroku:24
4+
5+
# Inform utilities that we are in non-interactive mode.
6+
ARG TERM=linux
7+
ARG DEBIAN_FRONTEND=noninteractive
8+
9+
# this ARG can be overridden changing the heroku.yml, it must be 'latest' or a dot-separated number (e.g. 2.320.1)
10+
# https://devcenter.heroku.com/articles/build-docker-images-heroku-yml#set-build-time-environment-variables
11+
ARG RUNNER_VERSION=latest
12+
13+
USER root
14+
15+
# Switch to bash shell.
16+
#
17+
# This resolves an error when the ENTRYPOINT script is started:
18+
# "OCI runtime create failed: container_linux.go:380:
19+
# starting container process caused: exec: "/bin/sh":
20+
# stat /bin/sh: no such file or directory: unknown"
21+
#
22+
# Note, even though Docker supports a 'SHELL' setting, Heroku doesn't support it.
23+
# https://devcenter.heroku.com/articles/container-registry-and-runtime#unsupported-dockerfile-commands
24+
#
25+
# Remove /bin/sh and link to bash shell.
26+
# https://stackoverflow.com/a/46670119/470818
27+
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
28+
29+
# Creating Heroku Dyno-like Environment with Docker
30+
# This makes it more consistent with how Heroku dynos run,
31+
# which set $HOME to '/app' and run as a non-root user.
32+
# https://github.com/heroku/stack-images/issues/56#issuecomment-323378577
33+
# https://github.com/heroku/stack-images/issues/56#issuecomment-348246257
34+
ARG HOME="/app"
35+
ENV HOME=${HOME}
36+
WORKDIR ${HOME}
37+
38+
# Paths where we'll install various tools.
39+
ARG ACTIONS_DIR="${HOME}/actions-runner"
40+
41+
# Create a non-root user. Heroku will not run as root.
42+
# This step creates a user named 'docker' and creates its home directory.
43+
# The user could be named anything, 'docker' just seemed fitting.
44+
# https://ss64.com/bash/useradd.html
45+
RUN useradd -m -d ${HOME} docker \
46+
&& mkdir -p ${ACTIONS_DIR}
47+
48+
# ------------------------------------------------------------------------------
49+
# Install GitHub Actions Runner
50+
#
51+
# The following commands come from GitHub's instructions
52+
# at the time you choose which kind of self-hosted runner to create.
53+
# https://github.com/organizations/{org}/settings/actions/runners/new
54+
#
55+
# Some of the instructions are inspired by the tutorial at
56+
# https://testdriven.io/blog/github-actions-docker
57+
#
58+
# Learn more about self-hosted runners at
59+
# https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners
60+
# ------------------------------------------------------------------------------
61+
62+
# Switch to the actions directory to download and install the package.
63+
# Note, doing a `cd` command in a `RUN` operation won't work like in a terminal,
64+
# you must use `WORKDIR` to change your working directory.
65+
WORKDIR ${ACTIONS_DIR}
66+
67+
# Download the latest GitHub Actions runner package.
68+
COPY install-actions-runner.sh /tmp/install-actions-runner.sh
69+
RUN sh /tmp/install-actions-runner.sh "$RUNNER_VERSION" && rm -f /tmp/install-actions-runner.sh
70+
71+
# ------------------------------------------------------------------------------
72+
# Copy files and set permissions
73+
# ------------------------------------------------------------------------------
74+
75+
# Copy over our start.sh script that's in our repository
76+
# and store it in the docker user's home directory.
77+
COPY start.sh ${HOME}/start.sh
78+
79+
# Make the script executable and
80+
# Make our docker user owner of the files we've added to the image.
81+
RUN chmod ug+x ${HOME}/start.sh \
82+
&& chown -R docker:docker ${HOME}
83+
84+
# Clean up the apt cache (as ./bin/installdependencies.sh above may install apt packages) to reduce image size for faster starts.
85+
RUN apt-get autoremove --yes \
86+
&& apt-get clean --yes \
87+
&& rm -rf /var/lib/apt/lists/*
88+
89+
# Security hardening - removes SUID and SGID bits from executable files:
90+
# - Removes potentially dangerous elevated privileges
91+
# - Reduces the attack surface
92+
# - Follows the principle of least privilege
93+
RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true
94+
95+
# ------------------------------------------------------------------------------
96+
# Create User
97+
# ------------------------------------------------------------------------------
98+
99+
# Since the config and run scripts for actions are not allowed to be run by root,
100+
# switch to a different user so all subsequent commands are run as that user.
101+
USER docker
102+
103+
# Confirm actions is where it should be.
104+
RUN ${ACTIONS_DIR}/config.sh --version \
105+
&& ${ACTIONS_DIR}/config.sh --commit
106+
107+
# Set the script to execute when the image starts.
108+
# Note, even though Docker supports a 'SHELL' setting, Heroku doesn't support it.
109+
# https://devcenter.heroku.com/articles/container-registry-and-runtime#unsupported-dockerfile-commands
110+
#ENTRYPOINT ["/bin/bash", "-c", "/app/start.sh"]
111+
CMD ["/app/start.sh"]
112+

0 commit comments

Comments
 (0)